<?php
namespace Claromentis\Calendar\Ai;

$GLOBALS["__65da1b1ec2d6653e8a0ab7848e53" . "6215"] = (@$GLOBALS["__65da1b1ec2d" . "6653e8a0ab784" . "8e536215"] ?: array()) + array("_aaabebe" . "7ea4dcd2" . "4a8e6b36" . "cfe51142" . "2" => base64_decode("VV" . "RD"), "_a92c6398f0b00deb3ab06f" . "71879f7545" => base64_decode("c3RhcnRE" . "YXRl"), "_da0554e7f66942dcf" . "b6ce9b56131f140" => base64_decode("Y2FsZ" . "W5kYX" . "I="), "_730c8fb144637eb321e7" . "9f0605f79b4a" => base64_decode("CgktIEN1cnJlbnQgVW5peCBUaW1lc3Rhb" . "XA6IA=="), "_8baf6ac4d" . "c0b89cfa6a" . "5abea49db1" . "f56" => base64_decode("VGhlIGJlZ2lubmluZyBvZiB0aGUgZGF0ZSByYW5nZSAoVW5peCB0aW1lc3RhbXA" . "sIFVUQyku"), "_e258c5dc522b65a06457" . "11c5089a8e9c" => base64_decode("aXRlbXM" . "="), "_9e0a9446602a728eddf64b23" . "af901ea0" => base64_decode("ZW5kRGF0" . "ZQ=="), "_688e8aa058a03eb9e9769da71931" . "6557" => base64_decode("WS1tLWQgSDppOnM" . "="), "_600b2f640f54132db595bb60" . "f15e0676" => base64_decode("WS1tLWQ" . "="), "_f26a57835a7" . "9e37dde9c180" . "d23863a61" => base64_decode("CVVzZSB0aGlzIHRvb2wgdG8gcmV0cmlldmUgZXZlbnRzIGZyb20gdGhlIHVzZXIncyBwZXJzb25hbCBhbmQgY29tcGFueS13aWRlIGNhbGVuZGFycy4KCUl0IHJldHVybnMgYWxsIGV2Z" . "W50cyB0aGUgdXNlciBoYXMgcGVybWlzc2lvbiB0byB2aWV3IHdpdGhpbiBhIHNwZWNpZmljIGRhdGUgcmFuZ2UuCgoJQ1JJVElDQUwgQ09OVEVYVDoKCS0gVG9kYXkncyBEYXRlOiA="), "_294579c234bf40023d4525f0f" . "32b7cca" => base64_decode("VGhlIGVuZCBvZiB0aGUgZGF0ZSB" . "yYW5nZSAoVW5peCB0aW1lc3RhbX" . "AsIFVUQyku"), "_7292a62b64774bf" . "aa76bdb9c5f6026f" . "f" => base64_decode("LgoJSWYgYSB1c2VyIGRvZXNuJ3QgcHJvdm" . "lkZSBhIHN0YXJ0IGRhdGUgb3IgZW5kIGRh" . "dGUsIGdyYWIgZXZlbnRzIGZvciB0aGlzIH" . "dlZWsu"), "_0c519e721cc3079fbb252fbd60fd790" . "4" => base64_decode("dGl" . "tZQ" . "=="), "_f53ea64d23c54" . "c316bfd8fc86a6" . "635c7" => base64_decode("CgoJVXNlIHRoaXMgd2hlbmV2ZXIgYSB1c2VyIGFza3MgYWJvdXQgdGhlaXIgc2NoZWR1bGUsIHVwY29taW5nIG1lZXRpbmdzLCBvciBjb21wYW55IGhvbGlkYXlz" . "LgoJSWYgYSB1c2VyIGFza3MgZm9yICJ0b2RheSIsIHVzZSB0aGUgcmFuZ2UgZnJvbSB0aGUgc3RhcnQgdG8gdGhlIGVuZCBvZiA="));
use Claromentis\Calendar\Format\EventFormatter;
use Claromentis\Core\Ai\AiParameterType;
use Claromentis\Core\Ai\AiTextGenerationConfiguration;
use Claromentis\Core\Ai\Tools\AiParameterDefinition;
use Claromentis\Core\Ai\Tools\AiToolInterface;
use Claromentis\Core\Ai\Tools\AiToolSchemaBuilder;
use Claromentis\Core\Services;
use Date;
class AiCalendarTool implements AiToolInterface
{
    private EventFormatter $eventFormatter;
    public function __construct(EventFormatter $_d972de905a99bbc1a92c54b3669721fd)
    {
        $this->eventFormatter = $_d972de905a99bbc1a92c54b3669721fd;
    }
    public function getName() : string
    {
        return $GLOBALS["__65da1b1ec2d66" . "53e8a0ab7848e53" . "6215"]["_da0554e7f66942dcfb6ce9b" . "56131f140"];
    }
    public function getDescription() : string
    {
        $_d230962d9a57dc6ba2b774d9ba3bb81e = $GLOBALS["__65da1b1ec2d6653e8a0ab7848e5362" . "15"]["_0c519e721cc3079fbb252fbd6" . "0fd7904"]();
        $_5109895e3895ae9217ef168ea501d540 = (new Date())->format($GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"]["_600b2f6" . "40f54132" . "db595bb6" . "0f15e067" . "6"]);
        return $GLOBALS["__65da1b1ec2d665" . "3e8a0ab7848e5362" . "15"]["_f26a57835a79e37dde9c18" . "0d23863a61"] . $_5109895e3895ae9217ef168ea501d540 . $GLOBALS["__65da1b1ec2d6653e8a0ab7848e5362" . "15"]["_730c8fb144637eb" . "321e79f0605f79b4" . "a"] . $_d230962d9a57dc6ba2b774d9ba3bb81e . $GLOBALS["__65da1b1ec2" . "d6653e8a0ab7" . "848e536215"]["_f53ea64d" . "23c54c316" . "bfd8fc86a" . "6635c7"] . $_5109895e3895ae9217ef168ea501d540 . $GLOBALS["__65da1b1ec2d6653e8a0ab7848e5" . "36215"]["_7292a62b64774bfaa76bdb9c5f" . "6026ff"];
    }
    public function execute(array $args, AiTextGenerationConfiguration $config) : array
    {
        $_a92c6398f0b00deb3ab06f71879f7545 = $args[$GLOBALS["__65da1b1ec2d6653e8a0ab7848e53621" . "5"]["_a92c6398f0b00deb3ab" . "06f71879f7545"]] ?? null;
        $_9e0a9446602a728eddf64b23af901ea0 = $args[$GLOBALS["__65da1b1ec2d" . "6653e8a0ab784" . "8e536215"]["_9e0a944" . "6602a728" . "eddf64b2" . "3af901ea" . "0"]] ?? null;
        $context = $config->getContext();
        $session = $config->getSession();
        if (!$_a92c6398f0b00deb3ab06f71879f7545 || !$_9e0a9446602a728eddf64b23af901ea0 || !$context) {
            return [];
        }
        $_8db463fd8f9544f55010b1bff82e94e0 = new Date($_a92c6398f0b00deb3ab06f71879f7545, new \DateTimeZone($GLOBALS["__65da1b1ec2d" . "6653e8a0ab784" . "8e536215"]["_aaabebe7ea4dcd24a8e6b36cfe5114" . "22"]));
        $_ae6873e9422266b5de41a2f3ce905828 = new Date($_9e0a9446602a728eddf64b23af901ea0, new \DateTimeZone($GLOBALS["__65da1b1ec2d6653e8a0ab7" . "848e536215"]["_aaabebe7ea4dcd24a8e6b36c" . "fe511422"]));
        $_ccd9e402149a4aff4a20de187781aa41 = new Date($_8db463fd8f9544f55010b1bff82e94e0->format($GLOBALS["__65da1b1ec2d6653e8a0ab78" . "48e536215"]["_688e8aa058" . "a03eb9e9769" . "da719316557"]));
        $_ef3a72fcbe857b2afe45cb9d8cafb253 = new Date($_ae6873e9422266b5de41a2f3ce905828->format($GLOBALS["__65da1b1ec2d6653e8a" . "0ab7848e536215"]["_688e8aa058a03eb9e97" . "69da719316557"]));
        
        
        $_00ab16f2e73c61c756f79df3d6248d77 = Services::I()->{$GLOBALS["__65da1b1ec2d6653e8a0ab7848e" . "536215"]["_da0554e7f66942dcfb" . "6ce9b56131f140"]};
        $_6a1345c96c7a9979e3216247935fd6b5 = $_00ab16f2e73c61c756f79df3d6248d77->GetEventsInSessionCalendars($_ccd9e402149a4aff4a20de187781aa41, $_ef3a72fcbe857b2afe45cb9d8cafb253, $session);
        $_cf2fc9dc06b97e9dba337d5a2c54fe58 = $_00ab16f2e73c61c756f79df3d6248d77->GetCalendars();
        $_e258c5dc522b65a0645711c5089a8e9c = $this->eventFormatter->FormatEvents($_6a1345c96c7a9979e3216247935fd6b5, $_cf2fc9dc06b97e9dba337d5a2c54fe58, $config->getContext()->GetUserId());
        return [$GLOBALS["__65da1b1ec2d6653e8a0ab7848" . "e536215"]["_e258c5dc522b65a" . "0645711c5089a8e9" . "c"] => $_e258c5dc522b65a0645711c5089a8e9c];
    }
    public function getSchema() : AiToolSchemaBuilder
    {
        return AiToolSchemaBuilder::create()->add($GLOBALS["__65da1b1ec" . "2d6653e8a0a" . "b7848e53621" . "5"]["_a92c6398f0b00deb3a" . "b06f71879f7545"], AiParameterType::INTEGER, function (AiParameterDefinition $_c0c7604e8f38a81e52a6dff0e7e70d31) {
            $_c0c7604e8f38a81e52a6dff0e7e70d31->description($GLOBALS["__65da1b1ec" . "2d6653e8a0a" . "b7848e53621" . "5"]["_8baf6ac4dc0b89cfa6a5" . "abea49db1f56"]);
            $_c0c7604e8f38a81e52a6dff0e7e70d31->required();
        })->add($GLOBALS["__65da1b1ec2d6653e8a0ab" . "7848e536215"]["_9e0a9446602" . "a728eddf64b2" . "3af901ea0"], AiParameterType::INTEGER, function (AiParameterDefinition $_c0c7604e8f38a81e52a6dff0e7e70d31) {
            $_c0c7604e8f38a81e52a6dff0e7e70d31->description($GLOBALS["__65da1b1ec2d6653e8a0ab7848e5362" . "15"]["_294579c234bf4" . "0023d4525f0f32" . "b7cca"]);
            $_c0c7604e8f38a81e52a6dff0e7e70d31->required();
        });
    }
}