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.

48 lines (47 loc) 2.25 kB
/** * The GTFS Binary type represents a boolean value * in the GTFS (General Transit Feed Specification) format. * GTFS uses 0 and 1 to indicate either TRUE / FALSE or fields * with binary states, such as direction or availability. */ export type GTFS_Binary = 0 | 1; /** * Validates and transforms a value into a GTFS Binary type. * It accepts numeric or string representations of boolean values. * If the value is not provided, it defaults to 0 (NO). * @param value The value to validate and transform. * @returns A GTFS_Binary value (0 or 1). * @throws Error if the value is not a valid GTFS boolean representation. */ export declare function validateGtfsBinary(value?: number | string): GTFS_Binary; /** * The GTFS Ternary type represents a value that can be one of three states: * 0 (NOT_SPECIFIED), 1 (YES), or 2 (NO). This is used in GTFS to indicate * optional or unknown states for certain fields, such as whether a service * is enabled, disabled, or unknown. */ export type GTFS_Ternary = 0 | 1 | 2; /** * Validates and transforms a value into a GTFS Ternary type. * It accepts numeric or string representations of ternary values. * If the value is not provided, it defaults to 0 (NOT_SPECIFIED). * @param value The value to validate and transform. * @returns A GTFS_Ternary value (0, 1, or 2). * @throws Error if the value is not a valid GTFS ternary representation. */ export declare function validateGtfsTernary(value?: number | string): GTFS_Ternary; /** * Represents the type of pickup or drop-off allowed for a transit service. * This is used in GTFS to indicate how passengers can be picked up or dropped off * at stops along a route. */ export type GTFS_PickupDropoffType = 0 | 1 | 2 | 3; /** * Validates and transforms a value into a PickupDropoffType. * It accepts numeric or string representations of pickup/drop-off types. * If the value is not provided, it defaults to 1 (Regular pickup or drop-off). * @param value The value to validate and transform. * @returns A PickupDropoffType value (0, 1, 2, or 3). * @throws Error if the value is not a valid PickupDropoffType representation. */ export declare function validateGtfsPickupDropoffType(value?: number | string): GTFS_PickupDropoffType;