UNPKG

@tmlmobilidade/types

Version:

This package provides shared Zod validation schemas and their corresponding TypeScript types for use across projects. All types are automatically inferred from the schemas to ensure full type safety and reduce maintenance overhead.

459 lines (458 loc) • 15.2 kB
import { type UnixTimestamp } from '../_common/unix-timestamp.js'; import { z } from 'zod'; export declare const ApexValidationStatus: { /** * VALID: * The card holder had a valid contract for the given context. */ readonly _0_ContractValid: 0; /** * INVALID: * The card holder already has a valid validation for the given context. */ readonly _1_Antipassback: 1; /** * INVALID: * The card holder's card is in the black list. */ readonly _2_CardInBlackList: 2; /** * INVALID: * The validator SAM is in the black list. */ readonly _3_SamInBlackList: 3; /** * VALID: * The card holder's card is in the white list. */ readonly _4_CardInWhiteList: 4; /** * VALID: * The card holder's profile is in the white list. */ readonly _5_ProfileInWhiteList: 5; /** * VALID: * The context allows for validation re-use. */ readonly _6_Interchange: 6; /** * INVALID: * The validation could not be written to the card. */ readonly _7_Interrupted: 7; /** * INVALID: * The card holder does not have a valid contract for the given context. */ readonly _8_NoValidContract: 8; /** * INVALID: * The card holder's card is invalidated. */ readonly _9_CardInvalidated: 9; /** * INVALID: * The card holder's card or the validator's SAM has no more space for events. */ readonly _10_EventsFull: 10; /** * INVALID: * The card holder's card does not have enough units for the given context. */ readonly _11_NotEnoughUnits: 11; /** * INVALID: * The card holder's contract has expired. */ readonly _12_ContractExpired: 12; /** * INVALID: * The maximum value for the validation status. This is used to validate the status. */ readonly _13_MaxValue: 13; }; export declare const ApexValidationStatusSchema: z.ZodNativeEnum<{ /** * VALID: * The card holder had a valid contract for the given context. */ readonly _0_ContractValid: 0; /** * INVALID: * The card holder already has a valid validation for the given context. */ readonly _1_Antipassback: 1; /** * INVALID: * The card holder's card is in the black list. */ readonly _2_CardInBlackList: 2; /** * INVALID: * The validator SAM is in the black list. */ readonly _3_SamInBlackList: 3; /** * VALID: * The card holder's card is in the white list. */ readonly _4_CardInWhiteList: 4; /** * VALID: * The card holder's profile is in the white list. */ readonly _5_ProfileInWhiteList: 5; /** * VALID: * The context allows for validation re-use. */ readonly _6_Interchange: 6; /** * INVALID: * The validation could not be written to the card. */ readonly _7_Interrupted: 7; /** * INVALID: * The card holder does not have a valid contract for the given context. */ readonly _8_NoValidContract: 8; /** * INVALID: * The card holder's card is invalidated. */ readonly _9_CardInvalidated: 9; /** * INVALID: * The card holder's card or the validator's SAM has no more space for events. */ readonly _10_EventsFull: 10; /** * INVALID: * The card holder's card does not have enough units for the given context. */ readonly _11_NotEnoughUnits: 11; /** * INVALID: * The card holder's contract has expired. */ readonly _12_ContractExpired: 12; /** * INVALID: * The maximum value for the validation status. This is used to validate the status. */ readonly _13_MaxValue: 13; }>; export declare const SimplifiedApexValidationSchema: z.ZodObject<{ _id: z.ZodString; created_at: z.ZodOptional<z.ZodNullable<z.ZodBranded<z.ZodEffects<z.ZodNumber, UnixTimestamp, number>, "UnixTimestamp">>>; updated_at: z.ZodOptional<z.ZodNullable<z.ZodBranded<z.ZodEffects<z.ZodNumber, UnixTimestamp, number>, "UnixTimestamp">>>; } & { agency_id: z.ZodString; apex_version: z.ZodString; card_serial_number: z.ZodString; device_id: z.ZodString; event_type: z.ZodNumber; is_passenger: z.ZodBoolean; line_id: z.ZodString; mac_ase_counter_value: z.ZodNumber; mac_sam_serial_number: z.ZodNumber; on_board_refund_id: z.ZodNullable<z.ZodString>; on_board_sale_id: z.ZodNullable<z.ZodString>; pattern_id: z.ZodString; product_id: z.ZodString; received_at: z.ZodBranded<z.ZodEffects<z.ZodNumber, UnixTimestamp, number>, "UnixTimestamp">; stop_id: z.ZodString; trip_id: z.ZodString; units_qty: z.ZodNullable<z.ZodNumber>; validation_status: z.ZodNativeEnum<{ /** * VALID: * The card holder had a valid contract for the given context. */ readonly _0_ContractValid: 0; /** * INVALID: * The card holder already has a valid validation for the given context. */ readonly _1_Antipassback: 1; /** * INVALID: * The card holder's card is in the black list. */ readonly _2_CardInBlackList: 2; /** * INVALID: * The validator SAM is in the black list. */ readonly _3_SamInBlackList: 3; /** * VALID: * The card holder's card is in the white list. */ readonly _4_CardInWhiteList: 4; /** * VALID: * The card holder's profile is in the white list. */ readonly _5_ProfileInWhiteList: 5; /** * VALID: * The context allows for validation re-use. */ readonly _6_Interchange: 6; /** * INVALID: * The validation could not be written to the card. */ readonly _7_Interrupted: 7; /** * INVALID: * The card holder does not have a valid contract for the given context. */ readonly _8_NoValidContract: 8; /** * INVALID: * The card holder's card is invalidated. */ readonly _9_CardInvalidated: 9; /** * INVALID: * The card holder's card or the validator's SAM has no more space for events. */ readonly _10_EventsFull: 10; /** * INVALID: * The card holder's card does not have enough units for the given context. */ readonly _11_NotEnoughUnits: 11; /** * INVALID: * The card holder's contract has expired. */ readonly _12_ContractExpired: 12; /** * INVALID: * The maximum value for the validation status. This is used to validate the status. */ readonly _13_MaxValue: 13; }>; vehicle_id: z.ZodNumber; }, "strict", z.ZodTypeAny, { _id: string; agency_id: string; line_id: string; pattern_id: string; trip_id: string; apex_version: string; device_id: string; mac_ase_counter_value: number; mac_sam_serial_number: number; received_at: number & { __brand: "UnixTimestamp"; } & z.BRAND<"UnixTimestamp">; stop_id: string; vehicle_id: number; card_serial_number: string; on_board_sale_id: string | null; is_passenger: boolean; on_board_refund_id: string | null; event_type: number; product_id: string; units_qty: number | null; validation_status: 0 | 1 | 2 | 3 | 12 | 11 | 4 | 8 | 10 | 5 | 6 | 7 | 9 | 13; created_at?: (number & { __brand: "UnixTimestamp"; } & z.BRAND<"UnixTimestamp">) | null | undefined; updated_at?: (number & { __brand: "UnixTimestamp"; } & z.BRAND<"UnixTimestamp">) | null | undefined; }, { _id: string; agency_id: string; line_id: string; pattern_id: string; trip_id: string; apex_version: string; device_id: string; mac_ase_counter_value: number; mac_sam_serial_number: number; received_at: number; stop_id: string; vehicle_id: number; card_serial_number: string; on_board_sale_id: string | null; is_passenger: boolean; on_board_refund_id: string | null; event_type: number; product_id: string; units_qty: number | null; validation_status: 0 | 1 | 2 | 3 | 12 | 11 | 4 | 8 | 10 | 5 | 6 | 7 | 9 | 13; created_at?: number | null | undefined; updated_at?: number | null | undefined; }>; export declare const UpdateSimplifiedApexValidationSchema: z.ZodObject<{ _id: z.ZodOptional<z.ZodString>; created_at: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodBranded<z.ZodEffects<z.ZodNumber, UnixTimestamp, number>, "UnixTimestamp">>>>; updated_at: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodBranded<z.ZodEffects<z.ZodNumber, UnixTimestamp, number>, "UnixTimestamp">>>>; agency_id: z.ZodOptional<z.ZodString>; apex_version: z.ZodOptional<z.ZodString>; card_serial_number: z.ZodOptional<z.ZodString>; device_id: z.ZodOptional<z.ZodString>; event_type: z.ZodOptional<z.ZodNumber>; is_passenger: z.ZodOptional<z.ZodBoolean>; line_id: z.ZodOptional<z.ZodString>; mac_ase_counter_value: z.ZodOptional<z.ZodNumber>; mac_sam_serial_number: z.ZodOptional<z.ZodNumber>; on_board_refund_id: z.ZodOptional<z.ZodNullable<z.ZodString>>; on_board_sale_id: z.ZodOptional<z.ZodNullable<z.ZodString>>; pattern_id: z.ZodOptional<z.ZodString>; product_id: z.ZodOptional<z.ZodString>; received_at: z.ZodOptional<z.ZodBranded<z.ZodEffects<z.ZodNumber, UnixTimestamp, number>, "UnixTimestamp">>; stop_id: z.ZodOptional<z.ZodString>; trip_id: z.ZodOptional<z.ZodString>; units_qty: z.ZodOptional<z.ZodNullable<z.ZodNumber>>; validation_status: z.ZodOptional<z.ZodNativeEnum<{ /** * VALID: * The card holder had a valid contract for the given context. */ readonly _0_ContractValid: 0; /** * INVALID: * The card holder already has a valid validation for the given context. */ readonly _1_Antipassback: 1; /** * INVALID: * The card holder's card is in the black list. */ readonly _2_CardInBlackList: 2; /** * INVALID: * The validator SAM is in the black list. */ readonly _3_SamInBlackList: 3; /** * VALID: * The card holder's card is in the white list. */ readonly _4_CardInWhiteList: 4; /** * VALID: * The card holder's profile is in the white list. */ readonly _5_ProfileInWhiteList: 5; /** * VALID: * The context allows for validation re-use. */ readonly _6_Interchange: 6; /** * INVALID: * The validation could not be written to the card. */ readonly _7_Interrupted: 7; /** * INVALID: * The card holder does not have a valid contract for the given context. */ readonly _8_NoValidContract: 8; /** * INVALID: * The card holder's card is invalidated. */ readonly _9_CardInvalidated: 9; /** * INVALID: * The card holder's card or the validator's SAM has no more space for events. */ readonly _10_EventsFull: 10; /** * INVALID: * The card holder's card does not have enough units for the given context. */ readonly _11_NotEnoughUnits: 11; /** * INVALID: * The card holder's contract has expired. */ readonly _12_ContractExpired: 12; /** * INVALID: * The maximum value for the validation status. This is used to validate the status. */ readonly _13_MaxValue: 13; }>>; vehicle_id: z.ZodOptional<z.ZodNumber>; }, "strict", z.ZodTypeAny, { _id?: string | undefined; created_at?: (number & { __brand: "UnixTimestamp"; } & z.BRAND<"UnixTimestamp">) | null | undefined; updated_at?: (number & { __brand: "UnixTimestamp"; } & z.BRAND<"UnixTimestamp">) | null | undefined; agency_id?: string | undefined; line_id?: string | undefined; pattern_id?: string | undefined; trip_id?: string | undefined; apex_version?: string | undefined; device_id?: string | undefined; mac_ase_counter_value?: number | undefined; mac_sam_serial_number?: number | undefined; received_at?: (number & { __brand: "UnixTimestamp"; } & z.BRAND<"UnixTimestamp">) | undefined; stop_id?: string | undefined; vehicle_id?: number | undefined; card_serial_number?: string | undefined; on_board_sale_id?: string | null | undefined; is_passenger?: boolean | undefined; on_board_refund_id?: string | null | undefined; event_type?: number | undefined; product_id?: string | undefined; units_qty?: number | null | undefined; validation_status?: 0 | 1 | 2 | 3 | 12 | 11 | 4 | 8 | 10 | 5 | 6 | 7 | 9 | 13 | undefined; }, { _id?: string | undefined; created_at?: number | null | undefined; updated_at?: number | null | undefined; agency_id?: string | undefined; line_id?: string | undefined; pattern_id?: string | undefined; trip_id?: string | undefined; apex_version?: string | undefined; device_id?: string | undefined; mac_ase_counter_value?: number | undefined; mac_sam_serial_number?: number | undefined; received_at?: number | undefined; stop_id?: string | undefined; vehicle_id?: number | undefined; card_serial_number?: string | undefined; on_board_sale_id?: string | null | undefined; is_passenger?: boolean | undefined; on_board_refund_id?: string | null | undefined; event_type?: number | undefined; product_id?: string | undefined; units_qty?: number | null | undefined; validation_status?: 0 | 1 | 2 | 3 | 12 | 11 | 4 | 8 | 10 | 5 | 6 | 7 | 9 | 13 | undefined; }>; /** * APEX Validations are APEX transactions of type 11 that are generated when a card holder touches a validator * reader (ex: bus validator, subway gate). These validation transactions represent the card holder's right to travel * on a given route, line, or vehicle. T11s have statuses that indicate if the card holder was allowed to travel * or not, and with which conditions. A validation also contains information about the card holder's card, the vehicle, * the validator machine, the route, and the time and location of the validation. */ export interface SimplifiedApexValidation extends Omit<z.infer<typeof SimplifiedApexValidationSchema>, 'created_at' | 'received_at' | 'updated_at'> { created_at: UnixTimestamp; received_at: UnixTimestamp; updated_at: UnixTimestamp; } export type UpdateSimplifiedApexValidationDto = Partial<SimplifiedApexValidation>; /** * Validation statuses that are considered valid for the card holder to travel. */ export declare const ALLOWED_VALIDATION_STATUSES: (0 | 4 | 5 | 6)[];