<?php
/**
 * DomainCdnConfig
 *
 * PHP version 7.4
 *
 * @category Class
 * @package  HubSpot\Client\Cms\Domains
 * @author   OpenAPI Generator team
 * @link     https://openapi-generator.tech
 */

/**
 * Domains
 *
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: v3
 * Generated by: https://openapi-generator.tech
 * OpenAPI Generator version: 6.0.1-SNAPSHOT
 */

/**
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */

namespace HubSpot\Client\Cms\Domains\Model;

use \ArrayAccess;
use \HubSpot\Client\Cms\Domains\ObjectSerializer;

/**
 * DomainCdnConfig Class Doc Comment
 *
 * @category Class
 * @package  HubSpot\Client\Cms\Domains
 * @author   OpenAPI Generator team
 * @link     https://openapi-generator.tech
 * @implements \ArrayAccess<TKey, TValue>
 * @template TKey int|null
 * @template TValue mixed|null
 */
class DomainCdnConfig implements ModelInterface, ArrayAccess, \JsonSerializable
{
    public const DISCRIMINATOR = null;

    /**
      * The original name of the model.
      *
      * @var string
      */
    protected static $openAPIModelName = 'DomainCdnConfig';

    /**
      * Array of property to type mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $openAPITypes = [
        'portal_id' => 'int',
        'created' => 'int',
        'updated' => 'int',
        'domain_id' => 'int',
        'cert_id' => 'int',
        'cert_expiration_date' => 'int',
        'cdn_id' => 'string',
        'cdn_group_id' => 'string',
        'ssl_status' => 'string',
        'validation_method' => 'string',
        'http_body' => 'string',
        'http_url_path' => 'string',
        'cname' => 'string',
        'cname_target' => 'string',
        'minimum_tls_version' => 'string',
        'alternate_origin_hostname' => 'string',
        'id' => 'int'
    ];

    /**
      * Array of property to format mappings. Used for (de)serialization
      *
      * @var string[]
      * @phpstan-var array<string, string|null>
      * @psalm-var array<string, string|null>
      */
    protected static $openAPIFormats = [
        'portal_id' => 'int32',
        'created' => 'int64',
        'updated' => 'int64',
        'domain_id' => 'int64',
        'cert_id' => 'int64',
        'cert_expiration_date' => 'int64',
        'cdn_id' => null,
        'cdn_group_id' => null,
        'ssl_status' => null,
        'validation_method' => null,
        'http_body' => null,
        'http_url_path' => null,
        'cname' => null,
        'cname_target' => null,
        'minimum_tls_version' => null,
        'alternate_origin_hostname' => null,
        'id' => 'int64'
    ];

    /**
     * Array of property to type mappings. Used for (de)serialization
     *
     * @return array
     */
    public static function openAPITypes()
    {
        return self::$openAPITypes;
    }

    /**
     * Array of property to format mappings. Used for (de)serialization
     *
     * @return array
     */
    public static function openAPIFormats()
    {
        return self::$openAPIFormats;
    }

    /**
     * Array of attributes where the key is the local name,
     * and the value is the original name
     *
     * @var string[]
     */
    protected static $attributeMap = [
        'portal_id' => 'portalId',
        'created' => 'created',
        'updated' => 'updated',
        'domain_id' => 'domainId',
        'cert_id' => 'certId',
        'cert_expiration_date' => 'certExpirationDate',
        'cdn_id' => 'cdnId',
        'cdn_group_id' => 'cdnGroupId',
        'ssl_status' => 'sslStatus',
        'validation_method' => 'validationMethod',
        'http_body' => 'httpBody',
        'http_url_path' => 'httpUrlPath',
        'cname' => 'cname',
        'cname_target' => 'cnameTarget',
        'minimum_tls_version' => 'minimumTlsVersion',
        'alternate_origin_hostname' => 'alternateOriginHostname',
        'id' => 'id'
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @var string[]
     */
    protected static $setters = [
        'portal_id' => 'setPortalId',
        'created' => 'setCreated',
        'updated' => 'setUpdated',
        'domain_id' => 'setDomainId',
        'cert_id' => 'setCertId',
        'cert_expiration_date' => 'setCertExpirationDate',
        'cdn_id' => 'setCdnId',
        'cdn_group_id' => 'setCdnGroupId',
        'ssl_status' => 'setSslStatus',
        'validation_method' => 'setValidationMethod',
        'http_body' => 'setHttpBody',
        'http_url_path' => 'setHttpUrlPath',
        'cname' => 'setCname',
        'cname_target' => 'setCnameTarget',
        'minimum_tls_version' => 'setMinimumTlsVersion',
        'alternate_origin_hostname' => 'setAlternateOriginHostname',
        'id' => 'setId'
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @var string[]
     */
    protected static $getters = [
        'portal_id' => 'getPortalId',
        'created' => 'getCreated',
        'updated' => 'getUpdated',
        'domain_id' => 'getDomainId',
        'cert_id' => 'getCertId',
        'cert_expiration_date' => 'getCertExpirationDate',
        'cdn_id' => 'getCdnId',
        'cdn_group_id' => 'getCdnGroupId',
        'ssl_status' => 'getSslStatus',
        'validation_method' => 'getValidationMethod',
        'http_body' => 'getHttpBody',
        'http_url_path' => 'getHttpUrlPath',
        'cname' => 'getCname',
        'cname_target' => 'getCnameTarget',
        'minimum_tls_version' => 'getMinimumTlsVersion',
        'alternate_origin_hostname' => 'getAlternateOriginHostname',
        'id' => 'getId'
    ];

    /**
     * Array of attributes where the key is the local name,
     * and the value is the original name
     *
     * @return array
     */
    public static function attributeMap()
    {
        return self::$attributeMap;
    }

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @return array
     */
    public static function setters()
    {
        return self::$setters;
    }

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @return array
     */
    public static function getters()
    {
        return self::$getters;
    }

    /**
     * The original name of the model.
     *
     * @return string
     */
    public function getModelName()
    {
        return self::$openAPIModelName;
    }

    public const SSL_STATUS__0 = '0';
    public const SSL_STATUS__1 = '1';
    public const SSL_STATUS__2 = '2';
    public const SSL_STATUS__3 = '3';
    public const SSL_STATUS__4 = '4';
    public const SSL_STATUS__5 = '5';
    public const SSL_STATUS__6 = '6';
    public const SSL_STATUS__7 = '7';
    public const SSL_STATUS__8 = '8';
    public const SSL_STATUS__9 = '9';
    public const SSL_STATUS__10 = '10';
    public const SSL_STATUS__11 = '11';
    public const VALIDATION_METHOD__0 = '0';
    public const VALIDATION_METHOD__1 = '1';
    public const VALIDATION_METHOD__2 = '2';
    public const MINIMUM_TLS_VERSION__1_0 = '1.0';
    public const MINIMUM_TLS_VERSION__1_1 = '1.1';
    public const MINIMUM_TLS_VERSION__1_2 = '1.2';
    public const MINIMUM_TLS_VERSION__1_3 = '1.3';
    public const MINIMUM_TLS_VERSION_NONE = 'none';
    public const MINIMUM_TLS_VERSION_NULL = 'null';

    /**
     * Gets allowable values of the enum
     *
     * @return string[]
     */
    public function getSslStatusAllowableValues()
    {
        return [
            self::SSL_STATUS__0,
            self::SSL_STATUS__1,
            self::SSL_STATUS__2,
            self::SSL_STATUS__3,
            self::SSL_STATUS__4,
            self::SSL_STATUS__5,
            self::SSL_STATUS__6,
            self::SSL_STATUS__7,
            self::SSL_STATUS__8,
            self::SSL_STATUS__9,
            self::SSL_STATUS__10,
            self::SSL_STATUS__11,
        ];
    }

    /**
     * Gets allowable values of the enum
     *
     * @return string[]
     */
    public function getValidationMethodAllowableValues()
    {
        return [
            self::VALIDATION_METHOD__0,
            self::VALIDATION_METHOD__1,
            self::VALIDATION_METHOD__2,
        ];
    }

    /**
     * Gets allowable values of the enum
     *
     * @return string[]
     */
    public function getMinimumTlsVersionAllowableValues()
    {
        return [
            self::MINIMUM_TLS_VERSION__1_0,
            self::MINIMUM_TLS_VERSION__1_1,
            self::MINIMUM_TLS_VERSION__1_2,
            self::MINIMUM_TLS_VERSION__1_3,
            self::MINIMUM_TLS_VERSION_NONE,
            self::MINIMUM_TLS_VERSION_NULL,
        ];
    }

    /**
     * Associative array for storing property values
     *
     * @var mixed[]
     */
    protected $container = [];

    /**
     * Constructor
     *
     * @param mixed[] $data Associated array of property values
     *                      initializing the model
     */
    public function __construct(array $data = null)
    {
        $this->container['portal_id'] = $data['portal_id'] ?? null;
        $this->container['created'] = $data['created'] ?? null;
        $this->container['updated'] = $data['updated'] ?? null;
        $this->container['domain_id'] = $data['domain_id'] ?? null;
        $this->container['cert_id'] = $data['cert_id'] ?? null;
        $this->container['cert_expiration_date'] = $data['cert_expiration_date'] ?? null;
        $this->container['cdn_id'] = $data['cdn_id'] ?? null;
        $this->container['cdn_group_id'] = $data['cdn_group_id'] ?? null;
        $this->container['ssl_status'] = $data['ssl_status'] ?? null;
        $this->container['validation_method'] = $data['validation_method'] ?? null;
        $this->container['http_body'] = $data['http_body'] ?? null;
        $this->container['http_url_path'] = $data['http_url_path'] ?? null;
        $this->container['cname'] = $data['cname'] ?? null;
        $this->container['cname_target'] = $data['cname_target'] ?? null;
        $this->container['minimum_tls_version'] = $data['minimum_tls_version'] ?? null;
        $this->container['alternate_origin_hostname'] = $data['alternate_origin_hostname'] ?? null;
        $this->container['id'] = $data['id'] ?? null;
    }

    /**
     * Show all the invalid properties with reasons.
     *
     * @return array invalid properties with reasons
     */
    public function listInvalidProperties()
    {
        $invalidProperties = [];

        if ($this->container['portal_id'] === null) {
            $invalidProperties[] = "'portal_id' can't be null";
        }
        if ($this->container['created'] === null) {
            $invalidProperties[] = "'created' can't be null";
        }
        if ($this->container['updated'] === null) {
            $invalidProperties[] = "'updated' can't be null";
        }
        if ($this->container['domain_id'] === null) {
            $invalidProperties[] = "'domain_id' can't be null";
        }
        if ($this->container['cert_id'] === null) {
            $invalidProperties[] = "'cert_id' can't be null";
        }
        if ($this->container['cert_expiration_date'] === null) {
            $invalidProperties[] = "'cert_expiration_date' can't be null";
        }
        if ($this->container['cdn_id'] === null) {
            $invalidProperties[] = "'cdn_id' can't be null";
        }
        if ($this->container['cdn_group_id'] === null) {
            $invalidProperties[] = "'cdn_group_id' can't be null";
        }
        if ($this->container['ssl_status'] === null) {
            $invalidProperties[] = "'ssl_status' can't be null";
        }
        $allowedValues = $this->getSslStatusAllowableValues();
        if (!is_null($this->container['ssl_status']) && !in_array($this->container['ssl_status'], $allowedValues, true)) {
            $invalidProperties[] = sprintf(
                "invalid value '%s' for 'ssl_status', must be one of '%s'",
                $this->container['ssl_status'],
                implode("', '", $allowedValues)
            );
        }

        if ($this->container['validation_method'] === null) {
            $invalidProperties[] = "'validation_method' can't be null";
        }
        $allowedValues = $this->getValidationMethodAllowableValues();
        if (!is_null($this->container['validation_method']) && !in_array($this->container['validation_method'], $allowedValues, true)) {
            $invalidProperties[] = sprintf(
                "invalid value '%s' for 'validation_method', must be one of '%s'",
                $this->container['validation_method'],
                implode("', '", $allowedValues)
            );
        }

        if ($this->container['http_body'] === null) {
            $invalidProperties[] = "'http_body' can't be null";
        }
        if ($this->container['http_url_path'] === null) {
            $invalidProperties[] = "'http_url_path' can't be null";
        }
        if ($this->container['cname'] === null) {
            $invalidProperties[] = "'cname' can't be null";
        }
        if ($this->container['cname_target'] === null) {
            $invalidProperties[] = "'cname_target' can't be null";
        }
        if ($this->container['minimum_tls_version'] === null) {
            $invalidProperties[] = "'minimum_tls_version' can't be null";
        }
        $allowedValues = $this->getMinimumTlsVersionAllowableValues();
        if (!is_null($this->container['minimum_tls_version']) && !in_array($this->container['minimum_tls_version'], $allowedValues, true)) {
            $invalidProperties[] = sprintf(
                "invalid value '%s' for 'minimum_tls_version', must be one of '%s'",
                $this->container['minimum_tls_version'],
                implode("', '", $allowedValues)
            );
        }

        if ($this->container['alternate_origin_hostname'] === null) {
            $invalidProperties[] = "'alternate_origin_hostname' can't be null";
        }
        if ($this->container['id'] === null) {
            $invalidProperties[] = "'id' can't be null";
        }
        return $invalidProperties;
    }

    /**
     * Validate all the properties in the model
     * return true if all passed
     *
     * @return bool True if all properties are valid
     */
    public function valid()
    {
        return count($this->listInvalidProperties()) === 0;
    }


    /**
     * Gets portal_id
     *
     * @return int
     */
    public function getPortalId()
    {
        return $this->container['portal_id'];
    }

    /**
     * Sets portal_id
     *
     * @param int $portal_id portal_id
     *
     * @return self
     */
    public function setPortalId($portal_id)
    {
        $this->container['portal_id'] = $portal_id;

        return $this;
    }

    /**
     * Gets created
     *
     * @return int
     */
    public function getCreated()
    {
        return $this->container['created'];
    }

    /**
     * Sets created
     *
     * @param int $created created
     *
     * @return self
     */
    public function setCreated($created)
    {
        $this->container['created'] = $created;

        return $this;
    }

    /**
     * Gets updated
     *
     * @return int
     */
    public function getUpdated()
    {
        return $this->container['updated'];
    }

    /**
     * Sets updated
     *
     * @param int $updated updated
     *
     * @return self
     */
    public function setUpdated($updated)
    {
        $this->container['updated'] = $updated;

        return $this;
    }

    /**
     * Gets domain_id
     *
     * @return int
     */
    public function getDomainId()
    {
        return $this->container['domain_id'];
    }

    /**
     * Sets domain_id
     *
     * @param int $domain_id domain_id
     *
     * @return self
     */
    public function setDomainId($domain_id)
    {
        $this->container['domain_id'] = $domain_id;

        return $this;
    }

    /**
     * Gets cert_id
     *
     * @return int
     */
    public function getCertId()
    {
        return $this->container['cert_id'];
    }

    /**
     * Sets cert_id
     *
     * @param int $cert_id cert_id
     *
     * @return self
     */
    public function setCertId($cert_id)
    {
        $this->container['cert_id'] = $cert_id;

        return $this;
    }

    /**
     * Gets cert_expiration_date
     *
     * @return int
     */
    public function getCertExpirationDate()
    {
        return $this->container['cert_expiration_date'];
    }

    /**
     * Sets cert_expiration_date
     *
     * @param int $cert_expiration_date cert_expiration_date
     *
     * @return self
     */
    public function setCertExpirationDate($cert_expiration_date)
    {
        $this->container['cert_expiration_date'] = $cert_expiration_date;

        return $this;
    }

    /**
     * Gets cdn_id
     *
     * @return string
     */
    public function getCdnId()
    {
        return $this->container['cdn_id'];
    }

    /**
     * Sets cdn_id
     *
     * @param string $cdn_id cdn_id
     *
     * @return self
     */
    public function setCdnId($cdn_id)
    {
        $this->container['cdn_id'] = $cdn_id;

        return $this;
    }

    /**
     * Gets cdn_group_id
     *
     * @return string
     */
    public function getCdnGroupId()
    {
        return $this->container['cdn_group_id'];
    }

    /**
     * Sets cdn_group_id
     *
     * @param string $cdn_group_id cdn_group_id
     *
     * @return self
     */
    public function setCdnGroupId($cdn_group_id)
    {
        $this->container['cdn_group_id'] = $cdn_group_id;

        return $this;
    }

    /**
     * Gets ssl_status
     *
     * @return string
     */
    public function getSslStatus()
    {
        return $this->container['ssl_status'];
    }

    /**
     * Sets ssl_status
     *
     * @param string $ssl_status ssl_status
     *
     * @return self
     */
    public function setSslStatus($ssl_status)
    {
        $allowedValues = $this->getSslStatusAllowableValues();
        if (!in_array($ssl_status, $allowedValues, true)) {
            throw new \InvalidArgumentException(
                sprintf(
                    "Invalid value '%s' for 'ssl_status', must be one of '%s'",
                    $ssl_status,
                    implode("', '", $allowedValues)
                )
            );
        }
        $this->container['ssl_status'] = $ssl_status;

        return $this;
    }

    /**
     * Gets validation_method
     *
     * @return string
     */
    public function getValidationMethod()
    {
        return $this->container['validation_method'];
    }

    /**
     * Sets validation_method
     *
     * @param string $validation_method validation_method
     *
     * @return self
     */
    public function setValidationMethod($validation_method)
    {
        $allowedValues = $this->getValidationMethodAllowableValues();
        if (!in_array($validation_method, $allowedValues, true)) {
            throw new \InvalidArgumentException(
                sprintf(
                    "Invalid value '%s' for 'validation_method', must be one of '%s'",
                    $validation_method,
                    implode("', '", $allowedValues)
                )
            );
        }
        $this->container['validation_method'] = $validation_method;

        return $this;
    }

    /**
     * Gets http_body
     *
     * @return string
     */
    public function getHttpBody()
    {
        return $this->container['http_body'];
    }

    /**
     * Sets http_body
     *
     * @param string $http_body http_body
     *
     * @return self
     */
    public function setHttpBody($http_body)
    {
        $this->container['http_body'] = $http_body;

        return $this;
    }

    /**
     * Gets http_url_path
     *
     * @return string
     */
    public function getHttpUrlPath()
    {
        return $this->container['http_url_path'];
    }

    /**
     * Sets http_url_path
     *
     * @param string $http_url_path http_url_path
     *
     * @return self
     */
    public function setHttpUrlPath($http_url_path)
    {
        $this->container['http_url_path'] = $http_url_path;

        return $this;
    }

    /**
     * Gets cname
     *
     * @return string
     */
    public function getCname()
    {
        return $this->container['cname'];
    }

    /**
     * Sets cname
     *
     * @param string $cname cname
     *
     * @return self
     */
    public function setCname($cname)
    {
        $this->container['cname'] = $cname;

        return $this;
    }

    /**
     * Gets cname_target
     *
     * @return string
     */
    public function getCnameTarget()
    {
        return $this->container['cname_target'];
    }

    /**
     * Sets cname_target
     *
     * @param string $cname_target cname_target
     *
     * @return self
     */
    public function setCnameTarget($cname_target)
    {
        $this->container['cname_target'] = $cname_target;

        return $this;
    }

    /**
     * Gets minimum_tls_version
     *
     * @return string
     */
    public function getMinimumTlsVersion()
    {
        return $this->container['minimum_tls_version'];
    }

    /**
     * Sets minimum_tls_version
     *
     * @param string $minimum_tls_version minimum_tls_version
     *
     * @return self
     */
    public function setMinimumTlsVersion($minimum_tls_version)
    {
        $allowedValues = $this->getMinimumTlsVersionAllowableValues();
        if (!in_array($minimum_tls_version, $allowedValues, true)) {
            throw new \InvalidArgumentException(
                sprintf(
                    "Invalid value '%s' for 'minimum_tls_version', must be one of '%s'",
                    $minimum_tls_version,
                    implode("', '", $allowedValues)
                )
            );
        }
        $this->container['minimum_tls_version'] = $minimum_tls_version;

        return $this;
    }

    /**
     * Gets alternate_origin_hostname
     *
     * @return string
     */
    public function getAlternateOriginHostname()
    {
        return $this->container['alternate_origin_hostname'];
    }

    /**
     * Sets alternate_origin_hostname
     *
     * @param string $alternate_origin_hostname alternate_origin_hostname
     *
     * @return self
     */
    public function setAlternateOriginHostname($alternate_origin_hostname)
    {
        $this->container['alternate_origin_hostname'] = $alternate_origin_hostname;

        return $this;
    }

    /**
     * Gets id
     *
     * @return int
     */
    public function getId()
    {
        return $this->container['id'];
    }

    /**
     * Sets id
     *
     * @param int $id id
     *
     * @return self
     */
    public function setId($id)
    {
        $this->container['id'] = $id;

        return $this;
    }
    /**
     * Returns true if offset exists. False otherwise.
     *
     * @param integer $offset Offset
     *
     * @return boolean
     */
    public function offsetExists($offset): bool
    {
        return isset($this->container[$offset]);
    }

    /**
     * Gets offset.
     *
     * @param integer $offset Offset
     *
     * @return mixed|null
     */
    #[\ReturnTypeWillChange]
    public function offsetGet($offset)
    {
        return $this->container[$offset] ?? null;
    }

    /**
     * Sets value based on offset.
     *
     * @param int|null $offset Offset
     * @param mixed    $value  Value to be set
     *
     * @return void
     */
    public function offsetSet($offset, $value): void
    {
        if (is_null($offset)) {
            $this->container[] = $value;
        } else {
            $this->container[$offset] = $value;
        }
    }

    /**
     * Unsets offset.
     *
     * @param integer $offset Offset
     *
     * @return void
     */
    public function offsetUnset($offset): void
    {
        unset($this->container[$offset]);
    }

    /**
     * Serializes the object to a value that can be serialized natively by json_encode().
     * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
     *
     * @return mixed Returns data which can be serialized by json_encode(), which is a value
     * of any type other than a resource.
     */
    #[\ReturnTypeWillChange]
    public function jsonSerialize()
    {
       return ObjectSerializer::sanitizeForSerialization($this);
    }

    /**
     * Gets the string presentation of the object
     *
     * @return string
     */
    public function __toString()
    {
        return json_encode(
            ObjectSerializer::sanitizeForSerialization($this),
            JSON_PRETTY_PRINT
        );
    }

    /**
     * Gets a header-safe presentation of the object
     *
     * @return string
     */
    public function toHeaderValue()
    {
        return json_encode(ObjectSerializer::sanitizeForSerialization($this));
    }
}


