<?php
namespace Fifa\ConnectId\Sdk\Model\DataStandard;
use DateTime;
use Fifa\ConnectId\Sdk\Util\ToString\Exception\ToStringException;
use Fifa\ConnectId\Sdk\Util\ToString\ToString;

/**
 * Class RegistrationType
 * @package Fifa\ConnectId\Sdk\Model\DataStandard
 */
abstract class Registration
{
    /**
     * @var string
     * @required
     */
    public $PersonFIFAId;

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

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

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

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

    /**
     * RegistrationType constructor.
     *
     * @param string $PersonFIFAId
     * @param string $Status
     * @param string $OrganisationFIFAId
     * @param DateTime $RegistrationValidFrom
     *
     * @throws ToStringException
     */
    public function __construct(string $PersonFIFAId, string $Status, string $OrganisationFIFAId, DateTime $RegistrationValidFrom)
    {
        $this->PersonFIFAId = $PersonFIFAId;
        $this->Status = $Status;
        $this->OrganisationFIFAId = $OrganisationFIFAId;
        $this->setRegistrationValidFrom($RegistrationValidFrom);
    }

    /**
     * @return string
     */
    public function __toString()
    {
        $required = sprintf('PersonFIFAId: %s, Status: %s, OrganisationFIFAId: %s, RegistrationValidFrom: %s', $this->PersonFIFAId, $this->Status, $this->OrganisationFIFAId, $this->RegistrationValidFrom);
        $optional = sprintf('RegistrationValidTo: %s', $this->RegistrationValidTo);

        return sprintf('%s, %s', $required, $optional);
    }

    /**
     * Gets DateTime object and sets its string representation to RegistrationValidFrom property
     *
     * @param DateTime $registrationValidFrom
     * @throws ToStringException
     */
    public function setRegistrationValidFrom(DateTime $registrationValidFrom)
    {
        $this->RegistrationValidFrom = ToString::getValue($registrationValidFrom);
    }

    /**
     * Gets DateTime object and sets its string representation to RegistrationValidTo property
     *
     * @param DateTime $registrationValidTo
     * @throws ToStringException
     */
    public function setRegistrationValidTo(DateTime $registrationValidTo)
    {
        $this->RegistrationValidTo = ToString::getValue($registrationValidTo);
    }
}