/*
 * 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 PostConnectionsRequest struct {
	From User `json:"from"`

	To User `json:"to"`

	// Free text content of a message. The message can contain all the details (phone number, email, etc.) allowing the recipient to call back the sender in order to carpool with him/her.
	Message string `json:"message"`

	// Defines if the recipient of this message is either the driver or the passenger.
	RecipientCarpoolerType string `json:"recipientCarpoolerType"`

	// ID of the Driver's journey to which the message is related (if any). Unique given the `Driver`'s `operator` property.
	DriverJourneyId string `json:"driverJourneyId,omitempty"`

	// ID of the Passenger's journey to which the message is related (if any). Unique given the `Passenger`'s `operator` property.
	PassengerJourneyId string `json:"passengerJourneyId,omitempty"`

	// 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.
	BookingId string `json:"bookingId,omitempty"`
}

// AssertPostConnectionsRequestRequired checks if the required fields are not zero-ed
func AssertPostConnectionsRequestRequired(obj PostConnectionsRequest) error {
	elements := map[string]interface{}{
		"from":                   obj.From,
		"to":                     obj.To,
		"message":                obj.Message,
		"recipientCarpoolerType": obj.RecipientCarpoolerType,
	}
	for name, el := range elements {
		if isZero := IsZeroValue(el); isZero {
			return &RequiredError{Field: name}
		}
	}

	if err := AssertUserRequired(obj.From); err != nil {
		return err
	}
	if err := AssertUserRequired(obj.To); err != nil {
		return err
	}
	return nil
}

// AssertPostConnectionsRequestConstraints checks if the values respects the defined constraints
func AssertPostConnectionsRequestConstraints(obj PostConnectionsRequest) error {
	return nil
}
