<?php

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

use UnexpectedValueException;
/**
 * @package OnlinePayments\Sdk\Domain
 */
class SepaDirectDebitPaymentMethodSpecificInputBase extends DataObject
{
    /**
     * @var SepaDirectDebitPaymentProduct771SpecificInputBase|null
     */
    public ?SepaDirectDebitPaymentProduct771SpecificInputBase $paymentProduct771SpecificInput = null;
    /**
     * @var int|null
     */
    public ?int $paymentProductId = null;
    /**
     * @return SepaDirectDebitPaymentProduct771SpecificInputBase|null
     */
    public function getPaymentProduct771SpecificInput() : ?SepaDirectDebitPaymentProduct771SpecificInputBase
    {
        return $this->paymentProduct771SpecificInput;
    }
    /**
     * @param SepaDirectDebitPaymentProduct771SpecificInputBase|null $value
     */
    public function setPaymentProduct771SpecificInput(?SepaDirectDebitPaymentProduct771SpecificInputBase $value) : void
    {
        $this->paymentProduct771SpecificInput = $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->paymentProduct771SpecificInput)) {
            $object->paymentProduct771SpecificInput = $this->paymentProduct771SpecificInput->toObject();
        }
        if (!\is_null($this->paymentProductId)) {
            $object->paymentProductId = $this->paymentProductId;
        }
        return $object;
    }
    /**
     * @param object $object
     * @return $this
     * @throws UnexpectedValueException
     */
    public function fromObject(object $object) : SepaDirectDebitPaymentMethodSpecificInputBase
    {
        parent::fromObject($object);
        if (\property_exists($object, 'paymentProduct771SpecificInput')) {
            if (!\is_object($object->paymentProduct771SpecificInput)) {
                throw new UnexpectedValueException('value \'' . \print_r($object->paymentProduct771SpecificInput, \true) . '\' is not an object');
            }
            $value = new SepaDirectDebitPaymentProduct771SpecificInputBase();
            $this->paymentProduct771SpecificInput = $value->fromObject($object->paymentProduct771SpecificInput);
        }
        if (\property_exists($object, 'paymentProductId')) {
            $this->paymentProductId = $object->paymentProductId;
        }
        return $this;
    }
}
