<?php

namespace Fifa\ConnectId\Sdk\ApiModelValidation;

use Fifa\ConnectId\Sdk\Api\Model\MatchOfficialRegistrationType;
use Fifa\ConnectId\Sdk\Registration\ValidationException;
use Fifa\ConnectId\Sdk\Util\Data\Discipline;
use Fifa\ConnectId\Sdk\Util\Data\Person\MatchOfficialRole;
use Fifa\ConnectId\Sdk\Util\Data\Status;

class MatchOfficialRegistrationTypeValidator
{
    /**
     * Method that validates object provided and throws exception when object's properties are invalid
     *
     * @param MatchOfficialRegistrationType|null $validationSubject
     * @param string $validationSubjectName
     * @return void
     * @throws ValidationException
     */
    public static function validate(?MatchOfficialRegistrationType $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->getMatchOfficialRole(), MatchOfficialRole::getMatchOfficialRoles(), $validationSubjectName.".matchOfficialRole");
        ApiModelValidator::validateAllowNull($validationSubject->getSystemId(), SystemIdValidator::class, $validationSubjectName.".systemId");
    }
}