<?php

namespace Fifa\ConnectId\Sdk\ApiModelValidation;

use Fifa\ConnectId\Sdk\Api\Model\TeamOfficialRegistrationType;
use Fifa\ConnectId\Sdk\Registration\ValidationException;
use Fifa\ConnectId\Sdk\Util\Data\Discipline;
use Fifa\ConnectId\Sdk\Util\Data\Person\TeamOfficialRole;
use Fifa\ConnectId\Sdk\Util\Data\Status;

class TeamOfficialRegistrationTypeValidator
{
    /**
     * Method that validates object provided and throws exception when object's properties are invalid
     *
     * @param TeamOfficialRegistrationType|null $validationSubject
     * @param string $validationSubjectName
     * @return void
     * @throws ValidationException
     */
    public static function validate(?TeamOfficialRegistrationType $validationSubject, string $validationSubjectName)
    {
        $validationSubjectName = ApiModelValidator::resolveValidationSubjectName($validationSubject, $validationSubjectName);

        ApiModelValidator::cannotBeNull($validationSubject, $validationSubjectName);

        ApiModelValidator::validateDoNotAllowNull($validationSubject->getOrganisationFIFAId(), FifaIdValidator::class, $validationSubjectName.".organisationFIFAId");

        ApiModelValidator::mustMatchEnumValue($validationSubject->getStatus(), Status::getStatuses(), $validationSubjectName.".status");
        ApiModelValidator::mustMatchEnumValue($validationSubject->getDiscipline(), Discipline::getDisciplines(), $validationSubjectName.".discipline");
        ApiModelValidator::mustMatchEnumValue($validationSubject->getTeamOfficialRole(), TeamOfficialRole::getTeamOfficialRoles(), $validationSubjectName.".teamOfficialRole");
        ApiModelValidator::validateAllowNull($validationSubject->getSystemId(), SystemIdValidator::class, $validationSubjectName.".systemId");
    }
}