<?php
/**
 * This code was generated by
 * ___ _ _ _ _ _    _ ____    ____ ____ _    ____ ____ _  _ ____ ____ ____ ___ __   __
 *  |  | | | | |    | |  | __ |  | |__| | __ | __ |___ |\ | |___ |__/ |__|  | |  | |__/
 *  |  |_|_| | |___ | |__|    |__| |  | |    |__] |___ | \| |___ |  \ |  |  | |__| |  \
 *
 * Conversation Orchestrator
 * Manage configurations, conversations, participants, and communications. Create configurations to define capture rules and channel settings, then use conversations to group related communications.
 *
 * NOTE: This class is auto generated by OpenAPI Generator.
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */

namespace Twilio\Rest\Conversations\V2;

use Twilio\Values;
abstract class ActionModels
{
    /**
     * @property string $participantId Participant ID to resolve address from.
     * @property string $address Explicit address formatted according to channel type.
     * @property string $channel Channel type for address resolution.
    */
    public static function createConversationsV2SendMessageParticipant(array $payload = []): ConversationsV2SendMessageParticipant
    {
        return new ConversationsV2SendMessageParticipant($payload);
    }

    /**
     * @property string $text Plain text message body.
     * @property string $contentId Content template ID (HX... format). When provided, the template is rendered with the variables map and sent to the recipient.
     * @property array<string,string> $variables Variables to substitute into the content template.
     * @property string[] $mediaUrls URLs of media attachments to include with the message.
    */
    public static function createConversationsV2SendMessageContent(array $payload = []): ConversationsV2SendMessageContent
    {
        return new ConversationsV2SendMessageContent($payload);
    }

    /**
     * @property ConversationsV2SendMessageParticipant $from
     * @property ConversationsV2SendMessageParticipant[] $to The recipients of this action.
     * @property ConversationsV2SendMessageContent $content
     * @property array<string,mixed> $channelSettings Channel-specific parameters forwarded as-is to the downstream sending service. Allows passing backend-specific fields without requiring API changes.
    */
    public static function createConversationsV2SendMessagePayload(array $payload = []): ConversationsV2SendMessagePayload
    {
        return new ConversationsV2SendMessagePayload($payload);
    }

    /**
     * @property string $type Action type discriminator. Accepted values: SEND_MESSAGE.
     * @property ConversationsV2SendMessagePayload $payload
    */
    public static function createCreateConversationActionRequest(array $payload = []): CreateConversationActionRequest
    {
        return new CreateConversationActionRequest($payload);
    }

}

class ConversationsV2SendMessageParticipant implements \JsonSerializable
{
    /**
     * @property string $participantId Participant ID to resolve address from.
     * @property string $address Explicit address formatted according to channel type.
     * @property string $channel Channel type for address resolution.
    */
        protected $participantId;
        protected $address;
        protected $channel;
    public function __construct(array $payload = []) {
        $this->participantId = Values::array_get($payload, 'participantId');
        $this->address = Values::array_get($payload, 'address');
        $this->channel = Values::array_get($payload, 'channel');
    }

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

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

class ConversationsV2SendMessageContent implements \JsonSerializable
{
    /**
     * @property string $text Plain text message body.
     * @property string $contentId Content template ID (HX... format). When provided, the template is rendered with the variables map and sent to the recipient.
     * @property array<string,string> $variables Variables to substitute into the content template.
     * @property string[] $mediaUrls URLs of media attachments to include with the message.
    */
        protected $text;
        protected $contentId;
        protected $variables;
        protected $mediaUrls;
    public function __construct(array $payload = []) {
        $this->text = Values::array_get($payload, 'text');
        $this->contentId = Values::array_get($payload, 'contentId');
        $this->variables = Values::array_get($payload, 'variables');
        $this->mediaUrls = Values::array_get($payload, 'mediaUrls');
    }

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

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

class ConversationsV2SendMessagePayload implements \JsonSerializable
{
    /**
     * @property ConversationsV2SendMessageParticipant $from
     * @property ConversationsV2SendMessageParticipant[] $to The recipients of this action.
     * @property ConversationsV2SendMessageContent $content
     * @property array<string,mixed> $channelSettings Channel-specific parameters forwarded as-is to the downstream sending service. Allows passing backend-specific fields without requiring API changes.
    */
        protected $from;
        protected $to;
        protected $content;
        protected $channelSettings;
    public function __construct(array $payload = []) {
        $this->from = Values::array_get($payload, 'from');
        $this->to = Values::array_get($payload, 'to');
        $this->content = Values::array_get($payload, 'content');
        $this->channelSettings = Values::array_get($payload, 'channelSettings');
    }

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

    public function jsonSerialize(): array
    {
        $jsonString = [
            'from' => $this->from,
            'to' => $this->to,
            'content' => $this->content
        ];
        if (isset($this->channelSettings)) {
            $jsonString['channelSettings'] = $this->channelSettings;
        }
        return $jsonString;
    }
}

class CreateConversationActionRequest implements \JsonSerializable
{
    /**
     * @property string $type Action type discriminator. Accepted values: SEND_MESSAGE.
     * @property ConversationsV2SendMessagePayload $payload
    */
        protected $type;
        protected $payload;
    public function __construct(array $payload = []) {
        $this->type = Values::array_get($payload, 'type');
        $this->payload = Values::array_get($payload, 'payload');
    }

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

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

