UNPKG

@tmlmobilidade/types

Version:
46 lines (45 loc) 1.64 kB
import { type GTFS_Binary } from './common.js'; import { OperationalDate } from '@tmlmobilidade/go-types-shared'; /** * Represents a calendar in the GTFS (General Transit Feed Specification) format. * A calendar defines the days of the week on which a particular service is available, * along with the start and end dates of the service period. */ export interface GTFS_Calendar { end_date: OperationalDate; friday: GTFS_Binary; monday: GTFS_Binary; saturday: GTFS_Binary; service_id: string; start_date: OperationalDate; sunday: GTFS_Binary; thursday: GTFS_Binary; tuesday: GTFS_Binary; wednesday: GTFS_Binary; } /** * Represents a raw calendar in the GTFS format. * This interface is used to parse raw data from GTFS files, where fields may be optional * or represented as strings. It is typically used for data ingestion before validation * and transformation into the `GTFS_Calendar` format. */ export interface GTFS_Calendar_Raw { end_date?: string; friday?: string; monday?: string; saturday?: string; service_id?: string; start_date?: string; sunday?: string; thursday?: string; tuesday?: string; wednesday?: string; } /** * Validates and transforms a raw GTFS calendar into the GTFS_Calendar format. * This function checks the types of fields, converts boolean strings to boolean values, * and ensures that required fields are present. * @param rawData The raw calendar data to validate and transform. * @returns A validated GTFS_Calendar object. */ export declare function validateGtfsCalendar(rawData: GTFS_Calendar_Raw): GTFS_Calendar;