<?php


namespace Fifa\ConnectId\Sdk\Model\Transfer;

use DateTime;
use Fifa\ConnectId\Sdk\Util\ToString\Exception\ToStringException;
use Fifa\ConnectId\Sdk\Util\ToString\ToString;

class TransferFeeDetails
{
    /**
     * @var float
     * @required
     */
    public $Amount;

    /**
     * @var string
     * @required
     */
    public $Currency;

    /**
     * Date in format "Y-m-d" (ref. http://php.net/manual/en/function.date.php)
     *
     * @var string
     * @required
     */
    public $DateOfPayment;

    /**
     * @var Club
     * @required
     */
    public $RecipientClub;

    /**
     * TransferFeeDetails constructor.
     * @param float $Amount
     * @param string $Currency
     * @param DateTime $DateOfPayment
     * @param Club $RecipientClub
     * @throws ToStringException
     */
    public function __construct(float $Amount, string $Currency, DateTime $DateOfPayment, Club $RecipientClub)
    {
        $this->Amount = $Amount;
        $this->Currency = $Currency;
        $this->setDateOfPayment($DateOfPayment);
        $this->RecipientClub = $RecipientClub;
    }

    /**
     * Gets DateTime object and sets its string representation to DateOfPayment property
     *
     * @param DateTime $dateOfPayment
     * @return TransferFeeDetails
     * @throws ToStringException
     */
    public function setDateOfPayment(DateTime $dateOfPayment): TransferFeeDetails
    {
        $this->DateOfPayment = ToString::getValue($dateOfPayment);
        return $this;
    }

    /**
     * @return string
     */
    public function __toString()
    {
        $required = sprintf('Amount: %s, Currency: %s, DateOfPayment: %s, RecipientClub: %s', $this->Amount, $this->Currency, $this->DateOfPayment, $this->RecipientClub->__toString());
        return sprintf('%s', $required);
    }
}