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

namespace Twilio\Rest\Messaging\V3;

use Twilio\Values;
abstract class TypingIndicatorModels
{
    /**
     * @property string $channel The messaging channel. Must be \"APPLE\".
     * @property string $messageId The SID of a recent inbound message from the recipient. Must be an SM or MM SID format.
     * @property string $from The Apple Messages for Business identifier of the sender (business).
     * @property string $to The Apple Messages for Business identifier of the recipient (customer).
     * @property string $event The type of typing event. \"START\" indicates the agent began typing, \"END\" indicates the agent stopped typing. Defaults to \"START\".
    */
    public static function createTypingIndicatorRequest(array $payload = []): TypingIndicatorRequest
    {
        return new TypingIndicatorRequest($payload);
    }

}

class TypingIndicatorRequest implements \JsonSerializable
{
    /**
     * @property string $channel The messaging channel. Must be \"APPLE\".
     * @property string $messageId The SID of a recent inbound message from the recipient. Must be an SM or MM SID format.
     * @property string $from The Apple Messages for Business identifier of the sender (business).
     * @property string $to The Apple Messages for Business identifier of the recipient (customer).
     * @property string $event The type of typing event. \"START\" indicates the agent began typing, \"END\" indicates the agent stopped typing. Defaults to \"START\".
    */
        protected $channel;
        protected $messageId;
        protected $from;
        protected $to;
        protected $event;
    public function __construct(array $payload = []) {
        $this->channel = Values::array_get($payload, 'channel');
        $this->messageId = Values::array_get($payload, 'messageId');
        $this->from = Values::array_get($payload, 'from');
        $this->to = Values::array_get($payload, 'to');
        $this->event = Values::array_get($payload, 'event');
    }

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

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

