<?php

namespace Fifa\ConnectId\Sdk\ApiModelValidation;

use Fifa\ConnectId\Sdk\Api\Model\SearchAddressType;
use Fifa\ConnectId\Sdk\Registration\ValidationException;
use Fifa\ConnectId\Sdk\Util\Data\ISO3166CountryCode;

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

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

        $ignoreCase = false;
        ApiModelValidator::mustBeNullOrMatchEnumValue($validationSubject->getCountry(), XsdSchemaValuesResolver::getValues(ISO3166CountryCode::class), $validationSubjectName.".country", $ignoreCase);
    }
}