<?php

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

use UnexpectedValueException;
/**
 * @package OnlinePayments\Sdk\Domain
 */
class Discount extends DataObject
{
    /**
     * @var int|null
     */
    public ?int $amount = null;
    /**
     * @return int|null
     */
    public function getAmount() : ?int
    {
        return $this->amount;
    }
    /**
     * @param int|null $value
     */
    public function setAmount(?int $value) : void
    {
        $this->amount = $value;
    }
    /**
     * @return object
     */
    public function toObject() : object
    {
        $object = parent::toObject();
        if (!\is_null($this->amount)) {
            $object->amount = $this->amount;
        }
        return $object;
    }
    /**
     * @param object $object
     * @return $this
     * @throws UnexpectedValueException
     */
    public function fromObject(object $object) : Discount
    {
        parent::fromObject($object);
        if (\property_exists($object, 'amount')) {
            $this->amount = $object->amount;
        }
        return $this;
    }
}
