<?php

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

use UnexpectedValueException;
/**
 * @package OnlinePayments\Sdk\Domain
 */
class OrderStatusOutput extends DataObject
{
    /**
     * @var APIError[]
     */
    public $errors = null;
    /**
     * @var bool
     */
    public $isCancellable = null;
    /**
     * @var string
     */
    public $statusCategory = null;
    /**
     * @var int
     */
    public $statusCode = null;
    /**
     * @var string
     */
    public $statusCodeChangeDateTime = null;
    /**
     * @return APIError[]
     */
    public function getErrors()
    {
        return $this->errors;
    }
    /**
     * @param APIError[]
     */
    public function setErrors($value)
    {
        $this->errors = $value;
    }
    /**
     * @return bool
     */
    public function getIsCancellable()
    {
        return $this->isCancellable;
    }
    /**
     * @param bool
     */
    public function setIsCancellable($value)
    {
        $this->isCancellable = $value;
    }
    /**
     * @return string
     */
    public function getStatusCategory()
    {
        return $this->statusCategory;
    }
    /**
     * @param string
     */
    public function setStatusCategory($value)
    {
        $this->statusCategory = $value;
    }
    /**
     * @return int
     */
    public function getStatusCode()
    {
        return $this->statusCode;
    }
    /**
     * @param int
     */
    public function setStatusCode($value)
    {
        $this->statusCode = $value;
    }
    /**
     * @return string
     */
    public function getStatusCodeChangeDateTime()
    {
        return $this->statusCodeChangeDateTime;
    }
    /**
     * @param string
     */
    public function setStatusCodeChangeDateTime($value)
    {
        $this->statusCodeChangeDateTime = $value;
    }
    /**
     * @return object
     */
    public function toObject()
    {
        $object = parent::toObject();
        if (!\is_null($this->errors)) {
            $object->errors = [];
            foreach ($this->errors as $element) {
                if (!\is_null($element)) {
                    $object->errors[] = $element->toObject();
                }
            }
        }
        if (!\is_null($this->isCancellable)) {
            $object->isCancellable = $this->isCancellable;
        }
        if (!\is_null($this->statusCategory)) {
            $object->statusCategory = $this->statusCategory;
        }
        if (!\is_null($this->statusCode)) {
            $object->statusCode = $this->statusCode;
        }
        if (!\is_null($this->statusCodeChangeDateTime)) {
            $object->statusCodeChangeDateTime = $this->statusCodeChangeDateTime;
        }
        return $object;
    }
    /**
     * @param object $object
     * @return $this
     * @throws UnexpectedValueException
     */
    public function fromObject($object)
    {
        parent::fromObject($object);
        if (\property_exists($object, 'errors')) {
            if (!\is_array($object->errors) && !\is_object($object->errors)) {
                throw new UnexpectedValueException('value \'' . \print_r($object->errors, \true) . '\' is not an array or object');
            }
            $this->errors = [];
            foreach ($object->errors as $element) {
                $value = new APIError();
                $this->errors[] = $value->fromObject($element);
            }
        }
        if (\property_exists($object, 'isCancellable')) {
            $this->isCancellable = $object->isCancellable;
        }
        if (\property_exists($object, 'statusCategory')) {
            $this->statusCategory = $object->statusCategory;
        }
        if (\property_exists($object, 'statusCode')) {
            $this->statusCode = $object->statusCode;
        }
        if (\property_exists($object, 'statusCodeChangeDateTime')) {
            $this->statusCodeChangeDateTime = $object->statusCodeChangeDateTime;
        }
        return $this;
    }
}
