<?php

namespace Fifa\ConnectId\Sdk\ApiModelValidation;

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

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

        ApiModelValidator::cannotBeNull($validationSubject, $validationSubjectName);
        ApiModelValidator::validateDoNotAllowNull($validationSubject->getPersonId(), FifaIdValidator::class, $validationSubjectName.".personId");
        ContextTypeValidator::validate($validationSubject->getRegistrations(), $validationSubjectName.".registrations");
    }
}