<?php 
// phpcs:ignoreFile WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents
// phpcs:ignoreFile WordPress.WP.AlternativeFunctions.file_system_operations_fwrite
// phpcs:ignoreFile WordPress.WP.AlternativeFunctions.file_system_operations_fclose
// phpcs:ignoreFile WordPress.WP.AlternativeFunctions.file_system_operations_fopen
// phpcs:ignoreFile WordPress.Security.EscapeOutput.ExceptionNotEscaped            

/**
 * EpsApiMyApi2WebModelsShipmentBatchCashOnDeliveryFeatureModel
 *
 * PHP version 7.4
 *
 * @category Class
 * @package  PPLCZCPL
 * @author   OpenAPI Generator team
 * @link     https://openapi-generator.tech
 */

/**
 * CPL
 *
 * **Changelog**    * 2024-08-22 - SPRJ-13791 - validace PRTE / PRBC externích čísel - nelze použít najednou    - /shipment/batch    * 2024-07-01 - SPRJ-13838 - přidání    - /customer/address    * 2023-11-23 - SPRJ-12703 - CPL - /shipment - timestamp    - /shipment - Rozšíření výstupu o LastUpdateDate.    * 2023-07-13 - SPRJ-11888 - přidání    - /codelist/status - číselník statusů    * 2023-07-13 - SPRJ-11953 - přidání    - /order/cancel - storno objednávky
 *
 * The version of the OpenAPI document: v1
 * Generated by: https://openapi-generator.tech
 * OpenAPI Generator version: 6.0.1
 */

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

namespace PPLCZCPL\Model;

use \ArrayAccess;
use \PPLCZCPL\ObjectSerializer;

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

    /**
      * The original name of the model.
      *
      * @var string
      */
    protected static $openAPIModelName = 'Eps.Api.MyApi2.Web.Models.ShipmentBatch.CashOnDeliveryFeatureModel';

    /**
      * Array of property to type mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $openAPITypes = [
        'iban' => 'string',
        'swift' => 'string',
        'spec_symbol' => 'string',
        'account' => 'string',
        'account_pre' => 'string',
        'bank_code' => 'string',
        'cod_price' => 'double',
        'cod_currency' => 'string',
        'cod_var_sym' => '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 = [
        'iban' => null,
        'swift' => null,
        'spec_symbol' => null,
        'account' => null,
        'account_pre' => null,
        'bank_code' => null,
        'cod_price' => 'double',
        'cod_currency' => null,
        'cod_var_sym' => null
    ];

    /**
     * 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 = [
        'iban' => 'iban',
        'swift' => 'swift',
        'spec_symbol' => 'specSymbol',
        'account' => 'account',
        'account_pre' => 'accountPre',
        'bank_code' => 'bankCode',
        'cod_price' => 'codPrice',
        'cod_currency' => 'codCurrency',
        'cod_var_sym' => 'codVarSym'
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @var string[]
     */
    protected static $setters = [
        'iban' => 'setIban',
        'swift' => 'setSwift',
        'spec_symbol' => 'setSpecSymbol',
        'account' => 'setAccount',
        'account_pre' => 'setAccountPre',
        'bank_code' => 'setBankCode',
        'cod_price' => 'setCodPrice',
        'cod_currency' => 'setCodCurrency',
        'cod_var_sym' => 'setCodVarSym'
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @var string[]
     */
    protected static $getters = [
        'iban' => 'getIban',
        'swift' => 'getSwift',
        'spec_symbol' => 'getSpecSymbol',
        'account' => 'getAccount',
        'account_pre' => 'getAccountPre',
        'bank_code' => 'getBankCode',
        'cod_price' => 'getCodPrice',
        'cod_currency' => 'getCodCurrency',
        'cod_var_sym' => 'getCodVarSym'
    ];

    /**
     * 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[] $data Associated array of property values
     *                      initializing the model
     */
    public function __construct(?array $data = null)
    {
        $this->container['iban'] = $data['iban'] ?? null;
        $this->container['swift'] = $data['swift'] ?? null;
        $this->container['spec_symbol'] = $data['spec_symbol'] ?? null;
        $this->container['account'] = $data['account'] ?? null;
        $this->container['account_pre'] = $data['account_pre'] ?? null;
        $this->container['bank_code'] = $data['bank_code'] ?? null;
        $this->container['cod_price'] = $data['cod_price'] ?? null;
        $this->container['cod_currency'] = $data['cod_currency'] ?? null;
        $this->container['cod_var_sym'] = $data['cod_var_sym'] ?? null;
    }

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

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

        if ($this->container['cod_price'] === null) {
            $invalidProperties[] = "'cod_price' can't be null";
        }
        if (($this->container['cod_price'] < 0)) {
            $invalidProperties[] = "invalid value for 'cod_price', must be bigger than or equal to 0.";
        }

        if ($this->container['cod_currency'] === null) {
            $invalidProperties[] = "'cod_currency' can't be null";
        }
        if ((mb_strlen($this->container['cod_currency']) < 1)) {
            $invalidProperties[] = "invalid value for 'cod_currency', the character length must be bigger than or equal to 1.";
        }

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

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

        if (!preg_match("/^\\d+/", $this->container['cod_var_sym'])) {
            $invalidProperties[] = "invalid value for 'cod_var_sym', must be conform to the pattern /^\\d+/.";
        }

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

    /**
     * Sets iban
     *
     * @param string|null $iban IBAN  Délka: 50
     *
     * @return self
     */
    public function setIban($iban)
    {
        $this->container['iban'] = $iban;

        return $this;
    }

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

    /**
     * Sets swift
     *
     * @param string|null $swift Swift  Délka: 50
     *
     * @return self
     */
    public function setSwift($swift)
    {
        $this->container['swift'] = $swift;

        return $this;
    }

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

    /**
     * Sets spec_symbol
     *
     * @param string|null $spec_symbol Specifický symbol Délka: 6
     *
     * @return self
     */
    public function setSpecSymbol($spec_symbol)
    {
        if (!is_null($spec_symbol) && (mb_strlen($spec_symbol) > 6)) {
            throw new \InvalidArgumentException('invalid length for $spec_symbol when calling EpsApiMyApi2WebModelsShipmentBatchCashOnDeliveryFeatureModel., must be smaller than or equal to 6.');
        }

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

        return $this;
    }

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

    /**
     * Sets account
     *
     * @param string|null $account Číslo bankovního účtu Délka: 10
     *
     * @return self
     */
    public function setAccount($account)
    {
        $this->container['account'] = $account;

        return $this;
    }

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

    /**
     * Sets account_pre
     *
     * @param string|null $account_pre Před číslo bankovního účtu Délka: 10
     *
     * @return self
     */
    public function setAccountPre($account_pre)
    {
        $this->container['account_pre'] = $account_pre;

        return $this;
    }

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

    /**
     * Sets bank_code
     *
     * @param string|null $bank_code Kód banky Délka: 4
     *
     * @return self
     */
    public function setBankCode($bank_code)
    {
        $this->container['bank_code'] = $bank_code;

        return $this;
    }

    /**
     * Gets cod_price
     *
     * @return double
     */
    public function getCodPrice()
    {
        return $this->container['cod_price'];
    }

    /**
     * Sets cod_price
     *
     * @param double $cod_price Částka dobírky.  1. Pokud je CodPrice vyplněné, pak musí být vyplněno i CodCurrency. Délka: 12.4  2. Částka nesmí být záporná.  3. max limity - /codelist/servicePriceLimit
     *
     * @return self
     */
    public function setCodPrice($cod_price)
    {

        if (($cod_price < 0)) {
            throw new \InvalidArgumentException('invalid value for $cod_price when calling EpsApiMyApi2WebModelsShipmentBatchCashOnDeliveryFeatureModel., must be bigger than or equal to 0.');
        }

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

        return $this;
    }

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

    /**
     * Sets cod_currency
     *
     * @param string $cod_currency Měna dobírky, povolené měny - /codelist/currency Délka: 3
     *
     * @return self
     */
    public function setCodCurrency($cod_currency)
    {

        if ((mb_strlen($cod_currency) < 1)) {
            throw new \InvalidArgumentException('invalid length for $cod_currency when calling EpsApiMyApi2WebModelsShipmentBatchCashOnDeliveryFeatureModel., must be bigger than or equal to 1.');
        }

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

        return $this;
    }

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

    /**
     * Sets cod_var_sym
     *
     * @param string $cod_var_sym Variabilní symbol dobírky. POUZE čísla Délka: 30
     *
     * @return self
     */
    public function setCodVarSym($cod_var_sym)
    {
        if ((mb_strlen($cod_var_sym) > 10)) {
            throw new \InvalidArgumentException('invalid length for $cod_var_sym when calling EpsApiMyApi2WebModelsShipmentBatchCashOnDeliveryFeatureModel., must be smaller than or equal to 10.');
        }
        if ((mb_strlen($cod_var_sym) < 1)) {
            throw new \InvalidArgumentException('invalid length for $cod_var_sym when calling EpsApiMyApi2WebModelsShipmentBatchCashOnDeliveryFeatureModel., must be bigger than or equal to 1.');
        }
        if ((!preg_match("/^\\d+/", $cod_var_sym))) {
            throw new \InvalidArgumentException("invalid value for $cod_var_sym when calling EpsApiMyApi2WebModelsShipmentBatchCashOnDeliveryFeatureModel., must conform to the pattern /^\\d+/.");
        }

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

        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 ObjectSerializerPpl::sanitizeForSerialization($this);
    }

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

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


