mindee
Version:
Mindee Client Library for Node.js
133 lines (132 loc) • 4.82 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.IndianPassportV1Document = void 0;
const common_1 = require("../../../parsing/common");
const standard_1 = require("../../../parsing/standard");
/**
* Passport - India API version 1.2 document data.
*/
class IndianPassportV1Document {
constructor(rawPrediction, pageId) {
this.address1 = new standard_1.StringField({
prediction: rawPrediction["address1"],
pageId: pageId,
});
this.address2 = new standard_1.StringField({
prediction: rawPrediction["address2"],
pageId: pageId,
});
this.address3 = new standard_1.StringField({
prediction: rawPrediction["address3"],
pageId: pageId,
});
this.birthDate = new standard_1.DateField({
prediction: rawPrediction["birth_date"],
pageId: pageId,
});
this.birthPlace = new standard_1.StringField({
prediction: rawPrediction["birth_place"],
pageId: pageId,
});
this.country = new standard_1.StringField({
prediction: rawPrediction["country"],
pageId: pageId,
});
this.expiryDate = new standard_1.DateField({
prediction: rawPrediction["expiry_date"],
pageId: pageId,
});
this.fileNumber = new standard_1.StringField({
prediction: rawPrediction["file_number"],
pageId: pageId,
});
this.gender = new standard_1.ClassificationField({
prediction: rawPrediction["gender"],
});
this.givenNames = new standard_1.StringField({
prediction: rawPrediction["given_names"],
pageId: pageId,
});
this.idNumber = new standard_1.StringField({
prediction: rawPrediction["id_number"],
pageId: pageId,
});
this.issuanceDate = new standard_1.DateField({
prediction: rawPrediction["issuance_date"],
pageId: pageId,
});
this.issuancePlace = new standard_1.StringField({
prediction: rawPrediction["issuance_place"],
pageId: pageId,
});
this.legalGuardian = new standard_1.StringField({
prediction: rawPrediction["legal_guardian"],
pageId: pageId,
});
this.mrz1 = new standard_1.StringField({
prediction: rawPrediction["mrz1"],
pageId: pageId,
});
this.mrz2 = new standard_1.StringField({
prediction: rawPrediction["mrz2"],
pageId: pageId,
});
this.nameOfMother = new standard_1.StringField({
prediction: rawPrediction["name_of_mother"],
pageId: pageId,
});
this.nameOfSpouse = new standard_1.StringField({
prediction: rawPrediction["name_of_spouse"],
pageId: pageId,
});
this.oldPassportDateOfIssue = new standard_1.DateField({
prediction: rawPrediction["old_passport_date_of_issue"],
pageId: pageId,
});
this.oldPassportNumber = new standard_1.StringField({
prediction: rawPrediction["old_passport_number"],
pageId: pageId,
});
this.oldPassportPlaceOfIssue = new standard_1.StringField({
prediction: rawPrediction["old_passport_place_of_issue"],
pageId: pageId,
});
this.pageNumber = new standard_1.ClassificationField({
prediction: rawPrediction["page_number"],
});
this.surname = new standard_1.StringField({
prediction: rawPrediction["surname"],
pageId: pageId,
});
}
/**
* Default string representation.
*/
toString() {
const outStr = `:Page Number: ${this.pageNumber}
:Country: ${this.country}
:ID Number: ${this.idNumber}
:Given Names: ${this.givenNames}
:Surname: ${this.surname}
:Birth Date: ${this.birthDate}
:Birth Place: ${this.birthPlace}
:Issuance Place: ${this.issuancePlace}
:Gender: ${this.gender}
:Issuance Date: ${this.issuanceDate}
:Expiry Date: ${this.expiryDate}
:MRZ Line 1: ${this.mrz1}
:MRZ Line 2: ${this.mrz2}
:Legal Guardian: ${this.legalGuardian}
:Name of Spouse: ${this.nameOfSpouse}
:Name of Mother: ${this.nameOfMother}
:Old Passport Date of Issue: ${this.oldPassportDateOfIssue}
:Old Passport Number: ${this.oldPassportNumber}
:Old Passport Place of Issue: ${this.oldPassportPlaceOfIssue}
:Address Line 1: ${this.address1}
:Address Line 2: ${this.address2}
:Address Line 3: ${this.address3}
:File Number: ${this.fileNumber}`.trimEnd();
return (0, common_1.cleanOutString)(outStr);
}
}
exports.IndianPassportV1Document = IndianPassportV1Document;