<?php

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

use UnexpectedValueException;
/**
 * @package OnlinePayments\Sdk\Domain
 */
class Card extends DataObject
{
    /**
     * @var string|null
     */
    public ?string $cardNumber = null;
    /**
     * @var string|null
     */
    public ?string $cardholderName = null;
    /**
     * @var string|null
     */
    public ?string $cvv = null;
    /**
     * @var string|null
     */
    public ?string $expiryDate = null;
    /**
     * @return string|null
     */
    public function getCardNumber() : ?string
    {
        return $this->cardNumber;
    }
    /**
     * @param string|null $value
     */
    public function setCardNumber(?string $value) : void
    {
        $this->cardNumber = $value;
    }
    /**
     * @return string|null
     */
    public function getCardholderName() : ?string
    {
        return $this->cardholderName;
    }
    /**
     * @param string|null $value
     */
    public function setCardholderName(?string $value) : void
    {
        $this->cardholderName = $value;
    }
    /**
     * @return string|null
     */
    public function getCvv() : ?string
    {
        return $this->cvv;
    }
    /**
     * @param string|null $value
     */
    public function setCvv(?string $value) : void
    {
        $this->cvv = $value;
    }
    /**
     * @return string|null
     */
    public function getExpiryDate() : ?string
    {
        return $this->expiryDate;
    }
    /**
     * @param string|null $value
     */
    public function setExpiryDate(?string $value) : void
    {
        $this->expiryDate = $value;
    }
    /**
     * @return object
     */
    public function toObject() : object
    {
        $object = parent::toObject();
        if (!\is_null($this->cardNumber)) {
            $object->cardNumber = $this->cardNumber;
        }
        if (!\is_null($this->cardholderName)) {
            $object->cardholderName = $this->cardholderName;
        }
        if (!\is_null($this->cvv)) {
            $object->cvv = $this->cvv;
        }
        if (!\is_null($this->expiryDate)) {
            $object->expiryDate = $this->expiryDate;
        }
        return $object;
    }
    /**
     * @param object $object
     * @return $this
     * @throws UnexpectedValueException
     */
    public function fromObject(object $object) : Card
    {
        parent::fromObject($object);
        if (\property_exists($object, 'cardNumber')) {
            $this->cardNumber = $object->cardNumber;
        }
        if (\property_exists($object, 'cardholderName')) {
            $this->cardholderName = $object->cardholderName;
        }
        if (\property_exists($object, 'cvv')) {
            $this->cvv = $object->cvv;
        }
        if (\property_exists($object, 'expiryDate')) {
            $this->expiryDate = $object->expiryDate;
        }
        return $this;
    }
}
