<?php
/**
 * This code was generated by
 * ___ _ _ _ _ _    _ ____    ____ ____ _    ____ ____ _  _ ____ ____ ____ ___ __   __
 *  |  | | | | |    | |  | __ |  | |__| | __ | __ |___ |\ | |___ |__/ |__|  | |  | |__/
 *  |  |_|_| | |___ | |__|    |__| |  | |    |__] |___ | \| |___ |  \ |  |  | |__| |  \
 *
 * Twilio API definition for public-api voice
 * Powers Twilio public-api voice
 *
 * NOTE: This class is auto generated by OpenAPI Generator.
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */

namespace Twilio\Rest\Voice\V3;

use Twilio\Values;
abstract class TranscriptionModels
{
    /**
     * @property string $type The role of this participant in the conversation.
     * @property string $address The phone number or identifier for this participant (E.164 format for phone numbers). Used to correlate this participant with their profile and conversation history.
     * @property string $name User-defined name for this participant
     * @property int $audioChannelIndex One-based index of the audio channel in a multi-channel recording
    */
    public static function createVoiceV3TranscriptionParticipant(array $payload = []): VoiceV3TranscriptionParticipant
    {
        return new VoiceV3TranscriptionParticipant($payload);
    }

    /**
     * @property string $transcriptionConfigurationId The ID of the transcription configuration to use
     * @property string $inputSource Discriminator indicating the input source type
     * @property string $sourceId The SID or TTID of the source audio to transcribe (e.g. a Twilio Recording SID). When provided, audioStartedAt is inferred from the recording's start time and does not need to be supplied by the caller.
     * @property VoiceV3TranscriptionParticipant[] $participants Participants in the conversation. If omitted or partially specified, defaults from the transcription configuration will be applied.
     * @property string $mediaUrl URL to the media file to transcribe
     * @property \DateTime $audioStartedAt The start time of the audio recording
    */
    public static function createCreateV3TranscriptionsRequest(array $payload = []): CreateV3TranscriptionsRequest
    {
        return new CreateV3TranscriptionsRequest($payload);
    }

    /**
     * @property string $url The URL to call when transcription status changes
     * @property string $method The HTTP method to use for the callback, currently only POST is supported
     * @property string[] $events The transcription events that will trigger the callback
    */
    public static function createVoiceV3TranscriptionTranscriptionStatusCallback(array $payload = []): VoiceV3TranscriptionTranscriptionStatusCallback
    {
        return new VoiceV3TranscriptionTranscriptionStatusCallback($payload);
    }

    /**
     * @property string $transcriptionEngine The engine used for transcription (Deepgram, Google, or auto)
     * @property string $speechModel The speech model used for transcription (e.g., nova-2, nova-3, chirp_2)
     * @property string $language The language code for transcription
     * @property VoiceV3TranscriptionTranscriptionStatusCallback $transcriptionStatusCallback
     * @property string $conversationConfigurationId Maestro conversation configuration ID
     * @property VoiceV3TranscriptionResolvedConfigurationParticipantDefaults[] $participantDefaults Default participant configurations for the transcription
    */
    public static function createVoiceV3TranscriptionResolvedConfiguration(array $payload = []): VoiceV3TranscriptionResolvedConfiguration
    {
        return new VoiceV3TranscriptionResolvedConfiguration($payload);
    }

    /**
     * @property string $id Unique identifier for a Transcription. This is also the transcriptionId returned in the LRO 202 response.
     * @property string $accountId Twilio Account SID
     * @property string $status The current status of the transcription operation
     * @property string $transcriptionConfigurationId Unique identifier for a Transcription configuration.
     * @property string $mediaUrl The third party media URL
     * @property string $sourceId The source ID (recording ID) - used for tracking only
     * @property DateTime $audioStartedAt The call/recording start time. When the transcription was created using a sourceId, this value is inferred from the recording resource's start time. When created using a mediaUrl, this reflects the value supplied by the caller.
     * @property string $conversationId Maestro conversation ID, populated once the transcription has been stored in Maestro.
     * @property VoiceV3TranscriptionParticipant[] $participants Array of participants in the conversation
     * @property int $duration Audio duration in seconds
     * @property VoiceV3TranscriptionResolvedConfiguration $resolvedConfiguration
     * @property DateTime $createdAt When this transcript was created
     * @property DateTime $updatedAt When this transcript was last updated
     * @property string $url The URL of this resource
    */
    public static function createVoiceV3TranscriptionTranscription(array $payload = []): VoiceV3TranscriptionTranscription
    {
        return new VoiceV3TranscriptionTranscription($payload);
    }

}

class VoiceV3TranscriptionParticipant implements \JsonSerializable
{
    /**
     * @property string $type The role of this participant in the conversation.
     * @property string $address The phone number or identifier for this participant (E.164 format for phone numbers). Used to correlate this participant with their profile and conversation history.
     * @property string $name User-defined name for this participant
     * @property int $audioChannelIndex One-based index of the audio channel in a multi-channel recording
    */
        protected $type;
        protected $address;
        protected $name;
        protected $audioChannelIndex;
    public function __construct(array $payload = []) {
        $this->type = Values::array_get($payload, 'type');
        $this->address = Values::array_get($payload, 'address');
        $this->name = Values::array_get($payload, 'name');
        $this->audioChannelIndex = Values::array_get($payload, 'audioChannelIndex');
    }

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

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

class CreateV3TranscriptionsRequest implements \JsonSerializable
{
    /**
     * @property string $transcriptionConfigurationId The ID of the transcription configuration to use
     * @property string $inputSource Discriminator indicating the input source type
     * @property string $sourceId The SID or TTID of the source audio to transcribe (e.g. a Twilio Recording SID). When provided, audioStartedAt is inferred from the recording's start time and does not need to be supplied by the caller.
     * @property VoiceV3TranscriptionParticipant[] $participants Participants in the conversation. If omitted or partially specified, defaults from the transcription configuration will be applied.
     * @property string $mediaUrl URL to the media file to transcribe
     * @property \DateTime $audioStartedAt The start time of the audio recording
    */
        protected $transcriptionConfigurationId;
        protected $inputSource;
        protected $sourceId;
        protected $participants;
        protected $mediaUrl;
        protected $audioStartedAt;
    public function __construct(array $payload = []) {
        $this->transcriptionConfigurationId = Values::array_get($payload, 'transcriptionConfigurationId');
        $this->inputSource = Values::array_get($payload, 'inputSource');
        $this->sourceId = Values::array_get($payload, 'sourceId');
        $this->participants = Values::array_get($payload, 'participants');
        $this->mediaUrl = Values::array_get($payload, 'mediaUrl');
        $this->audioStartedAt = Values::array_get($payload, 'audioStartedAt');
    }

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

    public function jsonSerialize(): array
    {
        $jsonString = [
            'transcriptionConfigurationId' => $this->transcriptionConfigurationId,
            'sourceId' => $this->sourceId,
            'mediaUrl' => $this->mediaUrl
        ];
        if (isset($this->inputSource)) {
            $jsonString['inputSource'] = $this->inputSource;
        }
        if (isset($this->participants)) {
            $jsonString['participants'] = $this->participants;
        }
        if (isset($this->audioStartedAt)) {
            $jsonString['audioStartedAt'] = $this->audioStartedAt;
        }
        return $jsonString;
    }
}

class VoiceV3TranscriptionTranscriptionStatusCallback implements \JsonSerializable
{
    /**
     * @property string $url The URL to call when transcription status changes
     * @property string $method The HTTP method to use for the callback, currently only POST is supported
     * @property string[] $events The transcription events that will trigger the callback
    */
        protected $url;
        protected $method;
        protected $events;
    public function __construct(array $payload = []) {
        $this->url = Values::array_get($payload, 'url');
        $this->method = Values::array_get($payload, 'method');
        $this->events = Values::array_get($payload, 'events');
    }

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

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

class VoiceV3TranscriptionResolvedConfiguration implements \JsonSerializable
{
    /**
     * @property string $transcriptionEngine The engine used for transcription (Deepgram, Google, or auto)
     * @property string $speechModel The speech model used for transcription (e.g., nova-2, nova-3, chirp_2)
     * @property string $language The language code for transcription
     * @property VoiceV3TranscriptionTranscriptionStatusCallback $transcriptionStatusCallback
     * @property string $conversationConfigurationId Maestro conversation configuration ID
     * @property VoiceV3TranscriptionResolvedConfigurationParticipantDefaults[] $participantDefaults Default participant configurations for the transcription
    */
        protected $transcriptionEngine;
        protected $speechModel;
        protected $language;
        protected $transcriptionStatusCallback;
        protected $conversationConfigurationId;
        protected $participantDefaults;
    public function __construct(array $payload = []) {
        $this->transcriptionEngine = Values::array_get($payload, 'transcriptionEngine');
        $this->speechModel = Values::array_get($payload, 'speechModel');
        $this->language = Values::array_get($payload, 'language');
        $this->transcriptionStatusCallback = Values::array_get($payload, 'transcriptionStatusCallback');
        $this->conversationConfigurationId = Values::array_get($payload, 'conversationConfigurationId');
        $this->participantDefaults = Values::array_get($payload, 'participantDefaults');
    }

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

    public function jsonSerialize(): array
    {
        $jsonString = [
        ];
        if (isset($this->transcriptionEngine)) {
            $jsonString['transcriptionEngine'] = $this->transcriptionEngine;
        }
        if (isset($this->speechModel)) {
            $jsonString['speechModel'] = $this->speechModel;
        }
        if (isset($this->language)) {
            $jsonString['language'] = $this->language;
        }
        if (isset($this->transcriptionStatusCallback)) {
            $jsonString['transcriptionStatusCallback'] = $this->transcriptionStatusCallback;
        }
        if (isset($this->conversationConfigurationId)) {
            $jsonString['conversationConfigurationId'] = $this->conversationConfigurationId;
        }
        if (isset($this->participantDefaults)) {
            $jsonString['participantDefaults'] = $this->participantDefaults;
        }
        return $jsonString;
    }
}

class VoiceV3TranscriptionTranscription implements \JsonSerializable
{
    /**
     * @property string $id Unique identifier for a Transcription. This is also the transcriptionId returned in the LRO 202 response.
     * @property string $accountId Twilio Account SID
     * @property string $status The current status of the transcription operation
     * @property string $transcriptionConfigurationId Unique identifier for a Transcription configuration.
     * @property string $mediaUrl The third party media URL
     * @property string $sourceId The source ID (recording ID) - used for tracking only
     * @property DateTime $audioStartedAt The call/recording start time. When the transcription was created using a sourceId, this value is inferred from the recording resource's start time. When created using a mediaUrl, this reflects the value supplied by the caller.
     * @property string $conversationId Maestro conversation ID, populated once the transcription has been stored in Maestro.
     * @property VoiceV3TranscriptionParticipant[] $participants Array of participants in the conversation
     * @property int $duration Audio duration in seconds
     * @property VoiceV3TranscriptionResolvedConfiguration $resolvedConfiguration
     * @property DateTime $createdAt When this transcript was created
     * @property DateTime $updatedAt When this transcript was last updated
     * @property string $url The URL of this resource
    */
        protected $id;
        protected $accountId;
        protected $status;
        protected $transcriptionConfigurationId;
        protected $mediaUrl;
        protected $sourceId;
        protected $audioStartedAt;
        protected $conversationId;
        protected $participants;
        protected $duration;
        protected $resolvedConfiguration;
        protected $createdAt;
        protected $updatedAt;
        protected $url;
    public function __construct(array $payload = []) {
        $this->id = Values::array_get($payload, 'id');
        $this->accountId = Values::array_get($payload, 'accountId');
        $this->status = Values::array_get($payload, 'status');
        $this->transcriptionConfigurationId = Values::array_get($payload, 'transcriptionConfigurationId');
        $this->mediaUrl = Values::array_get($payload, 'mediaUrl');
        $this->sourceId = Values::array_get($payload, 'sourceId');
        $this->audioStartedAt = Values::array_get($payload, 'audioStartedAt');
        $this->conversationId = Values::array_get($payload, 'conversationId');
        $this->participants = Values::array_get($payload, 'participants');
        $this->duration = Values::array_get($payload, 'duration');
        $this->resolvedConfiguration = Values::array_get($payload, 'resolvedConfiguration');
        $this->createdAt = Values::array_get($payload, 'createdAt');
        $this->updatedAt = Values::array_get($payload, 'updatedAt');
        $this->url = Values::array_get($payload, 'url');
    }

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

    public function jsonSerialize(): array
    {
        $jsonString = [
            'id' => $this->id,
            'accountId' => $this->accountId,
            'status' => $this->status,
            'transcriptionConfigurationId' => $this->transcriptionConfigurationId,
            'createdAt' => $this->createdAt,
            'updatedAt' => $this->updatedAt,
            'url' => $this->url
        ];
        if (isset($this->mediaUrl)) {
            $jsonString['mediaUrl'] = $this->mediaUrl;
        }
        if (isset($this->sourceId)) {
            $jsonString['sourceId'] = $this->sourceId;
        }
        if (isset($this->audioStartedAt)) {
            $jsonString['audioStartedAt'] = $this->audioStartedAt;
        }
        if (isset($this->conversationId)) {
            $jsonString['conversationId'] = $this->conversationId;
        }
        if (isset($this->participants)) {
            $jsonString['participants'] = $this->participants;
        }
        if (isset($this->duration)) {
            $jsonString['duration'] = $this->duration;
        }
        if (isset($this->resolvedConfiguration)) {
            $jsonString['resolvedConfiguration'] = $this->resolvedConfiguration;
        }
        return $jsonString;
    }
}

