carpool-service/interoperability/ocss/journeys.go

45 lines
1.2 KiB
Go

package ocss
type JourneyScheduleType int64
const (
Planned JourneyScheduleType = iota
Dynamic
Line
)
func (t JourneyScheduleType) MarshalJSON() ([]byte, error) {
types := map[JourneyScheduleType]string{
Planned: "\"PLANNED\"",
Dynamic: "\"DYNAMIC\"",
Line: "\"Line\"",
}
return []byte(types[t]), nil
}
type JourneySchedule struct {
ID *string `json:"id,omitempty"`
PassengerPickupDate OCSSTime `json:"passengerPickupDate" bson:"passengerPickupDate"`
//PassengerDepartureDate *OCSSTime `json:"passengerDepartureDate,omitempty"`
DriverDepartureDate *OCSSTime `json:"driverDepartureDate,omitempty" bson:"driverDepartureDate,omitempty"`
WebUrl *string `json:"webUrl,omitempty" bson:"webUrl,omitempty"`
Type JourneyScheduleType `json:"type"`
}
type DriverJourney struct {
DriverTrip
JourneySchedule
AvailableSteats *int64 `json:"requestedSeats,omitempty" bson:"requestedSeats,omitempty"`
Price *Price `json:"price,omitempty" bson:"price,omitempty"`
}
type PassengerJourney struct {
PassengerTrip
JourneySchedule
//TODO how to handle requested driverDepartureDate
RequestedSteats *int64 `json:"requestedSeats,omitempty" bson:"requestedSeats,omitempty"`
}