<?php

namespace Fifa\ConnectId\Sdk\ApiModelValidation;

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

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

        ApiModelValidator::validateDoNotAllowNull($validationSubject->getPersonId(), FifaIdValidator::class, $validationSubjectName.".personId");
        ContextTypeValidator::validate($validationSubject->getOldRegistrations(), $validationSubjectName.".oldRegistrations");
        ContextTypeValidator::validate($validationSubject->getNewRegistrations(), $validationSubjectName.".newRegistrations");
    }
}