<?php

/**
 * Management API
 *
 * The version of the OpenAPI document: 3
 * 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 Adyen\Model\Management;

use \ArrayAccess;
use Adyen\Model\Management\ObjectSerializer;

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

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

    /**
      * Array of property to type mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $openAPITypes = [
        'accel' => '\Adyen\Model\Management\AccelInfo',
        'bcmc' => '\Adyen\Model\Management\BcmcInfo',
        'cartesBancaires' => '\Adyen\Model\Management\CartesBancairesInfo',
        'countries' => 'string[]',
        'cup' => '\Adyen\Model\Management\GenericPmWithTdiInfo',
        'currencies' => 'string[]',
        'customRoutingFlags' => 'string[]',
        'diners' => '\Adyen\Model\Management\GenericPmWithTdiInfo',
        'discover' => '\Adyen\Model\Management\GenericPmWithTdiInfo',
        'eftDirectdebitCA' => '\Adyen\Model\Management\GenericPmWithTdiInfo',
        'eftposAustralia' => '\Adyen\Model\Management\GenericPmWithTdiInfo',
        'enabled' => 'bool',
        'girocard' => '\Adyen\Model\Management\GenericPmWithTdiInfo',
        'ideal' => '\Adyen\Model\Management\GenericPmWithTdiInfo',
        'interacCard' => '\Adyen\Model\Management\GenericPmWithTdiInfo',
        'jcb' => '\Adyen\Model\Management\GenericPmWithTdiInfo',
        'maestro' => '\Adyen\Model\Management\GenericPmWithTdiInfo',
        'mc' => '\Adyen\Model\Management\GenericPmWithTdiInfo',
        'nyce' => '\Adyen\Model\Management\NyceInfo',
        'pulse' => '\Adyen\Model\Management\PulseInfo',
        'star' => '\Adyen\Model\Management\StarInfo',
        'storeId' => 'string',
        'storeIds' => 'string[]',
        'visa' => '\Adyen\Model\Management\GenericPmWithTdiInfo'
    ];

    /**
      * 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 = [
        'accel' => null,
        'bcmc' => null,
        'cartesBancaires' => null,
        'countries' => null,
        'cup' => null,
        'currencies' => null,
        'customRoutingFlags' => null,
        'diners' => null,
        'discover' => null,
        'eftDirectdebitCA' => null,
        'eftposAustralia' => null,
        'enabled' => null,
        'girocard' => null,
        'ideal' => null,
        'interacCard' => null,
        'jcb' => null,
        'maestro' => null,
        'mc' => null,
        'nyce' => null,
        'pulse' => null,
        'star' => null,
        'storeId' => null,
        'storeIds' => null,
        'visa' => null
    ];

    /**
      * Array of nullable properties. Used for (de)serialization
      *
      * @var boolean[]
      */
    protected static $openAPINullables = [
        'accel' => false,
        'bcmc' => false,
        'cartesBancaires' => false,
        'countries' => false,
        'cup' => false,
        'currencies' => false,
        'customRoutingFlags' => false,
        'diners' => false,
        'discover' => false,
        'eftDirectdebitCA' => false,
        'eftposAustralia' => false,
        'enabled' => false,
        'girocard' => false,
        'ideal' => false,
        'interacCard' => false,
        'jcb' => false,
        'maestro' => false,
        'mc' => false,
        'nyce' => false,
        'pulse' => false,
        'star' => false,
        'storeId' => false,
        'storeIds' => false,
        'visa' => false
    ];

    /**
      * If a nullable field gets set to null, insert it here
      *
      * @var boolean[]
      */
    protected $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 = [
        'accel' => 'accel',
        'bcmc' => 'bcmc',
        'cartesBancaires' => 'cartesBancaires',
        'countries' => 'countries',
        'cup' => 'cup',
        'currencies' => 'currencies',
        'customRoutingFlags' => 'customRoutingFlags',
        'diners' => 'diners',
        'discover' => 'discover',
        'eftDirectdebitCA' => 'eft_directdebit_CA',
        'eftposAustralia' => 'eftpos_australia',
        'enabled' => 'enabled',
        'girocard' => 'girocard',
        'ideal' => 'ideal',
        'interacCard' => 'interac_card',
        'jcb' => 'jcb',
        'maestro' => 'maestro',
        'mc' => 'mc',
        'nyce' => 'nyce',
        'pulse' => 'pulse',
        'star' => 'star',
        'storeId' => 'storeId',
        'storeIds' => 'storeIds',
        'visa' => 'visa'
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @var string[]
     */
    protected static $setters = [
        'accel' => 'setAccel',
        'bcmc' => 'setBcmc',
        'cartesBancaires' => 'setCartesBancaires',
        'countries' => 'setCountries',
        'cup' => 'setCup',
        'currencies' => 'setCurrencies',
        'customRoutingFlags' => 'setCustomRoutingFlags',
        'diners' => 'setDiners',
        'discover' => 'setDiscover',
        'eftDirectdebitCA' => 'setEftDirectdebitCA',
        'eftposAustralia' => 'setEftposAustralia',
        'enabled' => 'setEnabled',
        'girocard' => 'setGirocard',
        'ideal' => 'setIdeal',
        'interacCard' => 'setInteracCard',
        'jcb' => 'setJcb',
        'maestro' => 'setMaestro',
        'mc' => 'setMc',
        'nyce' => 'setNyce',
        'pulse' => 'setPulse',
        'star' => 'setStar',
        'storeId' => 'setStoreId',
        'storeIds' => 'setStoreIds',
        'visa' => 'setVisa'
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @var string[]
     */
    protected static $getters = [
        'accel' => 'getAccel',
        'bcmc' => 'getBcmc',
        'cartesBancaires' => 'getCartesBancaires',
        'countries' => 'getCountries',
        'cup' => 'getCup',
        'currencies' => 'getCurrencies',
        'customRoutingFlags' => 'getCustomRoutingFlags',
        'diners' => 'getDiners',
        'discover' => 'getDiscover',
        'eftDirectdebitCA' => 'getEftDirectdebitCA',
        'eftposAustralia' => 'getEftposAustralia',
        'enabled' => 'getEnabled',
        'girocard' => 'getGirocard',
        'ideal' => 'getIdeal',
        'interacCard' => 'getInteracCard',
        'jcb' => 'getJcb',
        'maestro' => 'getMaestro',
        'mc' => 'getMc',
        'nyce' => 'getNyce',
        'pulse' => 'getPulse',
        'star' => 'getStar',
        'storeId' => 'getStoreId',
        'storeIds' => 'getStoreIds',
        'visa' => 'getVisa'
    ];

    /**
     * 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->setIfExists('accel', $data ?? [], null);
        $this->setIfExists('bcmc', $data ?? [], null);
        $this->setIfExists('cartesBancaires', $data ?? [], null);
        $this->setIfExists('countries', $data ?? [], null);
        $this->setIfExists('cup', $data ?? [], null);
        $this->setIfExists('currencies', $data ?? [], null);
        $this->setIfExists('customRoutingFlags', $data ?? [], null);
        $this->setIfExists('diners', $data ?? [], null);
        $this->setIfExists('discover', $data ?? [], null);
        $this->setIfExists('eftDirectdebitCA', $data ?? [], null);
        $this->setIfExists('eftposAustralia', $data ?? [], null);
        $this->setIfExists('enabled', $data ?? [], null);
        $this->setIfExists('girocard', $data ?? [], null);
        $this->setIfExists('ideal', $data ?? [], null);
        $this->setIfExists('interacCard', $data ?? [], null);
        $this->setIfExists('jcb', $data ?? [], null);
        $this->setIfExists('maestro', $data ?? [], null);
        $this->setIfExists('mc', $data ?? [], null);
        $this->setIfExists('nyce', $data ?? [], null);
        $this->setIfExists('pulse', $data ?? [], null);
        $this->setIfExists('star', $data ?? [], null);
        $this->setIfExists('storeId', $data ?? [], null);
        $this->setIfExists('storeIds', $data ?? [], null);
        $this->setIfExists('visa', $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 = [];

        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 accel
     *
     * @return \Adyen\Model\Management\AccelInfo|null
     */
    public function getAccel()
    {
        return $this->container['accel'];
    }

    /**
     * Sets accel
     *
     * @param \Adyen\Model\Management\AccelInfo|null $accel accel
     *
     * @return self
     */
    public function setAccel($accel)
    {
        $this->container['accel'] = $accel;

        return $this;
    }

    /**
     * Gets bcmc
     *
     * @return \Adyen\Model\Management\BcmcInfo|null
     */
    public function getBcmc()
    {
        return $this->container['bcmc'];
    }

    /**
     * Sets bcmc
     *
     * @param \Adyen\Model\Management\BcmcInfo|null $bcmc bcmc
     *
     * @return self
     */
    public function setBcmc($bcmc)
    {
        $this->container['bcmc'] = $bcmc;

        return $this;
    }

    /**
     * Gets cartesBancaires
     *
     * @return \Adyen\Model\Management\CartesBancairesInfo|null
     */
    public function getCartesBancaires()
    {
        return $this->container['cartesBancaires'];
    }

    /**
     * Sets cartesBancaires
     *
     * @param \Adyen\Model\Management\CartesBancairesInfo|null $cartesBancaires cartesBancaires
     *
     * @return self
     */
    public function setCartesBancaires($cartesBancaires)
    {
        $this->container['cartesBancaires'] = $cartesBancaires;

        return $this;
    }

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

    /**
     * Sets countries
     *
     * @param string[]|null $countries The list of countries where a payment method is available. By default, all countries supported by the payment method.
     *
     * @return self
     */
    public function setCountries($countries)
    {
        $this->container['countries'] = $countries;

        return $this;
    }

    /**
     * Gets cup
     *
     * @return \Adyen\Model\Management\GenericPmWithTdiInfo|null
     */
    public function getCup()
    {
        return $this->container['cup'];
    }

    /**
     * Sets cup
     *
     * @param \Adyen\Model\Management\GenericPmWithTdiInfo|null $cup cup
     *
     * @return self
     */
    public function setCup($cup)
    {
        $this->container['cup'] = $cup;

        return $this;
    }

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

    /**
     * Sets currencies
     *
     * @param string[]|null $currencies The list of currencies that a payment method supports. By default, all currencies supported by the payment method.
     *
     * @return self
     */
    public function setCurrencies($currencies)
    {
        $this->container['currencies'] = $currencies;

        return $this;
    }

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

    /**
     * Sets customRoutingFlags
     *
     * @param string[]|null $customRoutingFlags Custom routing flags for acquirer routing.
     *
     * @return self
     */
    public function setCustomRoutingFlags($customRoutingFlags)
    {
        $this->container['customRoutingFlags'] = $customRoutingFlags;

        return $this;
    }

    /**
     * Gets diners
     *
     * @return \Adyen\Model\Management\GenericPmWithTdiInfo|null
     */
    public function getDiners()
    {
        return $this->container['diners'];
    }

    /**
     * Sets diners
     *
     * @param \Adyen\Model\Management\GenericPmWithTdiInfo|null $diners diners
     *
     * @return self
     */
    public function setDiners($diners)
    {
        $this->container['diners'] = $diners;

        return $this;
    }

    /**
     * Gets discover
     *
     * @return \Adyen\Model\Management\GenericPmWithTdiInfo|null
     */
    public function getDiscover()
    {
        return $this->container['discover'];
    }

    /**
     * Sets discover
     *
     * @param \Adyen\Model\Management\GenericPmWithTdiInfo|null $discover discover
     *
     * @return self
     */
    public function setDiscover($discover)
    {
        $this->container['discover'] = $discover;

        return $this;
    }

    /**
     * Gets eftDirectdebitCA
     *
     * @return \Adyen\Model\Management\GenericPmWithTdiInfo|null
     */
    public function getEftDirectdebitCA()
    {
        return $this->container['eftDirectdebitCA'];
    }

    /**
     * Sets eftDirectdebitCA
     *
     * @param \Adyen\Model\Management\GenericPmWithTdiInfo|null $eftDirectdebitCA eftDirectdebitCA
     *
     * @return self
     */
    public function setEftDirectdebitCA($eftDirectdebitCA)
    {
        $this->container['eftDirectdebitCA'] = $eftDirectdebitCA;

        return $this;
    }

    /**
     * Gets eftposAustralia
     *
     * @return \Adyen\Model\Management\GenericPmWithTdiInfo|null
     */
    public function getEftposAustralia()
    {
        return $this->container['eftposAustralia'];
    }

    /**
     * Sets eftposAustralia
     *
     * @param \Adyen\Model\Management\GenericPmWithTdiInfo|null $eftposAustralia eftposAustralia
     *
     * @return self
     */
    public function setEftposAustralia($eftposAustralia)
    {
        $this->container['eftposAustralia'] = $eftposAustralia;

        return $this;
    }

    /**
     * Gets enabled
     *
     * @return bool|null
     */
    public function getEnabled()
    {
        return $this->container['enabled'];
    }

    /**
     * Sets enabled
     *
     * @param bool|null $enabled Indicates whether the payment method is enabled (**true**) or disabled (**false**).
     *
     * @return self
     */
    public function setEnabled($enabled)
    {
        $this->container['enabled'] = $enabled;

        return $this;
    }

    /**
     * Gets girocard
     *
     * @return \Adyen\Model\Management\GenericPmWithTdiInfo|null
     */
    public function getGirocard()
    {
        return $this->container['girocard'];
    }

    /**
     * Sets girocard
     *
     * @param \Adyen\Model\Management\GenericPmWithTdiInfo|null $girocard girocard
     *
     * @return self
     */
    public function setGirocard($girocard)
    {
        $this->container['girocard'] = $girocard;

        return $this;
    }

    /**
     * Gets ideal
     *
     * @return \Adyen\Model\Management\GenericPmWithTdiInfo|null
     */
    public function getIdeal()
    {
        return $this->container['ideal'];
    }

    /**
     * Sets ideal
     *
     * @param \Adyen\Model\Management\GenericPmWithTdiInfo|null $ideal ideal
     *
     * @return self
     */
    public function setIdeal($ideal)
    {
        $this->container['ideal'] = $ideal;

        return $this;
    }

    /**
     * Gets interacCard
     *
     * @return \Adyen\Model\Management\GenericPmWithTdiInfo|null
     */
    public function getInteracCard()
    {
        return $this->container['interacCard'];
    }

    /**
     * Sets interacCard
     *
     * @param \Adyen\Model\Management\GenericPmWithTdiInfo|null $interacCard interacCard
     *
     * @return self
     */
    public function setInteracCard($interacCard)
    {
        $this->container['interacCard'] = $interacCard;

        return $this;
    }

    /**
     * Gets jcb
     *
     * @return \Adyen\Model\Management\GenericPmWithTdiInfo|null
     */
    public function getJcb()
    {
        return $this->container['jcb'];
    }

    /**
     * Sets jcb
     *
     * @param \Adyen\Model\Management\GenericPmWithTdiInfo|null $jcb jcb
     *
     * @return self
     */
    public function setJcb($jcb)
    {
        $this->container['jcb'] = $jcb;

        return $this;
    }

    /**
     * Gets maestro
     *
     * @return \Adyen\Model\Management\GenericPmWithTdiInfo|null
     */
    public function getMaestro()
    {
        return $this->container['maestro'];
    }

    /**
     * Sets maestro
     *
     * @param \Adyen\Model\Management\GenericPmWithTdiInfo|null $maestro maestro
     *
     * @return self
     */
    public function setMaestro($maestro)
    {
        $this->container['maestro'] = $maestro;

        return $this;
    }

    /**
     * Gets mc
     *
     * @return \Adyen\Model\Management\GenericPmWithTdiInfo|null
     */
    public function getMc()
    {
        return $this->container['mc'];
    }

    /**
     * Sets mc
     *
     * @param \Adyen\Model\Management\GenericPmWithTdiInfo|null $mc mc
     *
     * @return self
     */
    public function setMc($mc)
    {
        $this->container['mc'] = $mc;

        return $this;
    }

    /**
     * Gets nyce
     *
     * @return \Adyen\Model\Management\NyceInfo|null
     */
    public function getNyce()
    {
        return $this->container['nyce'];
    }

    /**
     * Sets nyce
     *
     * @param \Adyen\Model\Management\NyceInfo|null $nyce nyce
     *
     * @return self
     */
    public function setNyce($nyce)
    {
        $this->container['nyce'] = $nyce;

        return $this;
    }

    /**
     * Gets pulse
     *
     * @return \Adyen\Model\Management\PulseInfo|null
     */
    public function getPulse()
    {
        return $this->container['pulse'];
    }

    /**
     * Sets pulse
     *
     * @param \Adyen\Model\Management\PulseInfo|null $pulse pulse
     *
     * @return self
     */
    public function setPulse($pulse)
    {
        $this->container['pulse'] = $pulse;

        return $this;
    }

    /**
     * Gets star
     *
     * @return \Adyen\Model\Management\StarInfo|null
     */
    public function getStar()
    {
        return $this->container['star'];
    }

    /**
     * Sets star
     *
     * @param \Adyen\Model\Management\StarInfo|null $star star
     *
     * @return self
     */
    public function setStar($star)
    {
        $this->container['star'] = $star;

        return $this;
    }

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

    /**
     * Sets storeId
     *
     * @param string|null $storeId The store for this payment method
     *
     * @return self
     */
    public function setStoreId($storeId)
    {
        $this->container['storeId'] = $storeId;

        return $this;
    }

    /**
     * Gets storeIds
     *
     * @return string[]|null
     * @deprecated since Management API v3. "Use `storeId` instead. Only one store per payment method is allowed."
     */
    public function getStoreIds()
    {
        return $this->container['storeIds'];
    }

    /**
     * Sets storeIds
     *
     * @param string[]|null $storeIds The list of stores for this payment method
     *
     * @return self
     * @deprecated since Management API v3. "Use `storeId` instead. Only one store per payment method is allowed."
     */
    public function setStoreIds($storeIds)
    {
        $this->container['storeIds'] = $storeIds;

        return $this;
    }

    /**
     * Gets visa
     *
     * @return \Adyen\Model\Management\GenericPmWithTdiInfo|null
     */
    public function getVisa()
    {
        return $this->container['visa'];
    }

    /**
     * Sets visa
     *
     * @param \Adyen\Model\Management\GenericPmWithTdiInfo|null $visa visa
     *
     * @return self
     */
    public function setVisa($visa)
    {
        $this->container['visa'] = $visa;

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

    public function toArray(): array
    {
        $array = [];
        foreach (self::$openAPITypes as $propertyName => $propertyType) {
            $propertyValue = $this[$propertyName];
            if ($propertyValue !== null) {
                // Check if the property value is an object and has a toArray() method
                if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) {
                    $array[$propertyName] = $propertyValue->toArray();
                // Check if it's type datetime
                } elseif ($propertyValue instanceof \DateTime) {
                    $array[$propertyName] = $propertyValue->format(DATE_ATOM);
                // If it's an array type we should check whether it contains objects and if so call toArray method
                } elseif (is_array($propertyValue)) {
                    $array[$propertyName] = array_map(function ($item) {
                        return $item instanceof ModelInterface ? $item->toArray() : $item;
                    }, $propertyValue);
                } else {
                    // Otherwise, directly assign the property value to the array
                    $array[$propertyName] = $propertyValue;
                }
            }
        }
        return $array;
    }

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