UNPKG

react-native-scanbot-sdk

Version:

Scanbot Document and Barcode Scanner SDK React Native Plugin for Android and iOS

1,547 lines (1,264 loc) 137 kB
import { GenericDocument, Field } from './GenericDocument'; /// All possible root document types. export type BarcodeDocumentModelRootType = | typeof BoardingPassDocumentType | typeof SwissQRDocumentType | typeof DEMedicalPlanDocumentType | typeof IDCardPDF417DocumentType | typeof GS1DocumentType | typeof SEPADocumentType | typeof MedicalCertificateDocumentType | typeof VCardDocumentType | typeof AAMVADocumentType; export const BoardingPassDocumentType = 'BoardingPass'; export const BoardingPassLegDocumentType = 'Leg'; export const SwissQRDocumentType = 'SwissQR'; export const DEMedicalPlanDocumentType = 'DEMedicalPlan'; export const DEMedicalPlanPatientDocumentType = 'Patient'; export const DEMedicalPlanDoctorDocumentType = 'Doctor'; export const DEMedicalPlanSubheadingDocumentType = 'Subheading'; export const DEMedicalPlanSubheadingMedicineDocumentType = 'Medicine'; export const DEMedicalPlanSubheadingMedicineSubstanceDocumentType = 'Substance'; export const DEMedicalPlanSubheadingPrescriptionDocumentType = 'Prescription'; export const IDCardPDF417DocumentType = 'IDCardPDF417'; export const GS1DocumentType = 'GS1'; export const GS1ElementDocumentType = 'Element'; export const GS1ElementValidationErrorDocumentType = 'ValidationError'; export const SEPADocumentType = 'SEPA'; export const MedicalCertificateDocumentType = 'MedicalCertificate'; export const VCardDocumentType = 'VCard'; export const VCardEntryDocumentType = 'Entry'; export const VCardVersionDocumentType = 'Version'; export const VCardSourceDocumentType = 'Source'; export const VCardKindDocumentType = 'Kind'; export const VCardXMLDocumentType = 'XML'; export const VCardNameDocumentType = 'Name'; export const VCardFirstNameDocumentType = 'FirstName'; export const VCardNicknameDocumentType = 'Nickname'; export const VCardBirthdayDocumentType = 'Birthday'; export const VCardAnniversaryDocumentType = 'Anniversary'; export const VCardGenderDocumentType = 'Gender'; export const VCardDeliveryAddressDocumentType = 'DeliveryAddress'; export const VCardPhotoDocumentType = 'Photo'; export const VCardTelephoneNumberDocumentType = 'TelephoneNumber'; export const VCardEmailDocumentType = 'Email'; export const VCardIMPPDocumentType = 'IMPP'; export const VCardLanguagesDocumentType = 'Languages'; export const VCardTimeZoneDocumentType = 'TimeZone'; export const VCardGeoLocationDocumentType = 'GeoLocation'; export const VCardTitleDocumentType = 'Title'; export const VCardRoleDocumentType = 'Role'; export const VCardLogoDocumentType = 'Logo'; export const VCardOrganisationDocumentType = 'Organisation'; export const VCardMemberDocumentType = 'Member'; export const VCardRelatedDocumentType = 'Related'; export const VCardCategoriesDocumentType = 'Categories'; export const VCardNoteDocumentType = 'Note'; export const VCardProductIdDocumentType = 'ProductId'; export const VCardRevisionDocumentType = 'Revision'; export const VCardSoundDocumentType = 'Sound'; export const VCardUIDDocumentType = 'UID'; export const VCardClientPIDMapDocumentType = 'ClientPIDMap'; export const VCardURLDocumentType = 'URL'; export const VCardPublicKeyDocumentType = 'PublicKey'; export const VCardBusyTimeURLDocumentType = 'BusyTimeURL'; export const VCardCalendarURIForRequestsDocumentType = 'CalendarURIForRequests'; export const VCardCalendarURIDocumentType = 'CalendarURI'; export const VCardCustomDocumentType = 'Custom'; export const AAMVADocumentType = 'AAMVA'; export const AAMVATitleDataDocumentType = 'TitleData'; export const AAMVARegistrationDataDocumentType = 'RegistrationData'; export const AAMVAMotorCarrierDataDocumentType = 'MotorCarrierData'; export const AAMVARegistrantAndVehicleDataDocumentType = 'RegistrantAndVehicleData'; export const AAMVAVehicleOwnerDataDocumentType = 'VehicleOwnerData'; export const AAMVAVehicleDataDocumentType = 'VehicleData'; export const AAMVAVehicleSafetyInspectionDataDocumentType = 'VehicleSafetyInspectionData'; export const AAMVADLIDDocumentType = 'DLID'; export const AAMVADriverLicenseDocumentType = 'DriverLicense'; export const AAMVAIDCardDocumentType = 'IDCard'; export const AAMVAEnhancedDriverLicenseDocumentType = 'EnhancedDriverLicense'; export const AAMVARawDocumentDocumentType = 'RawDocument'; /** Boarding Pass */ export class BoardingPass { private _document: GenericDocument; get document(): GenericDocument { return this._document; } constructor(document: GenericDocument) { if (document.type.name !== this.requiredDocumentType()) { throw new Error( `Expected document type ${this.requiredDocumentType()}, got ${document.type.name}` ); } this._document = document; } requiredDocumentType(): string { return BoardingPassDocumentType; } /** Electronic Ticket */ get electronicTicket(): Field { return this.document.fields.find((f: Field) => f.type.name === 'ElectronicTicket') as Field; } /** Name */ get name(): Field { return this.document.fields.find((f: Field) => f.type.name === 'Name') as Field; } /** Number Of Legs */ get numberOfLegs(): Field { return this.document.fields.find((f: Field) => f.type.name === 'NumberOfLegs') as Field; } /** Security Data */ get securityData(): Field { return this.document.fields.find((f: Field) => f.type.name === 'SecurityData') as Field; } /** An array of all children of type "Leg". */ get legs(): BoardingPass.Leg[] { return this.document.children .filter((c: GenericDocument) => c.type.name === 'Leg') .map((c: GenericDocument) => new BoardingPass.Leg(c)); } } export namespace BoardingPass { /** Leg of the journey */ export class Leg { private _document: GenericDocument; get document(): GenericDocument { return this._document; } constructor(document: GenericDocument) { if (document.type.name !== this.requiredDocumentType()) { throw new Error( `Expected document type ${this.requiredDocumentType()}, got ${document.type.name}` ); } this._document = document; } requiredDocumentType(): string { return BoardingPassLegDocumentType; } /** Airline Designator Of Boarding Pass Issuer */ get airlineDesignatorOfBoardingPassIssuer(): Field | undefined { return this.document.fields.find( (f: Field) => f.type.name === 'AirlineDesignatorOfBoardingPassIssuer' ); } /** Airline Numeric Code */ get airlineNumericCode(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'AirlineNumericCode'); } /** Baggage Tag License Plate Numbers */ get baggageTagLicensePlateNumbers(): Field | undefined { return this.document.fields.find( (f: Field) => f.type.name === 'BaggageTagLicensePlateNumbers' ); } /** Check In Sequence Number */ get checkInSequenceNumber(): Field { return this.document.fields.find( (f: Field) => f.type.name === 'CheckInSequenceNumber' ) as Field; } /** Compartment Code */ get compartmentCode(): Field { return this.document.fields.find((f: Field) => f.type.name === 'CompartmentCode') as Field; } /** Date Of Boarding Pass Issuance Julian */ get dateOfBoardingPassIssuanceJulian(): Field | undefined { return this.document.fields.find( (f: Field) => f.type.name === 'DateOfBoardingPassIssuanceJulian' ); } /** Date Of Flight Julian */ get dateOfFlightJulian(): Field { return this.document.fields.find((f: Field) => f.type.name === 'DateOfFlightJulian') as Field; } /** Departure Airport Code */ get departureAirportCode(): Field { return this.document.fields.find( (f: Field) => f.type.name === 'DepartureAirportCode' ) as Field; } /** Destination Airport Code */ get destinationAirportCode(): Field { return this.document.fields.find( (f: Field) => f.type.name === 'DestinationAirportCode' ) as Field; } /** Document Form Serial Number */ get documentFormSerialNumber(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'DocumentFormSerialNumber'); } /** Document Type */ get documentType(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'DocumentType'); } /** Fast Track */ get fastTrack(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'FastTrack'); } /** First Non Consecutive Baggage Tag License Plate Number */ get firstNonConsecutiveBaggageTagLicensePlateNumber(): Field | undefined { return this.document.fields.find( (f: Field) => f.type.name === 'FirstNonConsecutiveBaggageTagLicensePlateNumber' ); } /** Flight Number */ get flightNumber(): Field { return this.document.fields.find((f: Field) => f.type.name === 'FlightNumber') as Field; } /** For Individual Airline Use */ get forIndividualAirlineUse(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'ForIndividualAirlineUse'); } /** Free Baggage Allowance */ get freeBaggageAllowance(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'FreeBaggageAllowance'); } /** Frequent Flyer Airline Designator */ get frequentFlyerAirlineDesignator(): Field | undefined { return this.document.fields.find( (f: Field) => f.type.name === 'FrequentFlyerAirlineDesignator' ); } /** Frequent Flyer Number */ get frequentFlyerNumber(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'FrequentFlyerNumber'); } /** IDAD Indicator */ get idadIndicator(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'IDADIndicator'); } /** International Documentation Verification */ get internationalDocumentationVerification(): Field | undefined { return this.document.fields.find( (f: Field) => f.type.name === 'InternationalDocumentationVerification' ); } /** Marketing Carrier Designator */ get marketingCarrierDesignator(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'MarketingCarrierDesignator'); } /** Operating Carrier Designator */ get operatingCarrierDesignator(): Field { return this.document.fields.find( (f: Field) => f.type.name === 'OperatingCarrierDesignator' ) as Field; } /** Operating Carrier PNR Code */ get operatingCarrierPNRCode(): Field { return this.document.fields.find( (f: Field) => f.type.name === 'OperatingCarrierPNRCode' ) as Field; } /** Passenger Description */ get passengerDescription(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'PassengerDescription'); } /** Passenger Status */ get passengerStatus(): Field { return this.document.fields.find((f: Field) => f.type.name === 'PassengerStatus') as Field; } /** Seat Number */ get seatNumber(): Field { return this.document.fields.find((f: Field) => f.type.name === 'SeatNumber') as Field; } /** Second Non Consecutive Baggage Tag License Plate Number */ get secondNonConsecutiveBaggageTagLicensePlateNumber(): Field | undefined { return this.document.fields.find( (f: Field) => f.type.name === 'SecondNonConsecutiveBaggageTagLicensePlateNumber' ); } /** Selectee Indicator */ get selecteeIndicator(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'SelecteeIndicator'); } /** Source Of Boarding Pass Issuance */ get sourceOfBoardingPassIssuance(): Field | undefined { return this.document.fields.find( (f: Field) => f.type.name === 'SourceOfBoardingPassIssuance' ); } /** Source Of Check In */ get sourceOfCheckIn(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'SourceOfCheckIn'); } /** VersionNumber */ get versionNumber(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'VersionNumber'); } } } /** SwissQR */ export class SwissQR { private _document: GenericDocument; get document(): GenericDocument { return this._document; } constructor(document: GenericDocument) { if (document.type.name !== this.requiredDocumentType()) { throw new Error( `Expected document type ${this.requiredDocumentType()}, got ${document.type.name}` ); } this._document = document; } requiredDocumentType(): string { return SwissQRDocumentType; } /** Additional Billing Information */ get additionalBillingInformation(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'AdditionalBillingInformation'); } /** Additional Info Trailer */ get additionalInfoTrailer(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'AdditionalInfoTrailer'); } /** Additional Info Unstructured */ get additionalInfoUnstructured(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'AdditionalInfoUnstructured'); } /** Alternative Procedure Parameter */ get alternativeProcedureParameter(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'AlternativeProcedureParameter'); } /** Amount */ get amount(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'Amount'); } /** Currency */ get currency(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'Currency'); } /** Debtor Address Type */ get debtorAddressType(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'DebtorAddressType'); } /** Debtor Building Or Address Line 2 */ get debtorBuildingOrAddressLine2(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'DebtorBuildingOrAddressLine2'); } /** Debtor Country */ get debtorCountry(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'DebtorCountry'); } /** Debtor Name */ get debtorName(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'DebtorName'); } /** Debtor Place */ get debtorPlace(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'DebtorPlace'); } /** Debtor Postal Code */ get debtorPostalCode(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'DebtorPostalCode'); } /** Debtor Street Or Address Line 1 */ get debtorStreetOrAddressLine1(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'DebtorStreetOrAddressLine1'); } /** Due Date */ get dueDate(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'DueDate'); } /** Encoding */ get encoding(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'Encoding'); } /** Final Payee Address Type */ get finalPayeeAddressType(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'FinalPayeeAddressType'); } /** Final Payee Building Or Address Line 2 */ get finalPayeeBuildingOrAddressLine2(): Field | undefined { return this.document.fields.find( (f: Field) => f.type.name === 'FinalPayeeBuildingOrAddressLine2' ); } /** Final Payee Country */ get finalPayeeCountry(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'FinalPayeeCountry'); } /** Final Payee Name */ get finalPayeeName(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'FinalPayeeName'); } /** Final Payee Place */ get finalPayeePlace(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'FinalPayeePlace'); } /** Final Payee Postal Code */ get finalPayeePostalCode(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'FinalPayeePostalCode'); } /** Final Payee Street Or Address Line 1 */ get finalPayeeStreetOrAddressLine1(): Field | undefined { return this.document.fields.find( (f: Field) => f.type.name === 'FinalPayeeStreetOrAddressLine1' ); } /** IBAN */ get iban(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'IBAN'); } /** Payee Address Type */ get payeeAddressType(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'PayeeAddressType'); } /** Payee Building Or Address Line 2 */ get payeeBuildingOrAddressLine2(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'PayeeBuildingOrAddressLine2'); } /** Payee Country */ get payeeCountry(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'PayeeCountry'); } /** Payee Name */ get payeeName(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'PayeeName'); } /** Payee Place */ get payeePlace(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'PayeePlace'); } /** Payee Postal Code */ get payeePostalCode(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'PayeePostalCode'); } /** Payee Street Or Address Line 1 */ get payeeStreetOrAddressLine1(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'PayeeStreetOrAddressLine1'); } /** Payment Reference */ get paymentReference(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'PaymentReference'); } /** Payment Reference Type */ get paymentReferenceType(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'PaymentReferenceType'); } /** Version */ get version(): Field { return this.document.fields.find((f: Field) => f.type.name === 'Version') as Field; } } /** Medical Plan */ export class DEMedicalPlan { private _document: GenericDocument; get document(): GenericDocument { return this._document; } constructor(document: GenericDocument) { if (document.type.name !== this.requiredDocumentType()) { throw new Error( `Expected document type ${this.requiredDocumentType()}, got ${document.type.name}` ); } this._document = document; } requiredDocumentType(): string { return DEMedicalPlanDocumentType; } /** Current Page */ get currentPage(): Field { return this.document.fields.find((f: Field) => f.type.name === 'CurrentPage') as Field; } /** Document Version Number */ get documentVersionNumber(): Field { return this.document.fields.find( (f: Field) => f.type.name === 'DocumentVersionNumber' ) as Field; } /** GUID */ get guid(): Field { return this.document.fields.find((f: Field) => f.type.name === 'GUID') as Field; } /** Language Country Code */ get languageCountryCode(): Field { return this.document.fields.find((f: Field) => f.type.name === 'LanguageCountryCode') as Field; } /** Patch Version Number */ get patchVersionNumber(): Field { return this.document.fields.find((f: Field) => f.type.name === 'PatchVersionNumber') as Field; } /** Total Number Of Pages */ get totalNumberOfPages(): Field { return this.document.fields.find((f: Field) => f.type.name === 'TotalNumberOfPages') as Field; } /** The child document of type "Patient". */ get patient(): DEMedicalPlan.Patient { const child = this.document.children.find((c: GenericDocument) => c.type.name === 'Patient'); return new DEMedicalPlan.Patient(child as GenericDocument); } /** The child document of type "Doctor". */ get doctor(): DEMedicalPlan.Doctor { const child = this.document.children.find((c: GenericDocument) => c.type.name === 'Doctor'); return new DEMedicalPlan.Doctor(child as GenericDocument); } /** An array of all children of type "Subheading". */ get subheadings(): DEMedicalPlan.Subheading[] { return this.document.children .filter((c: GenericDocument) => c.type.name === 'Subheading') .map((c: GenericDocument) => new DEMedicalPlan.Subheading(c)); } } export namespace DEMedicalPlan { /** Patient */ export class Patient { private _document: GenericDocument; get document(): GenericDocument { return this._document; } constructor(document: GenericDocument) { if (document.type.name !== this.requiredDocumentType()) { throw new Error( `Expected document type ${this.requiredDocumentType()}, got ${document.type.name}` ); } this._document = document; } requiredDocumentType(): string { return DEMedicalPlanPatientDocumentType; } /** Allergies And Intolerances */ get allergiesAndIntolerances(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'AllergiesAndIntolerances'); } /** Birth Date */ get birthDate(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'BirthDate'); } /** Breast Feeding */ get breastFeeding(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'BreastFeeding'); } /** Creatinine Value */ get creatinineValue(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'CreatinineValue'); } /** First Name */ get firstName(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'FirstName'); } /** Gender */ get gender(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'Gender'); } /** Height */ get height(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'Height'); } /** Last Name */ get lastName(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'LastName'); } /** Patient Free Text */ get patientFreeText(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'PatientFreeText'); } /** Patient ID */ get patientID(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'PatientID'); } /** Pre Name */ get preName(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'PreName'); } /** Pregnant */ get pregnant(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'Pregnant'); } /** Name Suffix */ get suffix(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'Suffix'); } /** Title */ get title(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'Title'); } /** Weight */ get weight(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'Weight'); } } /** Doctor */ export class Doctor { private _document: GenericDocument; get document(): GenericDocument { return this._document; } constructor(document: GenericDocument) { if (document.type.name !== this.requiredDocumentType()) { throw new Error( `Expected document type ${this.requiredDocumentType()}, got ${document.type.name}` ); } this._document = document; } requiredDocumentType(): string { return DEMedicalPlanDoctorDocumentType; } /** Doctor Number */ get doctorNumber(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'DoctorNumber'); } /** Email */ get email(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'Email'); } /** Hospital ID */ get hospitalID(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'HospitalID'); } /** Issuer Name */ get issuerName(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'IssuerName'); } /** Issuing Date And Time */ get issuingDateAndTime(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'IssuingDateAndTime'); } /** Pharmacy ID */ get pharmacyID(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'PharmacyID'); } /** Place */ get place(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'Place'); } /** Postal Code */ get postalCode(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'PostalCode'); } /** Street */ get street(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'Street'); } /** Telephone Number */ get telephoneNumber(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'TelephoneNumber'); } } /** Subheading */ export class Subheading { private _document: GenericDocument; get document(): GenericDocument { return this._document; } constructor(document: GenericDocument) { if (document.type.name !== this.requiredDocumentType()) { throw new Error( `Expected document type ${this.requiredDocumentType()}, got ${document.type.name}` ); } this._document = document; } requiredDocumentType(): string { return DEMedicalPlanSubheadingDocumentType; } /** General Note */ get generalNotes(): Field[] { return this.document.fields.filter((f: Field) => f.type.name === 'GeneralNote'); } /** Key Words */ get keyWords(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'KeyWords'); } /** Subheading Free Text */ get subheadingFreeText(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'SubheadingFreeText'); } /** An array of all children of type "Medicine". */ get medicines(): DEMedicalPlan.Subheading.Medicine[] { return this.document.children .filter((c: GenericDocument) => c.type.name === 'Medicine') .map((c: GenericDocument) => new DEMedicalPlan.Subheading.Medicine(c)); } /** An array of all children of type "Prescription". */ get prescriptions(): DEMedicalPlan.Subheading.Prescription[] { return this.document.children .filter((c: GenericDocument) => c.type.name === 'Prescription') .map((c: GenericDocument) => new DEMedicalPlan.Subheading.Prescription(c)); } } export namespace Subheading { /** Medicine */ export class Medicine { private _document: GenericDocument; get document(): GenericDocument { return this._document; } constructor(document: GenericDocument) { if (document.type.name !== this.requiredDocumentType()) { throw new Error( `Expected document type ${this.requiredDocumentType()}, got ${document.type.name}` ); } this._document = document; } requiredDocumentType(): string { return DEMedicalPlanSubheadingMedicineDocumentType; } /** Dosage Form */ get dosageForm(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'DosageForm'); } /** Dosage Form Free Text */ get dosageFormFreeText(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'DosageFormFreeText'); } /** Dosage Free Text */ get dosageFreeText(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'DosageFreeText'); } /** Dosing Unit */ get dosingUnit(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'DosingUnit'); } /** Dosing Unit Free Text */ get dosingUnitFreeText(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'DosingUnitFreeText'); } /** Drug Name */ get drugName(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'DrugName'); } /** Evening Intake Dose */ get evening(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'Evening'); } /** General Notes */ get generalNotes(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'GeneralNotes'); } /** Midday Intake Dose */ get midday(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'Midday'); } /** Morning Intake Dose */ get morning(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'Morning'); } /** Night Intake Dose */ get night(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'Night'); } /** Pharmaceutical Number */ get pharmaceuticalNumber(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'PharmaceuticalNumber'); } /** Reason For Treatment */ get reasonForTreatment(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'ReasonForTreatment'); } /** Relevant Info */ get relevantInfo(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'RelevantInfo'); } /** An array of all children of type "Substance". */ get substances(): DEMedicalPlan.Subheading.Medicine.Substance[] { return this.document.children .filter((c: GenericDocument) => c.type.name === 'Substance') .map((c: GenericDocument) => new DEMedicalPlan.Subheading.Medicine.Substance(c)); } } export namespace Medicine { /** Substance */ export class Substance { private _document: GenericDocument; get document(): GenericDocument { return this._document; } constructor(document: GenericDocument) { if (document.type.name !== this.requiredDocumentType()) { throw new Error( `Expected document type ${this.requiredDocumentType()}, got ${document.type.name}` ); } this._document = document; } requiredDocumentType(): string { return DEMedicalPlanSubheadingMedicineSubstanceDocumentType; } /** Active Substance */ get activeSubstance(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'ActiveSubstance'); } /** Potency */ get potency(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'Potency'); } } } /** Prescription */ export class Prescription { private _document: GenericDocument; get document(): GenericDocument { return this._document; } constructor(document: GenericDocument) { if (document.type.name !== this.requiredDocumentType()) { throw new Error( `Expected document type ${this.requiredDocumentType()}, got ${document.type.name}` ); } this._document = document; } requiredDocumentType(): string { return DEMedicalPlanSubheadingPrescriptionDocumentType; } /** General Information */ get generalInformation(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'GeneralInformation'); } /** Prescription Free Text */ get prescriptionFreeText(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'PrescriptionFreeText'); } } } } /** ID Card */ export class IDCardPDF417 { private _document: GenericDocument; get document(): GenericDocument { return this._document; } constructor(document: GenericDocument) { if (document.type.name !== this.requiredDocumentType()) { throw new Error( `Expected document type ${this.requiredDocumentType()}, got ${document.type.name}` ); } this._document = document; } requiredDocumentType(): string { return IDCardPDF417DocumentType; } /** Birth Date. The format is ISO8601 with delimiters */ get birthDate(): Field { return this.document.fields.find((f: Field) => f.type.name === 'BirthDate') as Field; } /** Date Expired. The format is ISO8601 with delimiters */ get dateExpired(): Field { return this.document.fields.find((f: Field) => f.type.name === 'DateExpired') as Field; } /** Date Issued. The format is ISO8601 with delimiters */ get dateIssued(): Field { return this.document.fields.find((f: Field) => f.type.name === 'DateIssued') as Field; } /** Document Code */ get documentCode(): Field { return this.document.fields.find((f: Field) => f.type.name === 'DocumentCode') as Field; } /** First Name */ get firstName(): Field { return this.document.fields.find((f: Field) => f.type.name === 'FirstName') as Field; } /** Last Name */ get lastName(): Field { return this.document.fields.find((f: Field) => f.type.name === 'LastName') as Field; } /** Optional */ get optional(): Field { return this.document.fields.find((f: Field) => f.type.name === 'Optional') as Field; } } /** GS1 */ export class GS1 { private _document: GenericDocument; get document(): GenericDocument { return this._document; } constructor(document: GenericDocument) { if (document.type.name !== this.requiredDocumentType()) { throw new Error( `Expected document type ${this.requiredDocumentType()}, got ${document.type.name}` ); } this._document = document; } requiredDocumentType(): string { return GS1DocumentType; } /** An array of all children of type "Element". */ get elements(): GS1.Element[] { return this.document.children .filter((c: GenericDocument) => c.type.name === 'Element') .map((c: GenericDocument) => new GS1.Element(c)); } } export namespace GS1 { /** GS1 Element */ export class Element { private _document: GenericDocument; get document(): GenericDocument { return this._document; } constructor(document: GenericDocument) { if (document.type.name !== this.requiredDocumentType()) { throw new Error( `Expected document type ${this.requiredDocumentType()}, got ${document.type.name}` ); } this._document = document; } requiredDocumentType(): string { return GS1ElementDocumentType; } /** Application Identifier */ get applicationIdentifier(): Field { return this.document.fields.find( (f: Field) => f.type.name === 'ApplicationIdentifier' ) as Field; } /** Data Title */ get dataTitle(): Field { return this.document.fields.find((f: Field) => f.type.name === 'DataTitle') as Field; } /** Description */ get elementDescription(): Field { return this.document.fields.find((f: Field) => f.type.name === 'ElementDescription') as Field; } /** Raw Value */ get rawValue(): Field { return this.document.fields.find((f: Field) => f.type.name === 'RawValue') as Field; } /** An array of all children of type "ValidationError". */ get validationErrors(): GS1.Element.ValidationError[] { return this.document.children .filter((c: GenericDocument) => c.type.name === 'ValidationError') .map((c: GenericDocument) => new GS1.Element.ValidationError(c)); } } export namespace Element { /** Validation Errors */ export class ValidationError { private _document: GenericDocument; get document(): GenericDocument { return this._document; } constructor(document: GenericDocument) { if (document.type.name !== this.requiredDocumentType()) { throw new Error( `Expected document type ${this.requiredDocumentType()}, got ${document.type.name}` ); } this._document = document; } requiredDocumentType(): string { return GS1ElementValidationErrorDocumentType; } /** Error Code */ get code(): Field { return this.document.fields.find((f: Field) => f.type.name === 'Code') as Field; } /** Reason */ get reason(): Field { return this.document.fields.find((f: Field) => f.type.name === 'Reason') as Field; } } } } /** SEPA */ export class SEPA { private _document: GenericDocument; get document(): GenericDocument { return this._document; } constructor(document: GenericDocument) { if (document.type.name !== this.requiredDocumentType()) { throw new Error( `Expected document type ${this.requiredDocumentType()}, got ${document.type.name}` ); } this._document = document; } requiredDocumentType(): string { return SEPADocumentType; } /** Amount */ get amount(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'Amount'); } /** Character Set */ get characterSet(): Field { return this.document.fields.find((f: Field) => f.type.name === 'CharacterSet') as Field; } /** Identification */ get identification(): Field { return this.document.fields.find((f: Field) => f.type.name === 'Identification') as Field; } /** Information */ get information(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'Information'); } /** Amount */ get purpose(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'Purpose'); } /** Receiver BIC */ get receiverBIC(): Field { return this.document.fields.find((f: Field) => f.type.name === 'ReceiverBIC') as Field; } /** Receiver IBAN */ get receiverIBAN(): Field { return this.document.fields.find((f: Field) => f.type.name === 'ReceiverIBAN') as Field; } /** Receiver Name */ get receiverName(): Field { return this.document.fields.find((f: Field) => f.type.name === 'ReceiverName') as Field; } /** Remittance */ get remittance(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'Remittance'); } /** Service Tag */ get serviceTag(): Field { return this.document.fields.find((f: Field) => f.type.name === 'ServiceTag') as Field; } /** Version */ get version(): Field { return this.document.fields.find((f: Field) => f.type.name === 'Version') as Field; } } /** Medical Certificate */ export class MedicalCertificate { private _document: GenericDocument; get document(): GenericDocument { return this._document; } constructor(document: GenericDocument) { if (document.type.name !== this.requiredDocumentType()) { throw new Error( `Expected document type ${this.requiredDocumentType()}, got ${document.type.name}` ); } this._document = document; } requiredDocumentType(): string { return MedicalCertificateDocumentType; } /** Accident */ get accident(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'Accident'); } /** Assigned To Accident Insurance Doctor */ get assignedToAccidentInsuranceDoctor(): Field | undefined { return this.document.fields.find( (f: Field) => f.type.name === 'AssignedToAccidentInsuranceDoctor' ); } /** Birth Date. The format is ISO8601 with delimiters */ get birthDate(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'BirthDate'); } /** Child Needs Care From */ get childNeedsCareFrom(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'ChildNeedsCareFrom'); } /** Child Needs Care Until */ get childNeedsCareUntil(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'ChildNeedsCareUntil'); } /** Diagnose */ get diagnose(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'Diagnose'); } /** Diagnosed On. The format is ISO8601 with delimiters */ get diagnosedOn(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'DiagnosedOn'); } /** Doctor Number */ get doctorNumber(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'DoctorNumber'); } /** Document Date. The format is ISO8601 with delimiters */ get documentDate(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'DocumentDate'); } /** First Name */ get firstName(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'FirstName'); } /** Health Insurance Number */ get healthInsuranceNumber(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'HealthInsuranceNumber'); } /** Incapable Of Work Since. The format is ISO8601 with delimiters */ get incapableOfWorkSince(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'IncapableOfWorkSince'); } /** Incapable Of Work Until. The format is ISO8601 with delimiters */ get incapableOfWorkUntil(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'IncapableOfWorkUntil'); } /** Initial Certificate */ get initialCertificate(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'InitialCertificate'); } /** Insured Person Number */ get insuredPersonNumber(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'InsuredPersonNumber'); } /** Last Name */ get lastName(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'LastName'); } /** Place Of Operation Number */ get placeOfOperationNumber(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'PlaceOfOperationNumber'); } /** Renewed Certificate */ get renewedCertificate(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'RenewedCertificate'); } /** Requires Care */ get requiresCare(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'RequiresCare'); } /** Status */ get status(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'Status'); } /** Work Accident */ get workAccident(): Field | undefined { return this.document.fields.find((f: Field) => f.type.name === 'WorkAccident'); } } /** VCard */ export class VCard { private _document: GenericDocument; get document(): GenericDocument { return this._document; } constructor(document: GenericDocument) { if (document.type.name !== this.requiredDocumentType()) { throw new Error( `Expected document type ${this.requiredDocumentType()}, got ${document.type.name}` ); } this._document = document; } requiredDocumentType(): string { return VCardDocumentType; } /** The child document of type "Version". */ get version(): VCard.Version { const child = this.document.children.find((c: GenericDocument) => c.type.name === 'Version'); return new VCard.Version(child as GenericDocument); } /** The child document of type "Source". */ get source(): VCard.Source | undefined { const child = this.document.children.find((c: GenericDocument) => c.type.name === 'Source'); return child ? new VCard.Source(child) : undefined; } /** The child document of type "Kind". */ get kind(): VCard.Kind | undefined { const child = this.document.children.find((c: GenericDocument) => c.type.name === 'Kind'); return child ? new VCard.Kind(child) : undefined; } /** The child document of type "XML". */ get xml(): VCard.XML | undefined { const child = this.document.children.find((c: GenericDocument) => c.type.name === 'XML'); return child ? new VCard.XML(child) : undefined; } /** The child document of type "Name". */ get name(): VCard.Name | undefined { const child = this.document.children.find((c: GenericDocument) => c.type.name === 'Name'); return child ? new VCard.Name(child) : undefined; } /** The child document of type "FirstName". */ get firstName(): VCard.FirstName | undefined { const child = this.document.children.find((c: GenericDocument) => c.type.name === 'FirstName'); return child ? new VCard.FirstName(child) : undefined; } /** The child document of type "Nickname". */ get nickname(): VCard.Nickname | undefined { const child = this.document.children.find((c: GenericDocument) => c.type.name === 'Nickname'); return child ? new VCard.Nickname(child) : undefined; } /** The child document of type "Birthday". */ get birthday(): VCard.Birthday | undefined { const child = this.document.children.find((c: GenericDocument) => c.type.name === 'Birthday'); return child ? new VCard.Birthday(child) : undefined; } /** The child document of type "Anniversary". */ get anniversary(): VCard.Anniversary | undefined { const child = this.document.children.find( (c: GenericDocument) => c.type.name === 'Anniversary' ); return child ? new VCard.Anniversary(child) : undefined; } /** The child document of type "Gender". */ get gender(): VCard.Gender | undefined { const child = this.document.children.find((c: GenericDocument) => c.type.name === 'Gender'); return child ? new VCard.Gender(child) : undefined; } /** The child document of type "DeliveryAddress". */ get deliveryAddress(): VCard.DeliveryAddress | undefined { const child = this.document.children.find( (c: GenericDocument) => c.type.name === 'DeliveryAddress' ); return child ? new VCard.DeliveryAddress(child) : undefined; } /** The child document of type "Photo". */ get photo(): VCard.Photo | undefined { const child = this.document.children.find((c: GenericDocument) => c.type.name === 'Photo'); return child ? new VCard.Photo(child) : undefined; } /** The child document of type "TelephoneNumber". */ get telephoneNumber(): VCard.TelephoneNumber | undefined { const child = this.document.children.find( (c: GenericDocument) => c.type.name === 'TelephoneNumber' ); return child ? new VCard.TelephoneNumber(child) : undefined; } /** The child document of type "Email". */ get email(): VCard.Email | undefined { const child = this.document.children.find((c: GenericDocument) => c.type.name === 'Email'); return child ? new VCard.Email(child) : undefined; } /** The child document of type "IMPP". */ get impp(): VCard.IMPP | undefined { const child = this.document.children.find((c: GenericDocument) => c.type.name === 'IMPP'); return child ? new VCard.IMPP(child) : undefined; } /** The child document of type "Languages". */ get languages(): VCard.Languages | undefined { const child = this.document.children.find((c: GenericDocument) => c.type.name === 'Languages'); return child ? new VCard.Languages(child) : undefined; } /** The child document of type "TimeZone". */ get timeZone(): VCard.TimeZone | undefined { const child = this.document.children.find((c: GenericDocument) => c.type.name === 'TimeZone'); return child ? new VCard.TimeZone(child) : undefined; } /** The child document of type "GeoLocation". */ get geoLocation(): VCard.GeoLocation | undefined { const child = this.document.children.find( (c: GenericDocument) => c.type.name === 'GeoLocation' ); return child ? new VCard.GeoLocation(child) : undefined; } /** The child document of type "Title". */ get title(): VCard.Title | undefined { const child = this.document.children.find((c: GenericDocument) => c.type.name === 'Title'); return child ? new VCard.Title(child) : undefined; } /** The child document of type "Role". */ get role(): VCard.Role | undefined { const child = this.document.children.find((c: GenericDocument) => c.type.name === 'Role'); return child ? new VCard.Role(child) : undefined; } /** The child document of type "Logo". */ get logo(): VCard.Logo | undefined { const child = this.document.children.find((c: GenericDocument) => c.type.name === 'Logo'); return child ? new VCard.Logo(child) : undefined; } /** The child document of type "Organisation". */ get organisation(): VCard.Organisation | undefined { const child = this.document.children.find( (c: GenericDocument) => c.type.name === 'Organisation' ); return chil