<?php

namespace Fifa\ConnectId\Sdk\ApiModelValidation;

use Fifa\ConnectId\Sdk\Api\Model\PersonRegistrationsType;
use Fifa\ConnectId\Sdk\Registration\ValidationException;

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

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

        ApiModelValidator::validateAllInCollection($validationSubject->getPlayerRegistrations(), PlayerRegistrationTypeValidator::class, $validationSubjectName.".playerRegistrations");

        ApiModelValidator::validateAllInCollection($validationSubject->getMatchOfficialRegistrations(), MatchOfficialRegistrationTypeValidator::class, $validationSubjectName.".matchOfficialRegistrations");

        ApiModelValidator::validateAllInCollection($validationSubject->getTeamOfficialRegistrations(), TeamOfficialRegistrationTypeValidator::class, $validationSubjectName.".teamOfficialRegistrations");

        ApiModelValidator::validateAllInCollection($validationSubject->getOrganisationOfficialRegistrations(), OrganisationOfficialRegistrationTypeValidator::class, $validationSubjectName.".organisationOfficialRegistrations");
    }
}