<?php
/**
 * This code was generated by
 * ___ _ _ _ _ _    _ ____    ____ ____ _    ____ ____ _  _ ____ ____ ____ ___ __   __
 *  |  | | | | |    | |  | __ |  | |__| | __ | __ |___ |\ | |___ |__/ |__|  | |  | |__/
 *  |  |_|_| | |___ | |__|    |__| |  | |    |__] |___ | \| |___ |  \ |  |  | |__| |  \
 *
 * Twilio Memory API
 * APIs for managing memory stores, profiles, events, and conversational intelligence capabilities.
 *
 * NOTE: This class is auto generated by OpenAPI Generator.
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */

namespace Twilio\Rest\Memory\V1;

use Twilio\Values;
abstract class EventModels
{
    /**
     * @property string $address The sender's address. Must be a valid address matching the channel type such as E.164 format for phone numbers.
     * @property string $participantId The unique identifier for the sender participant.
    */
    public static function createCommunicationLifecycleEventSender(array $payload = []): CommunicationLifecycleEventSender
    {
        return new CommunicationLifecycleEventSender($payload);
    }

    /**
     * @property string $address The recipient's address. Must be a valid address matching the channel type such as E.164 format for phone numbers.
     * @property string $participantId The unique identifier for the recipient participant.
    */
    public static function createCommunicationLifecycleEventRecipient(array $payload = []): CommunicationLifecycleEventRecipient
    {
        return new CommunicationLifecycleEventRecipient($payload);
    }

    /**
     * @property \DateTime $timestamp The time the event occurred in ISO8601 format with millisecond resolution. Defaults to received time if not provided.
     * @property string $lifecycle The lifecycle event type of the communication.
     * @property string $conversationId The unique identifier for the conversation.
     * @property string $communicationId The unique identifier for the communication.
     * @property string $communicationType The communication channel type.
     * @property string $communicationStatus The lifecycle status of the communication.
     * @property string $direction The direction of the communication.
     * @property CommunicationLifecycleEventSender $sender
     * @property CommunicationLifecycleEventRecipient $recipient
     * @property string $errorCode Error code for FAILED communication status.
     * @property string $errorMessage Error message for FAILED communication status.
    */
    public static function createProfileEventRequestEvents(array $payload = []): ProfileEventRequestEvents
    {
        return new ProfileEventRequestEvents($payload);
    }

    /**
     * @property string $type The type of event being sent.
     * @property ProfileEventRequestEvents[] $events
    */
    public static function createProfileEventRequest(array $payload = []): ProfileEventRequest
    {
        return new ProfileEventRequest($payload);
    }

}

class CommunicationLifecycleEventSender implements \JsonSerializable
{
    /**
     * @property string $address The sender's address. Must be a valid address matching the channel type such as E.164 format for phone numbers.
     * @property string $participantId The unique identifier for the sender participant.
    */
        protected $address;
        protected $participantId;
    public function __construct(array $payload = []) {
        $this->address = Values::array_get($payload, 'address');
        $this->participantId = Values::array_get($payload, 'participantId');
    }

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

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

class CommunicationLifecycleEventRecipient implements \JsonSerializable
{
    /**
     * @property string $address The recipient's address. Must be a valid address matching the channel type such as E.164 format for phone numbers.
     * @property string $participantId The unique identifier for the recipient participant.
    */
        protected $address;
        protected $participantId;
    public function __construct(array $payload = []) {
        $this->address = Values::array_get($payload, 'address');
        $this->participantId = Values::array_get($payload, 'participantId');
    }

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

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

class ProfileEventRequestEvents implements \JsonSerializable
{
    /**
     * @property \DateTime $timestamp The time the event occurred in ISO8601 format with millisecond resolution. Defaults to received time if not provided.
     * @property string $lifecycle The lifecycle event type of the communication.
     * @property string $conversationId The unique identifier for the conversation.
     * @property string $communicationId The unique identifier for the communication.
     * @property string $communicationType The communication channel type.
     * @property string $communicationStatus The lifecycle status of the communication.
     * @property string $direction The direction of the communication.
     * @property CommunicationLifecycleEventSender $sender
     * @property CommunicationLifecycleEventRecipient $recipient
     * @property string $errorCode Error code for FAILED communication status.
     * @property string $errorMessage Error message for FAILED communication status.
    */
        protected $timestamp;
        protected $lifecycle;
        protected $conversationId;
        protected $communicationId;
        protected $communicationType;
        protected $communicationStatus;
        protected $direction;
        protected $sender;
        protected $recipient;
        protected $errorCode;
        protected $errorMessage;
    public function __construct(array $payload = []) {
        $this->timestamp = Values::array_get($payload, 'timestamp');
        $this->lifecycle = Values::array_get($payload, 'lifecycle');
        $this->conversationId = Values::array_get($payload, 'conversationId');
        $this->communicationId = Values::array_get($payload, 'communicationId');
        $this->communicationType = Values::array_get($payload, 'communicationType');
        $this->communicationStatus = Values::array_get($payload, 'communicationStatus');
        $this->direction = Values::array_get($payload, 'direction');
        $this->sender = Values::array_get($payload, 'sender');
        $this->recipient = Values::array_get($payload, 'recipient');
        $this->errorCode = Values::array_get($payload, 'errorCode');
        $this->errorMessage = Values::array_get($payload, 'errorMessage');
    }

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

    public function jsonSerialize(): array
    {
        $jsonString = [
            'timestamp' => $this->timestamp,
            'lifecycle' => $this->lifecycle,
            'conversationId' => $this->conversationId,
            'communicationType' => $this->communicationType
        ];
        if (isset($this->communicationId)) {
            $jsonString['communicationId'] = $this->communicationId;
        }
        if (isset($this->communicationStatus)) {
            $jsonString['communicationStatus'] = $this->communicationStatus;
        }
        if (isset($this->direction)) {
            $jsonString['direction'] = $this->direction;
        }
        if (isset($this->sender)) {
            $jsonString['sender'] = $this->sender;
        }
        if (isset($this->recipient)) {
            $jsonString['recipient'] = $this->recipient;
        }
        if (isset($this->errorCode)) {
            $jsonString['errorCode'] = $this->errorCode;
        }
        if (isset($this->errorMessage)) {
            $jsonString['errorMessage'] = $this->errorMessage;
        }
        return $jsonString;
    }
}

class ProfileEventRequest implements \JsonSerializable
{
    /**
     * @property string $type The type of event being sent.
     * @property ProfileEventRequestEvents[] $events
    */
        protected $type;
        protected $events;
    public function __construct(array $payload = []) {
        $this->type = Values::array_get($payload, 'type');
        $this->events = Values::array_get($payload, 'events');
    }

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

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

