<?php
/**
 * CustomerContact
 *
 * PHP version 8.1
 *
 * @category Class
 * @package  Opsuite2
 * @author   OpenAPI Generator team
 * @link     https://openapi-generator.tech
 */

/**
 * OpSuite API
 *
 * <p>Welcome the the OpSuite.API.  This swagger page is the best place to familiarize yourself with the API before you write any client code.  </p<p>Here is some general information about the use of the API.<p><p><b>Authentication</b><p>All requests require authentication. You will need a username and password in order to obtain a bearer token that is then used with all requests. If you do not have a username and password then contact the enterprise you are developing for.</p><p><b>Rate Limits</b><p><p>OpSuite.API is limited on a per client basis.<p><p>In order for your client to be allocated the correct rate limits you should add a header to your request with a Key of X-ClientId and a Value of your username.<p><p>You should then contact us so we can setup your rate limits.<p><p>If you do not set the X-ClientId header then your requests will be limited by a default set of low rates limits.<p><p>It is important that you use the API in the most efficient way so that you do not reach the rate limits.<p><p>Requests exceeding the limit will return a '429 Too Many Requests' along with a JSON error message.<p><p>A client's limits and usage are reported with every API request as part of the HTTP Headers.<p><p>Example successful response headers:<p><p>HTTP/1.1 200 OK<br>X-Rate-Limit: 24h<br>X-Rate-Limit-Remaining: 249963<br>X-Rate-Limit-Reset: 2022-11-25T09:20:41<p><p>Example rate-limited response JSON error message and headers:<p><p>Content: API calls quota exceeded! maximum admitted 4500 per 15m.<br>HTTP/1.1 429 Too many Requests<br>Retry-After: 10 (seconds)<p>
 *
 * The version of the OpenAPI document: v2
 * Contact: opsuitesupport@davrich.co.uk
 * Generated by: https://openapi-generator.tech
 * Generator version: 7.13.0
 */

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

namespace Opsuite2\Model;

use \ArrayAccess;
use \Opsuite2\ObjectSerializer;

/**
 * CustomerContact Class Doc Comment
 *
 * @category Class
 * @package  Opsuite2
 * @author   OpenAPI Generator team
 * @link     https://openapi-generator.tech
 * @implements \ArrayAccess<string, mixed>
 */
class CustomerContact implements ModelInterface, ArrayAccess, \JsonSerializable
{
    public const DISCRIMINATOR = null;

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

    /**
      * Array of property to type mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $openAPITypes = [
        'id' => 'int',
        'customer_id' => 'int',
        'contact_type' => 'string',
        'email' => 'string',
        'title' => 'string',
        'first_name' => 'string',
        'last_name' => 'string',
        'date_of_birth' => '\DateTime',
        'company' => 'string',
        'address_line1' => 'string',
        'address_line2' => 'string',
        'address_line3' => 'string',
        'address_line4' => 'string',
        'city' => 'string',
        'territory' => 'string',
        'zip' => 'string',
        'iso_country_code' => 'string',
        'telephone_itu_country_code' => 'string',
        'telephone_number' => 'string',
        'fax_itu_country_code' => 'string',
        'fax_number' => 'string'
    ];

    /**
      * 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 = [
        'id' => 'int32',
        'customer_id' => 'int32',
        'contact_type' => null,
        'email' => null,
        'title' => null,
        'first_name' => null,
        'last_name' => null,
        'date_of_birth' => 'date-time',
        'company' => null,
        'address_line1' => null,
        'address_line2' => null,
        'address_line3' => null,
        'address_line4' => null,
        'city' => null,
        'territory' => null,
        'zip' => null,
        'iso_country_code' => null,
        'telephone_itu_country_code' => null,
        'telephone_number' => null,
        'fax_itu_country_code' => null,
        'fax_number' => null
    ];

    /**
      * Array of nullable properties. Used for (de)serialization
      *
      * @var boolean[]
      */
    protected static array $openAPINullables = [
        'id' => false,
        'customer_id' => false,
        'contact_type' => true,
        'email' => true,
        'title' => true,
        'first_name' => true,
        'last_name' => true,
        'date_of_birth' => true,
        'company' => true,
        'address_line1' => true,
        'address_line2' => true,
        'address_line3' => true,
        'address_line4' => true,
        'city' => true,
        'territory' => true,
        'zip' => true,
        'iso_country_code' => true,
        'telephone_itu_country_code' => true,
        'telephone_number' => true,
        'fax_itu_country_code' => true,
        'fax_number' => true
    ];

    /**
      * If a nullable field gets set to null, insert it here
      *
      * @var boolean[]
      */
    protected array $openAPINullablesSetToNull = [];

    /**
     * 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 nullable properties
     *
     * @return array
     */
    protected static function openAPINullables(): array
    {
        return self::$openAPINullables;
    }

    /**
     * Array of nullable field names deliberately set to null
     *
     * @return boolean[]
     */
    private function getOpenAPINullablesSetToNull(): array
    {
        return $this->openAPINullablesSetToNull;
    }

    /**
     * Setter - Array of nullable field names deliberately set to null
     *
     * @param boolean[] $openAPINullablesSetToNull
     */
    private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
    {
        $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
    }

    /**
     * Checks if a property is nullable
     *
     * @param string $property
     * @return bool
     */
    public static function isNullable(string $property): bool
    {
        return self::openAPINullables()[$property] ?? false;
    }

    /**
     * Checks if a nullable property is set to null.
     *
     * @param string $property
     * @return bool
     */
    public function isNullableSetToNull(string $property): bool
    {
        return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
    }

    /**
     * Array of attributes where the key is the local name,
     * and the value is the original name
     *
     * @var string[]
     */
    protected static $attributeMap = [
        'id' => 'id',
        'customer_id' => 'customerId',
        'contact_type' => 'contactType',
        'email' => 'email',
        'title' => 'title',
        'first_name' => 'firstName',
        'last_name' => 'lastName',
        'date_of_birth' => 'dateOfBirth',
        'company' => 'company',
        'address_line1' => 'addressLine1',
        'address_line2' => 'addressLine2',
        'address_line3' => 'addressLine3',
        'address_line4' => 'addressLine4',
        'city' => 'city',
        'territory' => 'territory',
        'zip' => 'zip',
        'iso_country_code' => 'isoCountryCode',
        'telephone_itu_country_code' => 'telephoneItuCountryCode',
        'telephone_number' => 'telephoneNumber',
        'fax_itu_country_code' => 'faxItuCountryCode',
        'fax_number' => 'faxNumber'
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @var string[]
     */
    protected static $setters = [
        'id' => 'setId',
        'customer_id' => 'setCustomerId',
        'contact_type' => 'setContactType',
        'email' => 'setEmail',
        'title' => 'setTitle',
        'first_name' => 'setFirstName',
        'last_name' => 'setLastName',
        'date_of_birth' => 'setDateOfBirth',
        'company' => 'setCompany',
        'address_line1' => 'setAddressLine1',
        'address_line2' => 'setAddressLine2',
        'address_line3' => 'setAddressLine3',
        'address_line4' => 'setAddressLine4',
        'city' => 'setCity',
        'territory' => 'setTerritory',
        'zip' => 'setZip',
        'iso_country_code' => 'setIsoCountryCode',
        'telephone_itu_country_code' => 'setTelephoneItuCountryCode',
        'telephone_number' => 'setTelephoneNumber',
        'fax_itu_country_code' => 'setFaxItuCountryCode',
        'fax_number' => 'setFaxNumber'
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @var string[]
     */
    protected static $getters = [
        'id' => 'getId',
        'customer_id' => 'getCustomerId',
        'contact_type' => 'getContactType',
        'email' => 'getEmail',
        'title' => 'getTitle',
        'first_name' => 'getFirstName',
        'last_name' => 'getLastName',
        'date_of_birth' => 'getDateOfBirth',
        'company' => 'getCompany',
        'address_line1' => 'getAddressLine1',
        'address_line2' => 'getAddressLine2',
        'address_line3' => 'getAddressLine3',
        'address_line4' => 'getAddressLine4',
        'city' => 'getCity',
        'territory' => 'getTerritory',
        'zip' => 'getZip',
        'iso_country_code' => 'getIsoCountryCode',
        'telephone_itu_country_code' => 'getTelephoneItuCountryCode',
        'telephone_number' => 'getTelephoneNumber',
        'fax_itu_country_code' => 'getFaxItuCountryCode',
        'fax_number' => 'getFaxNumber'
    ];

    /**
     * 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;
    }


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

    /**
     * Constructor
     *
     * @param mixed[]|null $data Associated array of property values
     *                      initializing the model
     */
    public function __construct(?array $data = null)
    {
        $this->setIfExists('id', $data ?? [], null);
        $this->setIfExists('customer_id', $data ?? [], null);
        $this->setIfExists('contact_type', $data ?? [], null);
        $this->setIfExists('email', $data ?? [], null);
        $this->setIfExists('title', $data ?? [], null);
        $this->setIfExists('first_name', $data ?? [], null);
        $this->setIfExists('last_name', $data ?? [], null);
        $this->setIfExists('date_of_birth', $data ?? [], null);
        $this->setIfExists('company', $data ?? [], null);
        $this->setIfExists('address_line1', $data ?? [], null);
        $this->setIfExists('address_line2', $data ?? [], null);
        $this->setIfExists('address_line3', $data ?? [], null);
        $this->setIfExists('address_line4', $data ?? [], null);
        $this->setIfExists('city', $data ?? [], null);
        $this->setIfExists('territory', $data ?? [], null);
        $this->setIfExists('zip', $data ?? [], null);
        $this->setIfExists('iso_country_code', $data ?? [], null);
        $this->setIfExists('telephone_itu_country_code', $data ?? [], null);
        $this->setIfExists('telephone_number', $data ?? [], null);
        $this->setIfExists('fax_itu_country_code', $data ?? [], null);
        $this->setIfExists('fax_number', $data ?? [], null);
    }

    /**
    * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
    * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
    * $this->openAPINullablesSetToNull array
    *
    * @param string $variableName
    * @param array  $fields
    * @param mixed  $defaultValue
    */
    private function setIfExists(string $variableName, array $fields, $defaultValue): void
    {
        if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
            $this->openAPINullablesSetToNull[] = $variableName;
        }

        $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
    }

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

        if ($this->container['customer_id'] === null) {
            $invalidProperties[] = "'customer_id' can't be null";
        }
        if (!is_null($this->container['email']) && (mb_strlen($this->container['email']) > 255)) {
            $invalidProperties[] = "invalid value for 'email', the character length must be smaller than or equal to 255.";
        }

        if (!is_null($this->container['email']) && (mb_strlen($this->container['email']) < 0)) {
            $invalidProperties[] = "invalid value for 'email', the character length must be bigger than or equal to 0.";
        }

        if (!is_null($this->container['title']) && (mb_strlen($this->container['title']) > 15)) {
            $invalidProperties[] = "invalid value for 'title', the character length must be smaller than or equal to 15.";
        }

        if (!is_null($this->container['title']) && (mb_strlen($this->container['title']) < 0)) {
            $invalidProperties[] = "invalid value for 'title', the character length must be bigger than or equal to 0.";
        }

        if (!is_null($this->container['first_name']) && (mb_strlen($this->container['first_name']) > 50)) {
            $invalidProperties[] = "invalid value for 'first_name', the character length must be smaller than or equal to 50.";
        }

        if (!is_null($this->container['first_name']) && (mb_strlen($this->container['first_name']) < 0)) {
            $invalidProperties[] = "invalid value for 'first_name', the character length must be bigger than or equal to 0.";
        }

        if (!is_null($this->container['last_name']) && (mb_strlen($this->container['last_name']) > 50)) {
            $invalidProperties[] = "invalid value for 'last_name', the character length must be smaller than or equal to 50.";
        }

        if (!is_null($this->container['last_name']) && (mb_strlen($this->container['last_name']) < 0)) {
            $invalidProperties[] = "invalid value for 'last_name', the character length must be bigger than or equal to 0.";
        }

        if (!is_null($this->container['company']) && (mb_strlen($this->container['company']) > 50)) {
            $invalidProperties[] = "invalid value for 'company', the character length must be smaller than or equal to 50.";
        }

        if (!is_null($this->container['company']) && (mb_strlen($this->container['company']) < 0)) {
            $invalidProperties[] = "invalid value for 'company', the character length must be bigger than or equal to 0.";
        }

        if (!is_null($this->container['address_line1']) && (mb_strlen($this->container['address_line1']) > 50)) {
            $invalidProperties[] = "invalid value for 'address_line1', the character length must be smaller than or equal to 50.";
        }

        if (!is_null($this->container['address_line1']) && (mb_strlen($this->container['address_line1']) < 0)) {
            $invalidProperties[] = "invalid value for 'address_line1', the character length must be bigger than or equal to 0.";
        }

        if (!is_null($this->container['address_line2']) && (mb_strlen($this->container['address_line2']) > 50)) {
            $invalidProperties[] = "invalid value for 'address_line2', the character length must be smaller than or equal to 50.";
        }

        if (!is_null($this->container['address_line2']) && (mb_strlen($this->container['address_line2']) < 0)) {
            $invalidProperties[] = "invalid value for 'address_line2', the character length must be bigger than or equal to 0.";
        }

        if (!is_null($this->container['address_line3']) && (mb_strlen($this->container['address_line3']) > 50)) {
            $invalidProperties[] = "invalid value for 'address_line3', the character length must be smaller than or equal to 50.";
        }

        if (!is_null($this->container['address_line3']) && (mb_strlen($this->container['address_line3']) < 0)) {
            $invalidProperties[] = "invalid value for 'address_line3', the character length must be bigger than or equal to 0.";
        }

        if (!is_null($this->container['address_line4']) && (mb_strlen($this->container['address_line4']) > 50)) {
            $invalidProperties[] = "invalid value for 'address_line4', the character length must be smaller than or equal to 50.";
        }

        if (!is_null($this->container['address_line4']) && (mb_strlen($this->container['address_line4']) < 0)) {
            $invalidProperties[] = "invalid value for 'address_line4', the character length must be bigger than or equal to 0.";
        }

        if (!is_null($this->container['city']) && (mb_strlen($this->container['city']) > 50)) {
            $invalidProperties[] = "invalid value for 'city', the character length must be smaller than or equal to 50.";
        }

        if (!is_null($this->container['city']) && (mb_strlen($this->container['city']) < 0)) {
            $invalidProperties[] = "invalid value for 'city', the character length must be bigger than or equal to 0.";
        }

        if (!is_null($this->container['territory']) && (mb_strlen($this->container['territory']) > 50)) {
            $invalidProperties[] = "invalid value for 'territory', the character length must be smaller than or equal to 50.";
        }

        if (!is_null($this->container['territory']) && (mb_strlen($this->container['territory']) < 0)) {
            $invalidProperties[] = "invalid value for 'territory', the character length must be bigger than or equal to 0.";
        }

        if (!is_null($this->container['zip']) && (mb_strlen($this->container['zip']) > 50)) {
            $invalidProperties[] = "invalid value for 'zip', the character length must be smaller than or equal to 50.";
        }

        if (!is_null($this->container['zip']) && (mb_strlen($this->container['zip']) < 0)) {
            $invalidProperties[] = "invalid value for 'zip', the character length must be bigger than or equal to 0.";
        }

        if (!is_null($this->container['iso_country_code']) && (mb_strlen($this->container['iso_country_code']) > 4)) {
            $invalidProperties[] = "invalid value for 'iso_country_code', the character length must be smaller than or equal to 4.";
        }

        if (!is_null($this->container['iso_country_code']) && (mb_strlen($this->container['iso_country_code']) < 0)) {
            $invalidProperties[] = "invalid value for 'iso_country_code', the character length must be bigger than or equal to 0.";
        }

        if (!is_null($this->container['telephone_itu_country_code']) && (mb_strlen($this->container['telephone_itu_country_code']) > 7)) {
            $invalidProperties[] = "invalid value for 'telephone_itu_country_code', the character length must be smaller than or equal to 7.";
        }

        if (!is_null($this->container['telephone_itu_country_code']) && (mb_strlen($this->container['telephone_itu_country_code']) < 0)) {
            $invalidProperties[] = "invalid value for 'telephone_itu_country_code', the character length must be bigger than or equal to 0.";
        }

        if (!is_null($this->container['telephone_number']) && (mb_strlen($this->container['telephone_number']) > 50)) {
            $invalidProperties[] = "invalid value for 'telephone_number', the character length must be smaller than or equal to 50.";
        }

        if (!is_null($this->container['telephone_number']) && (mb_strlen($this->container['telephone_number']) < 0)) {
            $invalidProperties[] = "invalid value for 'telephone_number', the character length must be bigger than or equal to 0.";
        }

        if (!is_null($this->container['fax_itu_country_code']) && (mb_strlen($this->container['fax_itu_country_code']) > 7)) {
            $invalidProperties[] = "invalid value for 'fax_itu_country_code', the character length must be smaller than or equal to 7.";
        }

        if (!is_null($this->container['fax_itu_country_code']) && (mb_strlen($this->container['fax_itu_country_code']) < 0)) {
            $invalidProperties[] = "invalid value for 'fax_itu_country_code', the character length must be bigger than or equal to 0.";
        }

        if (!is_null($this->container['fax_number']) && (mb_strlen($this->container['fax_number']) > 50)) {
            $invalidProperties[] = "invalid value for 'fax_number', the character length must be smaller than or equal to 50.";
        }

        if (!is_null($this->container['fax_number']) && (mb_strlen($this->container['fax_number']) < 0)) {
            $invalidProperties[] = "invalid value for 'fax_number', the character length must be bigger than or equal to 0.";
        }

        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 id
     *
     * @return int|null
     */
    public function getId()
    {
        return $this->container['id'];
    }

    /**
     * Sets id
     *
     * @param int|null $id primary key
     *
     * @return self
     */
    public function setId($id)
    {
        if (is_null($id)) {
            throw new \InvalidArgumentException('non-nullable id cannot be null');
        }
        $this->container['id'] = $id;

        return $this;
    }

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

    /**
     * Sets customer_id
     *
     * @param int $customer_id id of the associated customer
     *
     * @return self
     */
    public function setCustomerId($customer_id)
    {
        if (is_null($customer_id)) {
            throw new \InvalidArgumentException('non-nullable customer_id cannot be null');
        }
        $this->container['customer_id'] = $customer_id;

        return $this;
    }

    /**
     * Gets contact_type
     *
     * @return string|null
     */
    public function getContactType()
    {
        return $this->container['contact_type'];
    }

    /**
     * Sets contact_type
     *
     * @param string|null $contact_type contact_type
     *
     * @return self
     */
    public function setContactType($contact_type)
    {
        if (is_null($contact_type)) {
            array_push($this->openAPINullablesSetToNull, 'contact_type');
        } else {
            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
            $index = array_search('contact_type', $nullablesSetToNull);
            if ($index !== FALSE) {
                unset($nullablesSetToNull[$index]);
                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
            }
        }
        $this->container['contact_type'] = $contact_type;

        return $this;
    }

    /**
     * Gets email
     *
     * @return string|null
     */
    public function getEmail()
    {
        return $this->container['email'];
    }

    /**
     * Sets email
     *
     * @param string|null $email email
     *
     * @return self
     */
    public function setEmail($email)
    {
        if (is_null($email)) {
            array_push($this->openAPINullablesSetToNull, 'email');
        } else {
            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
            $index = array_search('email', $nullablesSetToNull);
            if ($index !== FALSE) {
                unset($nullablesSetToNull[$index]);
                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
            }
        }
        if (!is_null($email) && (mb_strlen($email) > 255)) {
            throw new \InvalidArgumentException('invalid length for $email when calling CustomerContact., must be smaller than or equal to 255.');
        }
        if (!is_null($email) && (mb_strlen($email) < 0)) {
            throw new \InvalidArgumentException('invalid length for $email when calling CustomerContact., must be bigger than or equal to 0.');
        }

        $this->container['email'] = $email;

        return $this;
    }

    /**
     * Gets title
     *
     * @return string|null
     */
    public function getTitle()
    {
        return $this->container['title'];
    }

    /**
     * Sets title
     *
     * @param string|null $title title
     *
     * @return self
     */
    public function setTitle($title)
    {
        if (is_null($title)) {
            array_push($this->openAPINullablesSetToNull, 'title');
        } else {
            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
            $index = array_search('title', $nullablesSetToNull);
            if ($index !== FALSE) {
                unset($nullablesSetToNull[$index]);
                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
            }
        }
        if (!is_null($title) && (mb_strlen($title) > 15)) {
            throw new \InvalidArgumentException('invalid length for $title when calling CustomerContact., must be smaller than or equal to 15.');
        }
        if (!is_null($title) && (mb_strlen($title) < 0)) {
            throw new \InvalidArgumentException('invalid length for $title when calling CustomerContact., must be bigger than or equal to 0.');
        }

        $this->container['title'] = $title;

        return $this;
    }

    /**
     * Gets first_name
     *
     * @return string|null
     */
    public function getFirstName()
    {
        return $this->container['first_name'];
    }

    /**
     * Sets first_name
     *
     * @param string|null $first_name first_name
     *
     * @return self
     */
    public function setFirstName($first_name)
    {
        if (is_null($first_name)) {
            array_push($this->openAPINullablesSetToNull, 'first_name');
        } else {
            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
            $index = array_search('first_name', $nullablesSetToNull);
            if ($index !== FALSE) {
                unset($nullablesSetToNull[$index]);
                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
            }
        }
        if (!is_null($first_name) && (mb_strlen($first_name) > 50)) {
            throw new \InvalidArgumentException('invalid length for $first_name when calling CustomerContact., must be smaller than or equal to 50.');
        }
        if (!is_null($first_name) && (mb_strlen($first_name) < 0)) {
            throw new \InvalidArgumentException('invalid length for $first_name when calling CustomerContact., must be bigger than or equal to 0.');
        }

        $this->container['first_name'] = $first_name;

        return $this;
    }

    /**
     * Gets last_name
     *
     * @return string|null
     */
    public function getLastName()
    {
        return $this->container['last_name'];
    }

    /**
     * Sets last_name
     *
     * @param string|null $last_name last_name
     *
     * @return self
     */
    public function setLastName($last_name)
    {
        if (is_null($last_name)) {
            array_push($this->openAPINullablesSetToNull, 'last_name');
        } else {
            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
            $index = array_search('last_name', $nullablesSetToNull);
            if ($index !== FALSE) {
                unset($nullablesSetToNull[$index]);
                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
            }
        }
        if (!is_null($last_name) && (mb_strlen($last_name) > 50)) {
            throw new \InvalidArgumentException('invalid length for $last_name when calling CustomerContact., must be smaller than or equal to 50.');
        }
        if (!is_null($last_name) && (mb_strlen($last_name) < 0)) {
            throw new \InvalidArgumentException('invalid length for $last_name when calling CustomerContact., must be bigger than or equal to 0.');
        }

        $this->container['last_name'] = $last_name;

        return $this;
    }

    /**
     * Gets date_of_birth
     *
     * @return \DateTime|null
     */
    public function getDateOfBirth()
    {
        return $this->container['date_of_birth'];
    }

    /**
     * Sets date_of_birth
     *
     * @param \DateTime|null $date_of_birth date_of_birth
     *
     * @return self
     */
    public function setDateOfBirth($date_of_birth)
    {
        if (is_null($date_of_birth)) {
            array_push($this->openAPINullablesSetToNull, 'date_of_birth');
        } else {
            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
            $index = array_search('date_of_birth', $nullablesSetToNull);
            if ($index !== FALSE) {
                unset($nullablesSetToNull[$index]);
                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
            }
        }
        $this->container['date_of_birth'] = $date_of_birth;

        return $this;
    }

    /**
     * Gets company
     *
     * @return string|null
     */
    public function getCompany()
    {
        return $this->container['company'];
    }

    /**
     * Sets company
     *
     * @param string|null $company company
     *
     * @return self
     */
    public function setCompany($company)
    {
        if (is_null($company)) {
            array_push($this->openAPINullablesSetToNull, 'company');
        } else {
            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
            $index = array_search('company', $nullablesSetToNull);
            if ($index !== FALSE) {
                unset($nullablesSetToNull[$index]);
                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
            }
        }
        if (!is_null($company) && (mb_strlen($company) > 50)) {
            throw new \InvalidArgumentException('invalid length for $company when calling CustomerContact., must be smaller than or equal to 50.');
        }
        if (!is_null($company) && (mb_strlen($company) < 0)) {
            throw new \InvalidArgumentException('invalid length for $company when calling CustomerContact., must be bigger than or equal to 0.');
        }

        $this->container['company'] = $company;

        return $this;
    }

    /**
     * Gets address_line1
     *
     * @return string|null
     */
    public function getAddressLine1()
    {
        return $this->container['address_line1'];
    }

    /**
     * Sets address_line1
     *
     * @param string|null $address_line1 address_line1
     *
     * @return self
     */
    public function setAddressLine1($address_line1)
    {
        if (is_null($address_line1)) {
            array_push($this->openAPINullablesSetToNull, 'address_line1');
        } else {
            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
            $index = array_search('address_line1', $nullablesSetToNull);
            if ($index !== FALSE) {
                unset($nullablesSetToNull[$index]);
                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
            }
        }
        if (!is_null($address_line1) && (mb_strlen($address_line1) > 50)) {
            throw new \InvalidArgumentException('invalid length for $address_line1 when calling CustomerContact., must be smaller than or equal to 50.');
        }
        if (!is_null($address_line1) && (mb_strlen($address_line1) < 0)) {
            throw new \InvalidArgumentException('invalid length for $address_line1 when calling CustomerContact., must be bigger than or equal to 0.');
        }

        $this->container['address_line1'] = $address_line1;

        return $this;
    }

    /**
     * Gets address_line2
     *
     * @return string|null
     */
    public function getAddressLine2()
    {
        return $this->container['address_line2'];
    }

    /**
     * Sets address_line2
     *
     * @param string|null $address_line2 address_line2
     *
     * @return self
     */
    public function setAddressLine2($address_line2)
    {
        if (is_null($address_line2)) {
            array_push($this->openAPINullablesSetToNull, 'address_line2');
        } else {
            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
            $index = array_search('address_line2', $nullablesSetToNull);
            if ($index !== FALSE) {
                unset($nullablesSetToNull[$index]);
                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
            }
        }
        if (!is_null($address_line2) && (mb_strlen($address_line2) > 50)) {
            throw new \InvalidArgumentException('invalid length for $address_line2 when calling CustomerContact., must be smaller than or equal to 50.');
        }
        if (!is_null($address_line2) && (mb_strlen($address_line2) < 0)) {
            throw new \InvalidArgumentException('invalid length for $address_line2 when calling CustomerContact., must be bigger than or equal to 0.');
        }

        $this->container['address_line2'] = $address_line2;

        return $this;
    }

    /**
     * Gets address_line3
     *
     * @return string|null
     */
    public function getAddressLine3()
    {
        return $this->container['address_line3'];
    }

    /**
     * Sets address_line3
     *
     * @param string|null $address_line3 address_line3
     *
     * @return self
     */
    public function setAddressLine3($address_line3)
    {
        if (is_null($address_line3)) {
            array_push($this->openAPINullablesSetToNull, 'address_line3');
        } else {
            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
            $index = array_search('address_line3', $nullablesSetToNull);
            if ($index !== FALSE) {
                unset($nullablesSetToNull[$index]);
                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
            }
        }
        if (!is_null($address_line3) && (mb_strlen($address_line3) > 50)) {
            throw new \InvalidArgumentException('invalid length for $address_line3 when calling CustomerContact., must be smaller than or equal to 50.');
        }
        if (!is_null($address_line3) && (mb_strlen($address_line3) < 0)) {
            throw new \InvalidArgumentException('invalid length for $address_line3 when calling CustomerContact., must be bigger than or equal to 0.');
        }

        $this->container['address_line3'] = $address_line3;

        return $this;
    }

    /**
     * Gets address_line4
     *
     * @return string|null
     */
    public function getAddressLine4()
    {
        return $this->container['address_line4'];
    }

    /**
     * Sets address_line4
     *
     * @param string|null $address_line4 address_line4
     *
     * @return self
     */
    public function setAddressLine4($address_line4)
    {
        if (is_null($address_line4)) {
            array_push($this->openAPINullablesSetToNull, 'address_line4');
        } else {
            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
            $index = array_search('address_line4', $nullablesSetToNull);
            if ($index !== FALSE) {
                unset($nullablesSetToNull[$index]);
                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
            }
        }
        if (!is_null($address_line4) && (mb_strlen($address_line4) > 50)) {
            throw new \InvalidArgumentException('invalid length for $address_line4 when calling CustomerContact., must be smaller than or equal to 50.');
        }
        if (!is_null($address_line4) && (mb_strlen($address_line4) < 0)) {
            throw new \InvalidArgumentException('invalid length for $address_line4 when calling CustomerContact., must be bigger than or equal to 0.');
        }

        $this->container['address_line4'] = $address_line4;

        return $this;
    }

    /**
     * Gets city
     *
     * @return string|null
     */
    public function getCity()
    {
        return $this->container['city'];
    }

    /**
     * Sets city
     *
     * @param string|null $city city
     *
     * @return self
     */
    public function setCity($city)
    {
        if (is_null($city)) {
            array_push($this->openAPINullablesSetToNull, 'city');
        } else {
            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
            $index = array_search('city', $nullablesSetToNull);
            if ($index !== FALSE) {
                unset($nullablesSetToNull[$index]);
                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
            }
        }
        if (!is_null($city) && (mb_strlen($city) > 50)) {
            throw new \InvalidArgumentException('invalid length for $city when calling CustomerContact., must be smaller than or equal to 50.');
        }
        if (!is_null($city) && (mb_strlen($city) < 0)) {
            throw new \InvalidArgumentException('invalid length for $city when calling CustomerContact., must be bigger than or equal to 0.');
        }

        $this->container['city'] = $city;

        return $this;
    }

    /**
     * Gets territory
     *
     * @return string|null
     */
    public function getTerritory()
    {
        return $this->container['territory'];
    }

    /**
     * Sets territory
     *
     * @param string|null $territory territory
     *
     * @return self
     */
    public function setTerritory($territory)
    {
        if (is_null($territory)) {
            array_push($this->openAPINullablesSetToNull, 'territory');
        } else {
            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
            $index = array_search('territory', $nullablesSetToNull);
            if ($index !== FALSE) {
                unset($nullablesSetToNull[$index]);
                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
            }
        }
        if (!is_null($territory) && (mb_strlen($territory) > 50)) {
            throw new \InvalidArgumentException('invalid length for $territory when calling CustomerContact., must be smaller than or equal to 50.');
        }
        if (!is_null($territory) && (mb_strlen($territory) < 0)) {
            throw new \InvalidArgumentException('invalid length for $territory when calling CustomerContact., must be bigger than or equal to 0.');
        }

        $this->container['territory'] = $territory;

        return $this;
    }

    /**
     * Gets zip
     *
     * @return string|null
     */
    public function getZip()
    {
        return $this->container['zip'];
    }

    /**
     * Sets zip
     *
     * @param string|null $zip zip
     *
     * @return self
     */
    public function setZip($zip)
    {
        if (is_null($zip)) {
            array_push($this->openAPINullablesSetToNull, 'zip');
        } else {
            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
            $index = array_search('zip', $nullablesSetToNull);
            if ($index !== FALSE) {
                unset($nullablesSetToNull[$index]);
                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
            }
        }
        if (!is_null($zip) && (mb_strlen($zip) > 50)) {
            throw new \InvalidArgumentException('invalid length for $zip when calling CustomerContact., must be smaller than or equal to 50.');
        }
        if (!is_null($zip) && (mb_strlen($zip) < 0)) {
            throw new \InvalidArgumentException('invalid length for $zip when calling CustomerContact., must be bigger than or equal to 0.');
        }

        $this->container['zip'] = $zip;

        return $this;
    }

    /**
     * Gets iso_country_code
     *
     * @return string|null
     */
    public function getIsoCountryCode()
    {
        return $this->container['iso_country_code'];
    }

    /**
     * Sets iso_country_code
     *
     * @param string|null $iso_country_code iso_country_code
     *
     * @return self
     */
    public function setIsoCountryCode($iso_country_code)
    {
        if (is_null($iso_country_code)) {
            array_push($this->openAPINullablesSetToNull, 'iso_country_code');
        } else {
            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
            $index = array_search('iso_country_code', $nullablesSetToNull);
            if ($index !== FALSE) {
                unset($nullablesSetToNull[$index]);
                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
            }
        }
        if (!is_null($iso_country_code) && (mb_strlen($iso_country_code) > 4)) {
            throw new \InvalidArgumentException('invalid length for $iso_country_code when calling CustomerContact., must be smaller than or equal to 4.');
        }
        if (!is_null($iso_country_code) && (mb_strlen($iso_country_code) < 0)) {
            throw new \InvalidArgumentException('invalid length for $iso_country_code when calling CustomerContact., must be bigger than or equal to 0.');
        }

        $this->container['iso_country_code'] = $iso_country_code;

        return $this;
    }

    /**
     * Gets telephone_itu_country_code
     *
     * @return string|null
     */
    public function getTelephoneItuCountryCode()
    {
        return $this->container['telephone_itu_country_code'];
    }

    /**
     * Sets telephone_itu_country_code
     *
     * @param string|null $telephone_itu_country_code telephone_itu_country_code
     *
     * @return self
     */
    public function setTelephoneItuCountryCode($telephone_itu_country_code)
    {
        if (is_null($telephone_itu_country_code)) {
            array_push($this->openAPINullablesSetToNull, 'telephone_itu_country_code');
        } else {
            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
            $index = array_search('telephone_itu_country_code', $nullablesSetToNull);
            if ($index !== FALSE) {
                unset($nullablesSetToNull[$index]);
                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
            }
        }
        if (!is_null($telephone_itu_country_code) && (mb_strlen($telephone_itu_country_code) > 7)) {
            throw new \InvalidArgumentException('invalid length for $telephone_itu_country_code when calling CustomerContact., must be smaller than or equal to 7.');
        }
        if (!is_null($telephone_itu_country_code) && (mb_strlen($telephone_itu_country_code) < 0)) {
            throw new \InvalidArgumentException('invalid length for $telephone_itu_country_code when calling CustomerContact., must be bigger than or equal to 0.');
        }

        $this->container['telephone_itu_country_code'] = $telephone_itu_country_code;

        return $this;
    }

    /**
     * Gets telephone_number
     *
     * @return string|null
     */
    public function getTelephoneNumber()
    {
        return $this->container['telephone_number'];
    }

    /**
     * Sets telephone_number
     *
     * @param string|null $telephone_number telephone_number
     *
     * @return self
     */
    public function setTelephoneNumber($telephone_number)
    {
        if (is_null($telephone_number)) {
            array_push($this->openAPINullablesSetToNull, 'telephone_number');
        } else {
            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
            $index = array_search('telephone_number', $nullablesSetToNull);
            if ($index !== FALSE) {
                unset($nullablesSetToNull[$index]);
                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
            }
        }
        if (!is_null($telephone_number) && (mb_strlen($telephone_number) > 50)) {
            throw new \InvalidArgumentException('invalid length for $telephone_number when calling CustomerContact., must be smaller than or equal to 50.');
        }
        if (!is_null($telephone_number) && (mb_strlen($telephone_number) < 0)) {
            throw new \InvalidArgumentException('invalid length for $telephone_number when calling CustomerContact., must be bigger than or equal to 0.');
        }

        $this->container['telephone_number'] = $telephone_number;

        return $this;
    }

    /**
     * Gets fax_itu_country_code
     *
     * @return string|null
     */
    public function getFaxItuCountryCode()
    {
        return $this->container['fax_itu_country_code'];
    }

    /**
     * Sets fax_itu_country_code
     *
     * @param string|null $fax_itu_country_code fax_itu_country_code
     *
     * @return self
     */
    public function setFaxItuCountryCode($fax_itu_country_code)
    {
        if (is_null($fax_itu_country_code)) {
            array_push($this->openAPINullablesSetToNull, 'fax_itu_country_code');
        } else {
            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
            $index = array_search('fax_itu_country_code', $nullablesSetToNull);
            if ($index !== FALSE) {
                unset($nullablesSetToNull[$index]);
                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
            }
        }
        if (!is_null($fax_itu_country_code) && (mb_strlen($fax_itu_country_code) > 7)) {
            throw new \InvalidArgumentException('invalid length for $fax_itu_country_code when calling CustomerContact., must be smaller than or equal to 7.');
        }
        if (!is_null($fax_itu_country_code) && (mb_strlen($fax_itu_country_code) < 0)) {
            throw new \InvalidArgumentException('invalid length for $fax_itu_country_code when calling CustomerContact., must be bigger than or equal to 0.');
        }

        $this->container['fax_itu_country_code'] = $fax_itu_country_code;

        return $this;
    }

    /**
     * Gets fax_number
     *
     * @return string|null
     */
    public function getFaxNumber()
    {
        return $this->container['fax_number'];
    }

    /**
     * Sets fax_number
     *
     * @param string|null $fax_number fax_number
     *
     * @return self
     */
    public function setFaxNumber($fax_number)
    {
        if (is_null($fax_number)) {
            array_push($this->openAPINullablesSetToNull, 'fax_number');
        } else {
            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
            $index = array_search('fax_number', $nullablesSetToNull);
            if ($index !== FALSE) {
                unset($nullablesSetToNull[$index]);
                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
            }
        }
        if (!is_null($fax_number) && (mb_strlen($fax_number) > 50)) {
            throw new \InvalidArgumentException('invalid length for $fax_number when calling CustomerContact., must be smaller than or equal to 50.');
        }
        if (!is_null($fax_number) && (mb_strlen($fax_number) < 0)) {
            throw new \InvalidArgumentException('invalid length for $fax_number when calling CustomerContact., must be bigger than or equal to 0.');
        }

        $this->container['fax_number'] = $fax_number;

        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));
    }
}


