<?php

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

use UnexpectedValueException;
/**
 * @package OnlinePayments\Sdk\Domain
 */
class CardDataWithoutCvv extends DataObject
{
    /**
     * @var string|null
     */
    public ?string $cardNumber = null;
    /**
     * @var string|null
     */
    public ?string $cardholderName = 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 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->expiryDate)) {
            $object->expiryDate = $this->expiryDate;
        }
        return $object;
    }
    /**
     * @param object $object
     * @return $this
     * @throws UnexpectedValueException
     */
    public function fromObject(object $object) : CardDataWithoutCvv
    {
        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, 'expiryDate')) {
            $this->expiryDate = $object->expiryDate;
        }
        return $this;
    }
}
