<?php

namespace Fifa\ConnectId\Sdk\ApiModelValidation;

use Fifa\ConnectId\Sdk\Api\Model\SupportedDisciplineType;
use Fifa\ConnectId\Sdk\Registration\ValidationException;
use Fifa\ConnectId\Sdk\Util\Data\Discipline;
use Fifa\ConnectId\Sdk\Util\Data\Gender;

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

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

        ApiModelValidator::mustBeNullOrMatchEnumValue($validationSubject->getGender(), Gender::getGenders(), $validationSubjectName.".gender");
        ApiModelValidator::mustBeNullOrMatchEnumValue($validationSubject->getDiscipline(), Discipline::getDisciplines(), $validationSubjectName.".discipline");
    }
}