<?php
/**
 * This code was generated by
 * ___ _ _ _ _ _    _ ____    ____ ____ _    ____ ____ _  _ ____ ____ ____ ___ __   __
 *  |  | | | | |    | |  | __ |  | |__| | __ | __ |___ |\ | |___ |__/ |__|  | |  | |__/
 *  |  |_|_| | |___ | |__|    |__| |  | |    |__] |___ | \| |___ |  \ |  |  | |__| |  \
 *
 * Twilio Conversational Intelligence API
 * The Conversational Intelligence API includes resources to create and manage intelligence configurations, define and run language operators, and retrieve processed conversations and operator results.  * Use the Configurations resource to create and manage intelligence configurations and define rules that control how and when language operators analyze and transform conversations.  * Use the Operators resource to create custom language operators or retrieve Twilio-author and custom operators. * Use the Conversations resource to retrieve conversations processed with an intelligence configuration, and the OperatorResults resource to retrieve language operator results for those conversations.
 *
 * NOTE: This class is auto generated by OpenAPI Generator.
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */

namespace Twilio\Rest\Intelligence\V3;

use Twilio\Values;
abstract class OperatorModels
{
    /**
     * @property string $input A sample input text that demonstrates the type of content the Operator processes.
     * @property string $output The expected output corresponding to the provided input example. This value must be consistent with the defined `output_format` and `output_schema` of the Operator.
    */
    public static function createOperatorTrainingExample(array $payload = []): OperatorTrainingExample
    {
        return new OperatorTrainingExample($payload);
    }

    /**
     * @property bool $enabled Set to true to allow access to Memory at runtime.
    */
    public static function createOperatorContextMemory(array $payload = []): OperatorContextMemory
    {
        return new OperatorContextMemory($payload);
    }

    /**
     * @property bool $enabled Set to true to allow access to Knowledge Sources at runtime.
    */
    public static function createOperatorContextKnowledge(array $payload = []): OperatorContextKnowledge
    {
        return new OperatorContextKnowledge($payload);
    }

    /**
     * @property OperatorContextMemory $memory
     * @property OperatorContextKnowledge $knowledge
    */
    public static function createOperatorContextModel(array $payload = []): OperatorContextModel
    {
        return new OperatorContextModel($payload);
    }

    /**
     * @property string $id The unique identifier for the Language Operator. Assigned by Twilio (TTID).
     * @property string $displayName Display name of the Language Operator describing its purpose.
     * @property string $description Description of the Language Operator further explaining its purpose.
     * @property int $version Numeric Operator version. Automatically incremented with each update on the resource, used to ensure integrity when updating the Operator.
     * @property string $author
     * @property string $prompt The natural language instructions used by the operator to analyze the conversation.  Within the prompt, users can reference parameters using the `{{parameters.[param_name]}}` syntax. Parameter values are provided to the Operator by the Intelligence Configuration Rule at runtime.  **Note**: Prompts will only be exposed for Custom Operators (`author` = `SELF`). Twilio-authored Operators (`author` = `TWILIO`) will have their prompts omitted from the API.
     * @property string $outputFormat
     * @property array $outputSchema Required for `JSON` output only. this will be set to a JSON Schema object describing the properties & data types of the response. Please see https://platform.openai.com/docs/guides/structured-outputs#supported-schemas   Will include the following keywords: - `type` : Must be set to `object` - `properties`:  An object containing the property names and their data types you would like the LLM to return  Additional details on JSON output formatting: - The root level `type` of a JSON schema must be set to `object` - The following property data types are supported : `string`, `number`, `boolean`, `integer`, `object`, `array`, `anyOf` - Definitions with `$defs` / `$ref` are supported - Max 100 object properties and 10 levels of nesting are supported - Max 1000 enum values across all enum properties are supported - Notable JSON Schema keywords not supported include:   - For `strings`: `minLength`, `maxLength`   - For `objects`: `patternProperties`, `unevaluatedProperties`, `propertyNames`, `minProperties`, `maxProperties`   - For `arrays`: `unevaluatedItems`, `contains`, `minContains`, `maxContains`, `uniqueItems` - Structured Operator Results will be returned in the same order as the ordering of keys in the schema - In the event an Operator execution request is refused for safety reasons the Operator Result API response will include a new field called `refusal` to indicate that the LLM refused to fulfill the request - Twilio will automatically set `additionalProperties` to false and specify all provided fields as required (constraints of Structured Outputs). You don't need to pass these fields as part of your JSON schema. Twilio will automatically overwrite any user-provided values for these fields.
     * @property string[] $trainingExamples An array of example input/output pairs used to illustrate the intended behavior of the Language Operator. These examples help guide the model's understanding of expected input–output relationships and improve consistency during evaluation and testing.  **Note**: Training examples will only be exposed for Custom Operators (`author` = `SELF`). Twilio-authored Operators (`author` = `TWILIO`) will have their training examples omitted from the API.
     * @property string $context
     * @property string $parameters Defines the schema of the parameters that are provided when running the operator, including required and optional values that determine the operator's behavior. The values of the parameters themselves are passed in by the attached Intelligence Configuration.
    */
    public static function createLanguageOperator(array $payload = []): LanguageOperator
    {
        return new LanguageOperator($payload);
    }

}

class OperatorTrainingExample implements \JsonSerializable
{
    /**
     * @property string $input A sample input text that demonstrates the type of content the Operator processes.
     * @property string $output The expected output corresponding to the provided input example. This value must be consistent with the defined `output_format` and `output_schema` of the Operator.
    */
        protected $input;
        protected $output;
    public function __construct(array $payload = []) {
        $this->input = Values::array_get($payload, 'input');
        $this->output = Values::array_get($payload, 'output');
    }

    public function toArray(): array
    {
        return $this->jsonSerialize();
    }

    public function jsonSerialize(): array
    {
        $jsonString = [
            'input' => $this->input,
            'output' => $this->output
        ];
        return $jsonString;
    }
}

class OperatorContextMemory implements \JsonSerializable
{
    /**
     * @property bool $enabled Set to true to allow access to Memory at runtime.
    */
        protected $enabled;
    public function __construct(array $payload = []) {
        $this->enabled = Values::array_get($payload, 'enabled');
    }

    public function toArray(): array
    {
        return $this->jsonSerialize();
    }

    public function jsonSerialize(): array
    {
        $jsonString = [
        ];
        if (isset($this->enabled)) {
            $jsonString['enabled'] = $this->enabled;
        }
        return $jsonString;
    }
}

class OperatorContextKnowledge implements \JsonSerializable
{
    /**
     * @property bool $enabled Set to true to allow access to Knowledge Sources at runtime.
    */
        protected $enabled;
    public function __construct(array $payload = []) {
        $this->enabled = Values::array_get($payload, 'enabled');
    }

    public function toArray(): array
    {
        return $this->jsonSerialize();
    }

    public function jsonSerialize(): array
    {
        $jsonString = [
        ];
        if (isset($this->enabled)) {
            $jsonString['enabled'] = $this->enabled;
        }
        return $jsonString;
    }
}

class OperatorContextModel implements \JsonSerializable
{
    /**
     * @property OperatorContextMemory $memory
     * @property OperatorContextKnowledge $knowledge
    */
        protected $memory;
        protected $knowledge;
    public function __construct(array $payload = []) {
        $this->memory = Values::array_get($payload, 'memory');
        $this->knowledge = Values::array_get($payload, 'knowledge');
    }

    public function toArray(): array
    {
        return $this->jsonSerialize();
    }

    public function jsonSerialize(): array
    {
        $jsonString = [
        ];
        if (isset($this->memory)) {
            $jsonString['memory'] = $this->memory;
        }
        if (isset($this->knowledge)) {
            $jsonString['knowledge'] = $this->knowledge;
        }
        return $jsonString;
    }
}

class LanguageOperator implements \JsonSerializable
{
    /**
     * @property string $id The unique identifier for the Language Operator. Assigned by Twilio (TTID).
     * @property string $displayName Display name of the Language Operator describing its purpose.
     * @property string $description Description of the Language Operator further explaining its purpose.
     * @property int $version Numeric Operator version. Automatically incremented with each update on the resource, used to ensure integrity when updating the Operator.
     * @property string $author
     * @property string $prompt The natural language instructions used by the operator to analyze the conversation.  Within the prompt, users can reference parameters using the `{{parameters.[param_name]}}` syntax. Parameter values are provided to the Operator by the Intelligence Configuration Rule at runtime.  **Note**: Prompts will only be exposed for Custom Operators (`author` = `SELF`). Twilio-authored Operators (`author` = `TWILIO`) will have their prompts omitted from the API.
     * @property string $outputFormat
     * @property array $outputSchema Required for `JSON` output only. this will be set to a JSON Schema object describing the properties & data types of the response. Please see https://platform.openai.com/docs/guides/structured-outputs#supported-schemas   Will include the following keywords: - `type` : Must be set to `object` - `properties`:  An object containing the property names and their data types you would like the LLM to return  Additional details on JSON output formatting: - The root level `type` of a JSON schema must be set to `object` - The following property data types are supported : `string`, `number`, `boolean`, `integer`, `object`, `array`, `anyOf` - Definitions with `$defs` / `$ref` are supported - Max 100 object properties and 10 levels of nesting are supported - Max 1000 enum values across all enum properties are supported - Notable JSON Schema keywords not supported include:   - For `strings`: `minLength`, `maxLength`   - For `objects`: `patternProperties`, `unevaluatedProperties`, `propertyNames`, `minProperties`, `maxProperties`   - For `arrays`: `unevaluatedItems`, `contains`, `minContains`, `maxContains`, `uniqueItems` - Structured Operator Results will be returned in the same order as the ordering of keys in the schema - In the event an Operator execution request is refused for safety reasons the Operator Result API response will include a new field called `refusal` to indicate that the LLM refused to fulfill the request - Twilio will automatically set `additionalProperties` to false and specify all provided fields as required (constraints of Structured Outputs). You don't need to pass these fields as part of your JSON schema. Twilio will automatically overwrite any user-provided values for these fields.
     * @property string[] $trainingExamples An array of example input/output pairs used to illustrate the intended behavior of the Language Operator. These examples help guide the model's understanding of expected input–output relationships and improve consistency during evaluation and testing.  **Note**: Training examples will only be exposed for Custom Operators (`author` = `SELF`). Twilio-authored Operators (`author` = `TWILIO`) will have their training examples omitted from the API.
     * @property string $context
     * @property string $parameters Defines the schema of the parameters that are provided when running the operator, including required and optional values that determine the operator's behavior. The values of the parameters themselves are passed in by the attached Intelligence Configuration.
    */
        protected $id;
        protected $displayName;
        protected $description;
        protected $version;
        protected $author;
        protected $prompt;
        protected $outputFormat;
        protected $outputSchema;
        protected $trainingExamples;
        protected $context;
        protected $parameters;
    public function __construct(array $payload = []) {
        $this->id = Values::array_get($payload, 'id');
        $this->displayName = Values::array_get($payload, 'displayName');
        $this->description = Values::array_get($payload, 'description');
        $this->version = Values::array_get($payload, 'version');
        $this->author = Values::array_get($payload, 'author');
        $this->prompt = Values::array_get($payload, 'prompt');
        $this->outputFormat = Values::array_get($payload, 'outputFormat');
        $this->outputSchema = Values::array_get($payload, 'outputSchema');
        $this->trainingExamples = Values::array_get($payload, 'trainingExamples');
        $this->context = Values::array_get($payload, 'context');
        $this->parameters = Values::array_get($payload, 'parameters');
    }

    public function toArray(): array
    {
        return $this->jsonSerialize();
    }

    public function jsonSerialize(): array
    {
        $jsonString = [
        ];
        if (isset($this->id)) {
            $jsonString['id'] = $this->id;
        }
        if (isset($this->displayName)) {
            $jsonString['displayName'] = $this->displayName;
        }
        if (isset($this->description)) {
            $jsonString['description'] = $this->description;
        }
        if (isset($this->version)) {
            $jsonString['version'] = $this->version;
        }
        if (isset($this->author)) {
            $jsonString['author'] = $this->author;
        }
        if (isset($this->prompt)) {
            $jsonString['prompt'] = $this->prompt;
        }
        if (isset($this->outputFormat)) {
            $jsonString['outputFormat'] = $this->outputFormat;
        }
        if (isset($this->outputSchema)) {
            $jsonString['outputSchema'] = $this->outputSchema;
        }
        if (isset($this->trainingExamples)) {
            $jsonString['trainingExamples'] = $this->trainingExamples;
        }
        if (isset($this->context)) {
            $jsonString['context'] = $this->context;
        }
        if (isset($this->parameters)) {
            $jsonString['parameters'] = $this->parameters;
        }
        return $jsonString;
    }
}

