<?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 WorkPermit
{
    /**
     * @var DocumentEmbedded
     * @required - required by SDK from business point of view, not required by FIFA Data Standard
     */
    public $WorkPermitDocument;

    /**
     * @var boolean
     */
    public $IsPermitDeclared;

    /**
     * @var boolean
     */
    public $HasWorkPermit;

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

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

    /**
     * WorkPermit constructor.
     */
    public function __construct()
    {
    }

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

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

    /**
     * @return string
     */
    public function __toString()
    {
        $required = '';
        if (!is_null($this->WorkPermitDocument)) {
            $required = sprintf('WorkPermitDocument: %s', $this->WorkPermitDocument->__toString());
        }

        $optional = sprintf('WorkPermitStartDate: %s, WorkPermitEndDate: %s, IsPermitDeclared: %s, HasWorkPermit: %s', $this->WorkPermitStartDate, $this->WorkPermitEndDate, $this->IsPermitDeclared, $this->HasWorkPermit);

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