@tmlmobilidade/types
Version:
65 lines (64 loc) • 3 kB
TypeScript
/**
* 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;
/**
* Describes if the stop has a "has" field.
* 0 - Not Applicable for this stop
* 1 - Stop has no "has" field
* 2 - Has "has" field but is in bad condition
* 3 - Has "has" field and is in good condition
*/
export type GTFS_HasField = 0 | 1 | 2 | 3;
/**
* Validates and transforms a value into a GTFS_HasField type.
* It accepts numeric or string representations of "has" field values.
* If the value is not provided, it defaults to 0 (Not Applicable for this stop).
* @param value The value to validate and transform.
* @returns A GTFS_HasField value (0, 1, 2, or 3).
* @throws Error if the value is not a valid GTFS_HasField representation.
*/
export declare function validateGtfsHasField(value?: number | string): GTFS_HasField;