<?php

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

use UnexpectedValueException;
/**
 * @package OnlinePayments\Sdk\Domain
 */
class PaymentResponse extends DataObject
{
    /**
     * @var HostedCheckoutSpecificOutput|null
     */
    public ?HostedCheckoutSpecificOutput $hostedCheckoutSpecificOutput = null;
    /**
     * @var string|null
     */
    public ?string $id = null;
    /**
     * @var PaymentOutput|null
     */
    public ?PaymentOutput $paymentOutput = null;
    /**
     * @var SessionDetails|null
     */
    public ?SessionDetails $sessionDetails = null;
    /**
     * @var string|null
     */
    public ?string $status = null;
    /**
     * @var PaymentStatusOutput|null
     */
    public ?PaymentStatusOutput $statusOutput = null;
    /**
     * @return HostedCheckoutSpecificOutput|null
     */
    public function getHostedCheckoutSpecificOutput() : ?HostedCheckoutSpecificOutput
    {
        return $this->hostedCheckoutSpecificOutput;
    }
    /**
     * @param HostedCheckoutSpecificOutput|null $value
     */
    public function setHostedCheckoutSpecificOutput(?HostedCheckoutSpecificOutput $value) : void
    {
        $this->hostedCheckoutSpecificOutput = $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 PaymentOutput|null
     */
    public function getPaymentOutput() : ?PaymentOutput
    {
        return $this->paymentOutput;
    }
    /**
     * @param PaymentOutput|null $value
     */
    public function setPaymentOutput(?PaymentOutput $value) : void
    {
        $this->paymentOutput = $value;
    }
    /**
     * @return SessionDetails|null
     */
    public function getSessionDetails() : ?SessionDetails
    {
        return $this->sessionDetails;
    }
    /**
     * @param SessionDetails|null $value
     */
    public function setSessionDetails(?SessionDetails $value) : void
    {
        $this->sessionDetails = $value;
    }
    /**
     * @return string|null
     */
    public function getStatus() : ?string
    {
        return $this->status;
    }
    /**
     * @param string|null $value
     */
    public function setStatus(?string $value) : void
    {
        $this->status = $value;
    }
    /**
     * @return PaymentStatusOutput|null
     */
    public function getStatusOutput() : ?PaymentStatusOutput
    {
        return $this->statusOutput;
    }
    /**
     * @param PaymentStatusOutput|null $value
     */
    public function setStatusOutput(?PaymentStatusOutput $value) : void
    {
        $this->statusOutput = $value;
    }
    /**
     * @return object
     */
    public function toObject() : object
    {
        $object = parent::toObject();
        if (!\is_null($this->hostedCheckoutSpecificOutput)) {
            $object->hostedCheckoutSpecificOutput = $this->hostedCheckoutSpecificOutput->toObject();
        }
        if (!\is_null($this->id)) {
            $object->id = $this->id;
        }
        if (!\is_null($this->paymentOutput)) {
            $object->paymentOutput = $this->paymentOutput->toObject();
        }
        if (!\is_null($this->sessionDetails)) {
            $object->sessionDetails = $this->sessionDetails->toObject();
        }
        if (!\is_null($this->status)) {
            $object->status = $this->status;
        }
        if (!\is_null($this->statusOutput)) {
            $object->statusOutput = $this->statusOutput->toObject();
        }
        return $object;
    }
    /**
     * @param object $object
     * @return $this
     * @throws UnexpectedValueException
     */
    public function fromObject(object $object) : PaymentResponse
    {
        parent::fromObject($object);
        if (\property_exists($object, 'hostedCheckoutSpecificOutput')) {
            if (!\is_object($object->hostedCheckoutSpecificOutput)) {
                throw new UnexpectedValueException('value \'' . \print_r($object->hostedCheckoutSpecificOutput, \true) . '\' is not an object');
            }
            $value = new HostedCheckoutSpecificOutput();
            $this->hostedCheckoutSpecificOutput = $value->fromObject($object->hostedCheckoutSpecificOutput);
        }
        if (\property_exists($object, 'id')) {
            $this->id = $object->id;
        }
        if (\property_exists($object, 'paymentOutput')) {
            if (!\is_object($object->paymentOutput)) {
                throw new UnexpectedValueException('value \'' . \print_r($object->paymentOutput, \true) . '\' is not an object');
            }
            $value = new PaymentOutput();
            $this->paymentOutput = $value->fromObject($object->paymentOutput);
        }
        if (\property_exists($object, 'sessionDetails')) {
            if (!\is_object($object->sessionDetails)) {
                throw new UnexpectedValueException('value \'' . \print_r($object->sessionDetails, \true) . '\' is not an object');
            }
            $value = new SessionDetails();
            $this->sessionDetails = $value->fromObject($object->sessionDetails);
        }
        if (\property_exists($object, 'status')) {
            $this->status = $object->status;
        }
        if (\property_exists($object, 'statusOutput')) {
            if (!\is_object($object->statusOutput)) {
                throw new UnexpectedValueException('value \'' . \print_r($object->statusOutput, \true) . '\' is not an object');
            }
            $value = new PaymentStatusOutput();
            $this->statusOutput = $value->fromObject($object->statusOutput);
        }
        return $this;
    }
}
