<?php

class Aireporter_model extends Cf_Model
{
    private $endpoint = '/ai/text-to-sql';

    public function message(string $question, array $history = [])
    {
        return json_decode(
            $this->getRestClient()->post(
                $this->endpoint,
                ['question' => $question, 'history' => $history],
                htmlSpecialCharsEncode: false,
            ),
            associative: true,
        );
    }
}
