<?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 DataMappingModels
{
    /**
     * @property string $fieldName The name of the field/column in the source. Deprecated in favor of expression.
     * @property string $expression The expression identifying the field/column in the source.
     * @property string $traitGroup The name of the Trait Group to map to.
     * @property string $traitName The name of the trait within the Trait Group to map to.
    */
    public static function createMappingTraitItem(array $payload = []): MappingTraitItem
    {
        return new MappingTraitItem($payload);
    }

    /**
     * @property string $type The destination data type, which determines where to write the data and the required configuration parameters.
     * @property MappingTraitItem[] $mappings The list of field to trait mappings.
    */
    public static function createDataMappingToTraits(array $payload = []): DataMappingToTraits
    {
        return new DataMappingToTraits($payload);
    }

    /**
     * @property string $type The source data type, which determines the source of the data and the required configuration parameters.
     * @property string $datasetId The unique identifier of the TDI dataset to connect.
    */
    public static function createDataMappingFromDataSet(array $payload = []): DataMappingFromDataSet
    {
        return new DataMappingFromDataSet($payload);
    }

    /**
     * @property string $displayName Name of the data mapping.
     * @property string $description A human readable description of this resource, up to 512 characters.
     * @property bool $isEnabled Flag indicating whether the data mapping is active. When true, data will be ingested and mapped according to the configuration. When false, the data mapping will be inactive and no data will be ingested into the Memory Store.
     * @property DataMappingToTraits $mappingTo
     * @property DataMappingFromDataSet $mappingFrom
    */
    public static function createCreateDataMappingInput(array $payload = []): CreateDataMappingInput
    {
        return new CreateDataMappingInput($payload);
    }

    /**
     * @property string $displayName Name of the data mapping.
     * @property string $description A human readable description of this resource, up to 512 characters.
     * @property bool $isEnabled Flag indicating whether the data mapping is active. When true, data will be ingested and mapped according to the configuration. When false, the data mapping will be inactive and no data will be ingested into the Memory Store.
     * @property DataMappingToTraits $mappingTo
    */
    public static function createDataMappingCore(array $payload = []): DataMappingCore
    {
        return new DataMappingCore($payload);
    }

}

class MappingTraitItem implements \JsonSerializable
{
    /**
     * @property string $fieldName The name of the field/column in the source. Deprecated in favor of expression.
     * @property string $expression The expression identifying the field/column in the source.
     * @property string $traitGroup The name of the Trait Group to map to.
     * @property string $traitName The name of the trait within the Trait Group to map to.
    */
        protected $fieldName;
        protected $expression;
        protected $traitGroup;
        protected $traitName;
    public function __construct(array $payload = []) {
        $this->fieldName = Values::array_get($payload, 'fieldName');
        $this->expression = Values::array_get($payload, 'expression');
        $this->traitGroup = Values::array_get($payload, 'traitGroup');
        $this->traitName = Values::array_get($payload, 'traitName');
    }

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

    public function jsonSerialize(): array
    {
        $jsonString = [
            'fieldName' => $this->fieldName,
            'traitGroup' => $this->traitGroup,
            'traitName' => $this->traitName
        ];
        if (isset($this->expression)) {
            $jsonString['expression'] = $this->expression;
        }
        return $jsonString;
    }
}

class DataMappingToTraits implements \JsonSerializable
{
    /**
     * @property string $type The destination data type, which determines where to write the data and the required configuration parameters.
     * @property MappingTraitItem[] $mappings The list of field to trait mappings.
    */
        protected $type;
        protected $mappings;
    public function __construct(array $payload = []) {
        $this->type = Values::array_get($payload, 'type');
        $this->mappings = Values::array_get($payload, 'mappings');
    }

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

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

class DataMappingFromDataSet implements \JsonSerializable
{
    /**
     * @property string $type The source data type, which determines the source of the data and the required configuration parameters.
     * @property string $datasetId The unique identifier of the TDI dataset to connect.
    */
        protected $type;
        protected $datasetId;
    public function __construct(array $payload = []) {
        $this->type = Values::array_get($payload, 'type');
        $this->datasetId = Values::array_get($payload, 'datasetId');
    }

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

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

class CreateDataMappingInput implements \JsonSerializable
{
    /**
     * @property string $displayName Name of the data mapping.
     * @property string $description A human readable description of this resource, up to 512 characters.
     * @property bool $isEnabled Flag indicating whether the data mapping is active. When true, data will be ingested and mapped according to the configuration. When false, the data mapping will be inactive and no data will be ingested into the Memory Store.
     * @property DataMappingToTraits $mappingTo
     * @property DataMappingFromDataSet $mappingFrom
    */
        protected $displayName;
        protected $description;
        protected $isEnabled;
        protected $mappingTo;
        protected $mappingFrom;
    public function __construct(array $payload = []) {
        $this->displayName = Values::array_get($payload, 'displayName');
        $this->description = Values::array_get($payload, 'description');
        $this->isEnabled = Values::array_get($payload, 'isEnabled');
        $this->mappingTo = Values::array_get($payload, 'mappingTo');
        $this->mappingFrom = Values::array_get($payload, 'mappingFrom');
    }

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

    public function jsonSerialize(): array
    {
        $jsonString = [
            'displayName' => $this->displayName,
            'mappingTo' => $this->mappingTo,
            'mappingFrom' => $this->mappingFrom
        ];
        if (isset($this->description)) {
            $jsonString['description'] = $this->description;
        }
        if (isset($this->isEnabled)) {
            $jsonString['isEnabled'] = $this->isEnabled;
        }
        return $jsonString;
    }
}

class DataMappingCore implements \JsonSerializable
{
    /**
     * @property string $displayName Name of the data mapping.
     * @property string $description A human readable description of this resource, up to 512 characters.
     * @property bool $isEnabled Flag indicating whether the data mapping is active. When true, data will be ingested and mapped according to the configuration. When false, the data mapping will be inactive and no data will be ingested into the Memory Store.
     * @property DataMappingToTraits $mappingTo
    */
        protected $displayName;
        protected $description;
        protected $isEnabled;
        protected $mappingTo;
    public function __construct(array $payload = []) {
        $this->displayName = Values::array_get($payload, 'displayName');
        $this->description = Values::array_get($payload, 'description');
        $this->isEnabled = Values::array_get($payload, 'isEnabled');
        $this->mappingTo = Values::array_get($payload, 'mappingTo');
    }

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

    public function jsonSerialize(): array
    {
        $jsonString = [
        ];
        if (isset($this->displayName)) {
            $jsonString['displayName'] = $this->displayName;
        }
        if (isset($this->description)) {
            $jsonString['description'] = $this->description;
        }
        if (isset($this->isEnabled)) {
            $jsonString['isEnabled'] = $this->isEnabled;
        }
        if (isset($this->mappingTo)) {
            $jsonString['mappingTo'] = $this->mappingTo;
        }
        return $jsonString;
    }
}

