validate
Validates an Indian Passport number.
Input normalisation applied before validation (in order):
Trim leading/trailing whitespace
Strip all internal whitespace (covers copy-paste with spaces)
Uppercase all characters
After normalisation, checks are applied in order — first failing check wins:
InvalidReason.EMPTY if the result is blank
InvalidReason.WRONG_LENGTH if length is not 8
InvalidReason.INVALID_FORMAT if the string does not match
^[A-Z]\d{7}$
No checksum: MEA has not published a public checksum algorithm for Indian passport numbers. Validation is structural only.
Note: Hyphens are not stripped. "M-1234567" normalises to 9 characters and returns InvalidReason.WRONG_LENGTH.
Return
ValidationResult.Valid if the Passport number passes format validation, ValidationResult.Invalid with an appropriate InvalidReason otherwise.
Parameters
Raw Passport number string in any common input form.
Samples
check(Passport.validate("A1234567") == ValidationResult.Valid)