<?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 OperatorResultModels
{
    /**
     * @property string $id Unique identifier for a Intelligence Configuration that generated the Operator Result. Assigned by Twilio (TTID).
     * @property string $ruleId Unique identifier of the rule of the Intelligence Configuration that triggered the result. Assigned by Twilio (TTID).
     * @property int $version Version of the Intelligence Configuration used to generate the Operator Result.
    */
    public static function createIntelligenceConfigurationReference(array $payload = []): IntelligenceConfigurationReference
    {
        return new IntelligenceConfigurationReference($payload);
    }

    /**
     * @property string $id The `id` of the Language Operator.
     * @property int $version Version of the Language Operator used to generate the Operator Result.
     * @property array<string,mixed> $parameters Parameter values used for Operator execution, provided by the Rule at runtime. This object contains a dictionary of parameter keys and their corresponding values.
    */
    public static function createOperatorReference(array $payload = []): OperatorReference
    {
        return new OperatorReference($payload);
    }

    /**
     * @property string $on The conversational lifecycle event that activated execution of the Rule. Available values are: - `COMMUNICATION`: Trigger the Rule on each communication within the Conversation. - `CONVERSATION_END`: Trigger the Rule when the Conversation moves to the `closed` state. - `CONVERSATION_INACTIVE`: Trigger the Rule when the Conversation moves to the `inactive` state.
     * @property DateTime $timestamp Timestamp of when the trigger was activated.
    */
    public static function createExecutionDetailsTrigger(array $payload = []): ExecutionDetailsTrigger
    {
        return new ExecutionDetailsTrigger($payload);
    }

    /**
     * @property string $first Communication `id` from the attached Conversation.
     * @property string $last Communication `id` from the attached Conversation.
    */
    public static function createExecutionDetailsCommunications(array $payload = []): ExecutionDetailsCommunications
    {
        return new ExecutionDetailsCommunications($payload);
    }

    /**
     * @property string $profileId Customer Memory Profile identifier
     * @property string $memoryStoreId Customer Memory store identifier
    */
    public static function createResolvedContextMemory(array $payload = []): ResolvedContextMemory
    {
        return new ResolvedContextMemory($payload);
    }

    /**
     * @property ResolvedContextKnowledgeSources[] $sources
    */
    public static function createResolvedContextKnowledge(array $payload = []): ResolvedContextKnowledge
    {
        return new ResolvedContextKnowledge($payload);
    }

    /**
     * @property ResolvedContextMemory $memory
     * @property ResolvedContextKnowledge $knowledge
    */
    public static function createResolvedContext(array $payload = []): ResolvedContext
    {
        return new ResolvedContext($payload);
    }

    /**
     * @property ExecutionDetailsTrigger $trigger
     * @property ExecutionDetailsCommunications $communications
     * @property string[] $channels Communication channels included in the Conversation when this Operator was executed.
     * @property ExecutionDetailsParticipants[] $participants Metadata for the participants included in the Conversation when this Operator executed.
     * @property ResolvedContext $resolvedContext
    */
    public static function createExecutionDetails(array $payload = []): ExecutionDetails
    {
        return new ExecutionDetails($payload);
    }

    /**
     * @property string $resolvedModel The underlying LLM model used for this execution.
     * @property int $latencyMs Operator execution time in milliseconds.
     * @property int $inputCharacters Number of characters in the input sent to the model. Aligns with the billing unit.
     * @property int $outputCharacters Number of characters in the model's response. Aligns with the billing unit.
     * @property bool $inputTruncated Whether the conversation input was truncated to fit the model's context window.
    */
    public static function createSystemMetaData(array $payload = []): SystemMetaData
    {
        return new SystemMetaData($payload);
    }

    /**
     * @property SystemMetaData $system
    */
    public static function createOperatorResultsResponseBaseMetadata(array $payload = []): OperatorResultsResponseBaseMetadata
    {
        return new OperatorResultsResponseBaseMetadata($payload);
    }

    /**
     * @property ExtractionResultResultEntities[] $entities List of extracted entities from the Conversation.
    */
    public static function createExtractionResultResult(array $payload = []): ExtractionResultResult
    {
        return new ExtractionResultResult($payload);
    }

}

class IntelligenceConfigurationReference implements \JsonSerializable
{
    /**
     * @property string $id Unique identifier for a Intelligence Configuration that generated the Operator Result. Assigned by Twilio (TTID).
     * @property string $ruleId Unique identifier of the rule of the Intelligence Configuration that triggered the result. Assigned by Twilio (TTID).
     * @property int $version Version of the Intelligence Configuration used to generate the Operator Result.
    */
        protected $id;
        protected $ruleId;
        protected $version;
    public function __construct(array $payload = []) {
        $this->id = Values::array_get($payload, 'id');
        $this->ruleId = Values::array_get($payload, 'ruleId');
        $this->version = Values::array_get($payload, 'version');
    }

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

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

class OperatorReference implements \JsonSerializable
{
    /**
     * @property string $id The `id` of the Language Operator.
     * @property int $version Version of the Language Operator used to generate the Operator Result.
     * @property array<string,mixed> $parameters Parameter values used for Operator execution, provided by the Rule at runtime. This object contains a dictionary of parameter keys and their corresponding values.
    */
        protected $id;
        protected $version;
        protected $parameters;
    public function __construct(array $payload = []) {
        $this->id = Values::array_get($payload, 'id');
        $this->version = Values::array_get($payload, 'version');
        $this->parameters = Values::array_get($payload, 'parameters');
    }

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

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

class ExecutionDetailsTrigger implements \JsonSerializable
{
    /**
     * @property string $on The conversational lifecycle event that activated execution of the Rule. Available values are: - `COMMUNICATION`: Trigger the Rule on each communication within the Conversation. - `CONVERSATION_END`: Trigger the Rule when the Conversation moves to the `closed` state. - `CONVERSATION_INACTIVE`: Trigger the Rule when the Conversation moves to the `inactive` state.
     * @property DateTime $timestamp Timestamp of when the trigger was activated.
    */
        protected $on;
        protected $timestamp;
    public function __construct(array $payload = []) {
        $this->on = Values::array_get($payload, 'on');
        $this->timestamp = Values::array_get($payload, 'timestamp');
    }

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

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

class ExecutionDetailsCommunications implements \JsonSerializable
{
    /**
     * @property string $first Communication `id` from the attached Conversation.
     * @property string $last Communication `id` from the attached Conversation.
    */
        protected $first;
        protected $last;
    public function __construct(array $payload = []) {
        $this->first = Values::array_get($payload, 'first');
        $this->last = Values::array_get($payload, 'last');
    }

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

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

class ResolvedContextMemory implements \JsonSerializable
{
    /**
     * @property string $profileId Customer Memory Profile identifier
     * @property string $memoryStoreId Customer Memory store identifier
    */
        protected $profileId;
        protected $memoryStoreId;
    public function __construct(array $payload = []) {
        $this->profileId = Values::array_get($payload, 'profileId');
        $this->memoryStoreId = Values::array_get($payload, 'memoryStoreId');
    }

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

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

class ResolvedContextKnowledge implements \JsonSerializable
{
    /**
     * @property ResolvedContextKnowledgeSources[] $sources
    */
        protected $sources;
    public function __construct(array $payload = []) {
        $this->sources = Values::array_get($payload, 'sources');
    }

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

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

class ResolvedContext implements \JsonSerializable
{
    /**
     * @property ResolvedContextMemory $memory
     * @property ResolvedContextKnowledge $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 ExecutionDetails implements \JsonSerializable
{
    /**
     * @property ExecutionDetailsTrigger $trigger
     * @property ExecutionDetailsCommunications $communications
     * @property string[] $channels Communication channels included in the Conversation when this Operator was executed.
     * @property ExecutionDetailsParticipants[] $participants Metadata for the participants included in the Conversation when this Operator executed.
     * @property ResolvedContext $resolvedContext
    */
        protected $trigger;
        protected $communications;
        protected $channels;
        protected $participants;
        protected $resolvedContext;
    public function __construct(array $payload = []) {
        $this->trigger = Values::array_get($payload, 'trigger');
        $this->communications = Values::array_get($payload, 'communications');
        $this->channels = Values::array_get($payload, 'channels');
        $this->participants = Values::array_get($payload, 'participants');
        $this->resolvedContext = Values::array_get($payload, 'resolvedContext');
    }

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

    public function jsonSerialize(): array
    {
        $jsonString = [
            'trigger' => $this->trigger,
            'communications' => $this->communications,
            'channels' => $this->channels,
            'participants' => $this->participants
        ];
        if (isset($this->resolvedContext)) {
            $jsonString['resolvedContext'] = $this->resolvedContext;
        }
        return $jsonString;
    }
}

class SystemMetaData implements \JsonSerializable
{
    /**
     * @property string $resolvedModel The underlying LLM model used for this execution.
     * @property int $latencyMs Operator execution time in milliseconds.
     * @property int $inputCharacters Number of characters in the input sent to the model. Aligns with the billing unit.
     * @property int $outputCharacters Number of characters in the model's response. Aligns with the billing unit.
     * @property bool $inputTruncated Whether the conversation input was truncated to fit the model's context window.
    */
        protected $resolvedModel;
        protected $latencyMs;
        protected $inputCharacters;
        protected $outputCharacters;
        protected $inputTruncated;
    public function __construct(array $payload = []) {
        $this->resolvedModel = Values::array_get($payload, 'resolvedModel');
        $this->latencyMs = Values::array_get($payload, 'latencyMs');
        $this->inputCharacters = Values::array_get($payload, 'inputCharacters');
        $this->outputCharacters = Values::array_get($payload, 'outputCharacters');
        $this->inputTruncated = Values::array_get($payload, 'inputTruncated');
    }

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

    public function jsonSerialize(): array
    {
        $jsonString = [
            'latencyMs' => $this->latencyMs,
            'inputCharacters' => $this->inputCharacters,
            'outputCharacters' => $this->outputCharacters,
            'inputTruncated' => $this->inputTruncated
        ];
        if (isset($this->resolvedModel)) {
            $jsonString['resolvedModel'] = $this->resolvedModel;
        }
        return $jsonString;
    }
}

class OperatorResultsResponseBaseMetadata implements \JsonSerializable
{
    /**
     * @property SystemMetaData $system
    */
        protected $system;
    public function __construct(array $payload = []) {
        $this->system = Values::array_get($payload, 'system');
    }

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

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

class ExtractionResultResult implements \JsonSerializable
{
    /**
     * @property ExtractionResultResultEntities[] $entities List of extracted entities from the Conversation.
    */
        protected $entities;
    public function __construct(array $payload = []) {
        $this->entities = Values::array_get($payload, 'entities');
    }

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

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

