turash/bugulma/backend/internal/domain/public_transport_gtfs.go
2025-12-15 10:06:41 +01:00

55 lines
1.9 KiB
Go

package domain
import "time"
// Trip represents GTFS trip
type Trip struct {
ID string `gorm:"primaryKey;type:varchar(64)" json:"trip_id"`
RouteID string `json:"route_id"`
ServiceID string `json:"service_id"`
TripHeadSign string `json:"trip_headsign"`
DirectionID *int `json:"direction_id"`
}
// StopTime represents GTFS stop_time
type StopTime struct {
ID uint `gorm:"primaryKey" json:"-"`
TripID string `gorm:"index" json:"trip_id"`
ArrivalTime string `json:"arrival_time"` // HH:MM:SS (can exceed 24:00:00)
DepartureTime string `json:"departure_time"`
DepartureSecs int `gorm:"index" json:"departure_secs"` // seconds since midnight (can exceed 86400)
StopID string `gorm:"index" json:"stop_id"`
StopSequence int `json:"stop_sequence"`
}
// Frequency represents GTFS frequencies.txt
type Frequency struct {
ID uint `gorm:"primaryKey" json:"-"`
TripID string `gorm:"index" json:"trip_id"`
StartTime string `json:"start_time"`
EndTime string `json:"end_time"`
HeadwaySecs int `json:"headway_secs"`
}
// ServiceCalendar represents GTFS calendar.txt
type ServiceCalendar struct {
ServiceID string `gorm:"primaryKey;type:varchar(64)" json:"service_id"`
Monday bool `json:"monday"`
Tuesday bool `json:"tuesday"`
Wednesday bool `json:"wednesday"`
Thursday bool `json:"thursday"`
Friday bool `json:"friday"`
Saturday bool `json:"saturday"`
Sunday bool `json:"sunday"`
StartDate time.Time `json:"start_date"`
EndDate time.Time `json:"end_date"`
}
// CalendarDate represents GTFS calendar_dates.txt exceptions
type CalendarDate struct {
ID uint `gorm:"primaryKey" json:"-"`
ServiceID string `gorm:"index" json:"service_id"`
Date time.Time `json:"date"`
ExceptionType int `json:"exception_type"` // 1 = added, 2 = removed
}