solidarity-service/internal/models.go

101 lines
3.6 KiB
Go

package internal
import (
"github.com/paulmach/orb/geojson"
)
const (
Punctual AvailabilitiesType = "PUNCTUAL"
Regular AvailabilitiesType = "REGULAR"
BookingStatusINITIATED BookingStatus = "INITIATED"
BookingStatusWAITINGPASSENGERCONFIRMATION BookingStatus = "WAITING_PASSENGER_CONFIRMATION"
BookingStatusWAITINGDRIVERCONFIRMATION BookingStatus = "WAITING_DRIVER_CONFIRMATION"
BookingStatusCONFIRMED BookingStatus = "CONFIRMED"
BookingStatusCANCELLED BookingStatus = "CANCELLED"
BookingStatusCOMPLETEDPENDINGVALIDATION BookingStatus = "COMPLETED_PENDING_VALIDATION"
BookingStatusVALIDATED BookingStatus = "VALIDATED"
)
type Passenger struct {
Passenger User
Preferences Preferences
}
type Driver struct {
Driver_departure_address *geojson.Feature
Radius int32
Driver User
Preferences Preferences
AvailabilitiesType AvailabilitiesType
RegularAvailabilities []RegularAvailabilities `json:"availabilities,omitempty"`
PunctualAvailabilities []PunctualAvailabilities `json:"availabilities,omitempty"`
Car Car `json:"car,omitempty"`
}
type Car struct {
Model string `json:"model,omitempty"`
Brand string `json:"brand,omitempty"`
}
type AvailabilitiesType string
type BookingStatus string
type User struct {
ID string `json:"id"`
Operator string `json:"operator"`
Alias string `json:"alias"`
FirstName string `json:"first_name,omitempty"`
LastName string `json:"last_name,omitempty"`
Grade int64 `json:"grade,omitempty"`
Picture string `json:"picture,omitempty"`
Gender string `json:"gender,omitempty"`
VerifiedIdentity bool `json:"verified_identity,omitempty"`
}
type Preferences struct {
Smoking bool `json:"smoking,omitempty"`
Animals bool `json:"animals,omitempty"`
Music bool `json:"music,omitempty"`
Is_talker bool `json:"is_talker,omitempty"`
Luggage_size int64 `json:"luggage_size,omitempty"`
}
type BookingRequest struct {
ID string `json:"id"`
Passenger_id string `json:"passenger_id"`
Driver_id string `json:"driver_id"`
Status BookingStatus `json:"booking_status"`
Details map[string]any `json:"booking_details"`
Operator string `json:"operator"`
Departure_address *geojson.Feature
Destination_address *geojson.Feature
Pickup_date int64 `json:"pickup_date"`
Duration int64 `json:"duration"`
Distance float64 `json:"distance"`
}
type Booking struct {
ID string `json:"id"`
Passenger User `json:"passenger"`
Driver User `json:"driver"`
PassengerPickupAddress *geojson.Feature
PassengerDropAddress *geojson.Feature
Status BookingStatus `json:"booking_status"`
Details map[string]any `json:"booking_details"`
Pickup_date int64 `json:"pickup_date"`
Duration int64 `json:"duration"`
Distance float64 `json:"distance"`
}
type RegularAvailabilities struct {
DayOfWeek string `json:"dayOfWeek"`
StartTime string `json:"startTime"`
EndTime string `json:"endTime"`
}
type PunctualAvailabilities struct {
Date int64 `json:"date"`
StartTime string `json:"startTime"`
EndTime string `json:"endTime"`
}