<?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 NationalIdentifier
 * @package Fifa\ConnectId\Sdk\Model\DataStandard
 */
class NationalIdentifier
{
    /**
     * @var string
     * @required
     */
    public $Identifier;

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

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

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

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

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

    /**
     * NationalIdentifier constructor.
     *
     * @param string $Identifier
     * @param string $NationalIdentifierNature
     * @param string $Country
     */
    public function __construct(string $Identifier, string $NationalIdentifierNature, string $Country)
    {
        $this->Identifier = $Identifier;
        $this->NationalIdentifierNature = $NationalIdentifierNature;
        $this->Country = $Country;
    }

    /**
     * @return string
     */
    public function __toString()
    {
        return sprintf(
            'Identifier: %s, NationalIdentifierNature: %s, Country: %s, DateFrom: %s, DateTo: %s, Description: %s',
            $this->Identifier, $this->NationalIdentifierNature, $this->Country, $this->DateFrom, $this->DateTo, $this->Description
        );
    }

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

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