<?php

namespace Fifa\ConnectId\Sdk\ApiModelValidation;

use Fifa\ConnectId\Sdk\Model\PersonName;
use Fifa\ConnectId\Sdk\Registration\ValidationException;

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

        ApiModelValidator::cannotBeNull($validationSubject, $validationSubjectName);
        ApiModelValidator::cannotBeNullOrWhitespace($validationSubject->getLastName(), $validationSubjectName.".lastName");
    }
}