<?php

/*
 * This file was automatically generated.
 */
namespace Syde\Vendor\Worldline\OnlinePayments\Sdk\Domain;

use UnexpectedValueException;
/**
 * @package OnlinePayments\Sdk\Domain
 */
class TokenResponse extends DataObject
{
    /**
     * @var TokenCard|null
     */
    public ?TokenCard $card = null;
    /**
     * @var CrmToken|null
     */
    public ?CrmToken $crmToken = null;
    /**
     * @var TokenEWallet|null
     */
    public ?TokenEWallet $eWallet = null;
    /**
     * @var ExternalTokenLinked|null
     */
    public ?ExternalTokenLinked $externalTokenLinked = null;
    /**
     * @var string|null
     */
    public ?string $id = null;
    /**
     * @var bool|null
     */
    public ?bool $isTemporary = null;
    /**
     * @var NetworkTokenLinked|null
     */
    public ?NetworkTokenLinked $networkTokenLinked = null;
    /**
     * @var int|null
     */
    public ?int $paymentProductId = null;
    /**
     * @return TokenCard|null
     */
    public function getCard() : ?TokenCard
    {
        return $this->card;
    }
    /**
     * @param TokenCard|null $value
     */
    public function setCard(?TokenCard $value) : void
    {
        $this->card = $value;
    }
    /**
     * @return CrmToken|null
     */
    public function getCrmToken() : ?CrmToken
    {
        return $this->crmToken;
    }
    /**
     * @param CrmToken|null $value
     */
    public function setCrmToken(?CrmToken $value) : void
    {
        $this->crmToken = $value;
    }
    /**
     * @return TokenEWallet|null
     */
    public function getEWallet() : ?TokenEWallet
    {
        return $this->eWallet;
    }
    /**
     * @param TokenEWallet|null $value
     */
    public function setEWallet(?TokenEWallet $value) : void
    {
        $this->eWallet = $value;
    }
    /**
     * @return ExternalTokenLinked|null
     */
    public function getExternalTokenLinked() : ?ExternalTokenLinked
    {
        return $this->externalTokenLinked;
    }
    /**
     * @param ExternalTokenLinked|null $value
     */
    public function setExternalTokenLinked(?ExternalTokenLinked $value) : void
    {
        $this->externalTokenLinked = $value;
    }
    /**
     * @return string|null
     */
    public function getId() : ?string
    {
        return $this->id;
    }
    /**
     * @param string|null $value
     */
    public function setId(?string $value) : void
    {
        $this->id = $value;
    }
    /**
     * @return bool|null
     */
    public function getIsTemporary() : ?bool
    {
        return $this->isTemporary;
    }
    /**
     * @param bool|null $value
     */
    public function setIsTemporary(?bool $value) : void
    {
        $this->isTemporary = $value;
    }
    /**
     * @return NetworkTokenLinked|null
     */
    public function getNetworkTokenLinked() : ?NetworkTokenLinked
    {
        return $this->networkTokenLinked;
    }
    /**
     * @param NetworkTokenLinked|null $value
     */
    public function setNetworkTokenLinked(?NetworkTokenLinked $value) : void
    {
        $this->networkTokenLinked = $value;
    }
    /**
     * @return int|null
     */
    public function getPaymentProductId() : ?int
    {
        return $this->paymentProductId;
    }
    /**
     * @param int|null $value
     */
    public function setPaymentProductId(?int $value) : void
    {
        $this->paymentProductId = $value;
    }
    /**
     * @return object
     */
    public function toObject() : object
    {
        $object = parent::toObject();
        if (!\is_null($this->card)) {
            $object->card = $this->card->toObject();
        }
        if (!\is_null($this->crmToken)) {
            $object->crmToken = $this->crmToken->toObject();
        }
        if (!\is_null($this->eWallet)) {
            $object->eWallet = $this->eWallet->toObject();
        }
        if (!\is_null($this->externalTokenLinked)) {
            $object->externalTokenLinked = $this->externalTokenLinked->toObject();
        }
        if (!\is_null($this->id)) {
            $object->id = $this->id;
        }
        if (!\is_null($this->isTemporary)) {
            $object->isTemporary = $this->isTemporary;
        }
        if (!\is_null($this->networkTokenLinked)) {
            $object->networkTokenLinked = $this->networkTokenLinked->toObject();
        }
        if (!\is_null($this->paymentProductId)) {
            $object->paymentProductId = $this->paymentProductId;
        }
        return $object;
    }
    /**
     * @param object $object
     * @return $this
     * @throws UnexpectedValueException
     */
    public function fromObject(object $object) : TokenResponse
    {
        parent::fromObject($object);
        if (\property_exists($object, 'card')) {
            if (!\is_object($object->card)) {
                throw new UnexpectedValueException('value \'' . \print_r($object->card, \true) . '\' is not an object');
            }
            $value = new TokenCard();
            $this->card = $value->fromObject($object->card);
        }
        if (\property_exists($object, 'crmToken')) {
            if (!\is_object($object->crmToken)) {
                throw new UnexpectedValueException('value \'' . \print_r($object->crmToken, \true) . '\' is not an object');
            }
            $value = new CrmToken();
            $this->crmToken = $value->fromObject($object->crmToken);
        }
        if (\property_exists($object, 'eWallet')) {
            if (!\is_object($object->eWallet)) {
                throw new UnexpectedValueException('value \'' . \print_r($object->eWallet, \true) . '\' is not an object');
            }
            $value = new TokenEWallet();
            $this->eWallet = $value->fromObject($object->eWallet);
        }
        if (\property_exists($object, 'externalTokenLinked')) {
            if (!\is_object($object->externalTokenLinked)) {
                throw new UnexpectedValueException('value \'' . \print_r($object->externalTokenLinked, \true) . '\' is not an object');
            }
            $value = new ExternalTokenLinked();
            $this->externalTokenLinked = $value->fromObject($object->externalTokenLinked);
        }
        if (\property_exists($object, 'id')) {
            $this->id = $object->id;
        }
        if (\property_exists($object, 'isTemporary')) {
            $this->isTemporary = $object->isTemporary;
        }
        if (\property_exists($object, 'networkTokenLinked')) {
            if (!\is_object($object->networkTokenLinked)) {
                throw new UnexpectedValueException('value \'' . \print_r($object->networkTokenLinked, \true) . '\' is not an object');
            }
            $value = new NetworkTokenLinked();
            $this->networkTokenLinked = $value->fromObject($object->networkTokenLinked);
        }
        if (\property_exists($object, 'paymentProductId')) {
            $this->paymentProductId = $object->paymentProductId;
        }
        return $this;
    }
}
