<?php

namespace Fifa\ConnectId\Sdk\Model\Transfer;

class ProofOfPayment
{
    /**
     * @var string
     * @required
     */
    public $MessageId;

    /**
     * @var int
     */
    public $TmsTransferId;

    /**
     * @var string
     */
    public $PaymentType;

    /**
     * @var PaymentDetails
     */
    public $PaymentDetails;

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

    /**
     * ProofOfPayment constructor.
     * @param string $messageId
     * @param int $tmsTransferId
     * @param string $paymentType
     * @param PaymentDetails $paymentDetails
     * @param Club $recipientClub
     */
    public function __construct(string $messageId, int $tmsTransferId, string $paymentType, PaymentDetails $paymentDetails, Club $recipientClub)
    {
        $this->MessageId = $messageId;
        $this->TmsTransferId = $tmsTransferId;
        $this->PaymentType = $paymentType;
        $this->PaymentDetails = $paymentDetails;
        $this->RecipientClub = $recipientClub;
    }

    public function __toString()
    {
        $dataToSerialize = [];
        $dataToSerialize[] = sprintf('MessageId: %s', $this->MessageId);

        $dataToSerialize[] = sprintf(
            'TmsTransferId: %s, PaymentType: %s',
            $this->TmsTransferId, $this->PaymentType
        );

        if (!is_null($this->PaymentDetails)) {
            $dataToSerialize[] = sprintf('Payment Details: [%s]', $this->PaymentDetails);
        }

        if (!is_null($this->RecipientClub)) {
            $dataToSerialize[] = sprintf('Recipient Club: [%s]', $this->RecipientClub);
        }

        return join(', ', $dataToSerialize);
    }
}