standard-covoiturage/carpool-bookings.go

51 lines
1.6 KiB
Go

package standardcovoiturage
import "time"
type CarpoolBookingStatus int64
const (
CarpoolBookingWaitingConfirmation CarpoolBookingStatus = iota
CarpoolBookingConfirmed
CarpoolBookingCancelled
CarpoolBookingCompletedPendingValidation
CarpoolBookingValidated
)
type CarpoolBookingEventData struct {
CarpoolBooking
DriverCarpoolBooking
PassengerCarpoolBooking
}
type CarpoolBookingEvent struct {
ID string `json:"id"` // TODO validate UUID
IDToken string `json:"idToken"`
Data CarpoolBookingEventData `json:"data"`
}
type CarpoolBooking struct {
ID string `json:"id"`
PassengerPickupDate time.Time `json:"passengerPickupDate"`
PassengerPickupLat float64 `json:"passengerPickupLat"`
PassengerPickupLng float64 `json:"passengerPickupLng"`
PassengerDropLat float64 `json:"passengerDropLat"`
PassengerDropLng float64 `json:"passengerDropLng"`
PassengerPickupAddress *string `json:"passengerPickupAddress,omitempty"`
PassengerDropAddress *string `json:"passengerDropAddress,omitempty"`
Status CarpoolBookingStatus `json:"status"`
Distance *int64 `json:"distance,omitempty"`
Duration *time.Duration `json:"duration,omitempty"`
WebUrl string `json:"webUrl"`
}
type PassengerCarpoolBooking struct {
Passenger User `json:"passenger"`
}
type DriverCarpoolBooking struct {
Driver User `json:"driver"`
Price Price `json:"price"`
Car *Car `json:"car,omitempty"`
}