solidarity-service/interoperability/solidarity-api/server/openapi/model_booking_request.go

63 lines
2.2 KiB
Go
Raw Normal View History

2023-10-20 11:41:39 +00:00
/*
* Solidarity Mobility API
*
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* API version: 1.0.0
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
package openapi
type BookingRequest struct {
// Booking id is common between both operators, and must be created as a [UUID](https://datatracker.ietf.org/doc/html/rfc4122) by whoever initiates the booking. Usage of a [4 UUID](https://datatracker.ietf.org/doc/html/rfc4122#section-4.4) generation algorithm is advised.
Id string `json:"id"`
PassengerId string `json:"passengerId"`
DriverId string `json:"driverId"`
Status BookingStatus `json:"status"`
Operator string `json:"operator"`
2023-12-08 06:31:41 +00:00
DepartureAddressLat float64 `json:"departure_address_lat"`
DepartureAddressLong float64 `json:"departure_address_long"`
DestinationAddressLat float64 `json:"destination_address_lat"`
DestinationAddressLong float64 `json:"destination_address_long"`
DepartureAddress string `json:"departure_address"`
DestinationAddress string `json:"destination_address"`
Pickup_date int32 `json:"pickup_date"`
2023-10-20 11:41:39 +00:00
}
// AssertBookingRequestRequired checks if the required fields are not zero-ed
func AssertBookingRequestRequired(obj BookingRequest) error {
elements := map[string]interface{}{
2023-12-08 06:31:41 +00:00
"id": obj.Id,
"passengerId": obj.PassengerId,
"driverId": obj.DriverId,
"status": obj.Status,
"operator": obj.Operator,
"departure_address_lat": obj.DepartureAddressLat,
"departure_address_long": obj.DepartureAddressLong,
"destination_address_lat": obj.DestinationAddressLat,
"destination_address_long": obj.DestinationAddressLong,
"pickup_date": obj.Pickup_date,
"departure_address": obj.DepartureAddress,
"destination_address": obj.DestinationAddress,
2023-10-20 11:41:39 +00:00
}
for name, el := range elements {
if isZero := IsZeroValue(el); isZero {
return &RequiredError{Field: name}
}
}
return nil
}
// AssertBookingRequestConstraints checks if the values respects the defined constraints
func AssertBookingRequestConstraints(obj BookingRequest) error {
return nil
}