mindee
Version:
Mindee Client Library for Node.js
225 lines (224 loc) • 6.79 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CarteGriseV1Document = void 0;
const common_1 = require("../../../parsing/common");
const standard_1 = require("../../../parsing/standard");
/**
* Carte Grise API version 1.1 document data.
*/
class CarteGriseV1Document {
constructor(rawPrediction, pageId) {
this.a = new standard_1.StringField({
prediction: rawPrediction["a"],
pageId: pageId,
});
this.b = new standard_1.DateField({
prediction: rawPrediction["b"],
pageId: pageId,
});
this.c1 = new standard_1.StringField({
prediction: rawPrediction["c1"],
pageId: pageId,
});
this.c3 = new standard_1.StringField({
prediction: rawPrediction["c3"],
pageId: pageId,
});
this.c41 = new standard_1.StringField({
prediction: rawPrediction["c41"],
pageId: pageId,
});
this.c4A = new standard_1.StringField({
prediction: rawPrediction["c4a"],
pageId: pageId,
});
this.d1 = new standard_1.StringField({
prediction: rawPrediction["d1"],
pageId: pageId,
});
this.d3 = new standard_1.StringField({
prediction: rawPrediction["d3"],
pageId: pageId,
});
this.e = new standard_1.StringField({
prediction: rawPrediction["e"],
pageId: pageId,
});
this.f1 = new standard_1.StringField({
prediction: rawPrediction["f1"],
pageId: pageId,
});
this.f2 = new standard_1.StringField({
prediction: rawPrediction["f2"],
pageId: pageId,
});
this.f3 = new standard_1.StringField({
prediction: rawPrediction["f3"],
pageId: pageId,
});
this.formulaNumber = new standard_1.StringField({
prediction: rawPrediction["formula_number"],
pageId: pageId,
});
this.g = new standard_1.StringField({
prediction: rawPrediction["g"],
pageId: pageId,
});
this.g1 = new standard_1.StringField({
prediction: rawPrediction["g1"],
pageId: pageId,
});
this.i = new standard_1.DateField({
prediction: rawPrediction["i"],
pageId: pageId,
});
this.j = new standard_1.StringField({
prediction: rawPrediction["j"],
pageId: pageId,
});
this.j1 = new standard_1.StringField({
prediction: rawPrediction["j1"],
pageId: pageId,
});
this.j2 = new standard_1.StringField({
prediction: rawPrediction["j2"],
pageId: pageId,
});
this.j3 = new standard_1.StringField({
prediction: rawPrediction["j3"],
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.ownerFirstName = new standard_1.StringField({
prediction: rawPrediction["owner_first_name"],
pageId: pageId,
});
this.ownerSurname = new standard_1.StringField({
prediction: rawPrediction["owner_surname"],
pageId: pageId,
});
this.p1 = new standard_1.StringField({
prediction: rawPrediction["p1"],
pageId: pageId,
});
this.p2 = new standard_1.StringField({
prediction: rawPrediction["p2"],
pageId: pageId,
});
this.p3 = new standard_1.StringField({
prediction: rawPrediction["p3"],
pageId: pageId,
});
this.p6 = new standard_1.StringField({
prediction: rawPrediction["p6"],
pageId: pageId,
});
this.q = new standard_1.StringField({
prediction: rawPrediction["q"],
pageId: pageId,
});
this.s1 = new standard_1.StringField({
prediction: rawPrediction["s1"],
pageId: pageId,
});
this.s2 = new standard_1.StringField({
prediction: rawPrediction["s2"],
pageId: pageId,
});
this.u1 = new standard_1.StringField({
prediction: rawPrediction["u1"],
pageId: pageId,
});
this.u2 = new standard_1.StringField({
prediction: rawPrediction["u2"],
pageId: pageId,
});
this.v7 = new standard_1.StringField({
prediction: rawPrediction["v7"],
pageId: pageId,
});
this.x1 = new standard_1.StringField({
prediction: rawPrediction["x1"],
pageId: pageId,
});
this.y1 = new standard_1.StringField({
prediction: rawPrediction["y1"],
pageId: pageId,
});
this.y2 = new standard_1.StringField({
prediction: rawPrediction["y2"],
pageId: pageId,
});
this.y3 = new standard_1.StringField({
prediction: rawPrediction["y3"],
pageId: pageId,
});
this.y4 = new standard_1.StringField({
prediction: rawPrediction["y4"],
pageId: pageId,
});
this.y5 = new standard_1.StringField({
prediction: rawPrediction["y5"],
pageId: pageId,
});
this.y6 = new standard_1.StringField({
prediction: rawPrediction["y6"],
pageId: pageId,
});
}
/**
* Default string representation.
*/
toString() {
const outStr = `:a: ${this.a}
:b: ${this.b}
:c1: ${this.c1}
:c3: ${this.c3}
:c41: ${this.c41}
:c4a: ${this.c4A}
:d1: ${this.d1}
:d3: ${this.d3}
:e: ${this.e}
:f1: ${this.f1}
:f2: ${this.f2}
:f3: ${this.f3}
:g: ${this.g}
:g1: ${this.g1}
:i: ${this.i}
:j: ${this.j}
:j1: ${this.j1}
:j2: ${this.j2}
:j3: ${this.j3}
:p1: ${this.p1}
:p2: ${this.p2}
:p3: ${this.p3}
:p6: ${this.p6}
:q: ${this.q}
:s1: ${this.s1}
:s2: ${this.s2}
:u1: ${this.u1}
:u2: ${this.u2}
:v7: ${this.v7}
:x1: ${this.x1}
:y1: ${this.y1}
:y2: ${this.y2}
:y3: ${this.y3}
:y4: ${this.y4}
:y5: ${this.y5}
:y6: ${this.y6}
:Formula Number: ${this.formulaNumber}
:Owner's First Name: ${this.ownerFirstName}
:Owner's Surname: ${this.ownerSurname}
:MRZ Line 1: ${this.mrz1}
:MRZ Line 2: ${this.mrz2}`.trimEnd();
return (0, common_1.cleanOutString)(outStr);
}
}
exports.CarteGriseV1Document = CarteGriseV1Document;