// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.

/*
 * (title)
 *
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * API version: 0.0.0
 */

package openapi




// MqttDisconnectPacketProperties - Represents the properties of an MQTT DISCONNECT packet.
type MqttDisconnectPacketProperties struct {

	// The DISCONNECT reason code defined in MQTT 5.0 spec. For MQTT 3.1.1 clients, it's always the default value 0.
	Code int32 `json:"code"`

	// The user properties in the DISCONNECT packet sent by the client. The value is not null only if the client sent a DISCONNECT packet with user properties.
	UserProperties []MqttUserProperty `json:"userProperties,omitempty"`
}

// AssertMqttDisconnectPacketPropertiesRequired checks if the required fields are not zero-ed
func AssertMqttDisconnectPacketPropertiesRequired(obj MqttDisconnectPacketProperties) error {
	elements := map[string]interface{}{
		"code": obj.Code,
	}
	for name, el := range elements {
		if isZero := IsZeroValue(el); isZero {
			return &RequiredError{Field: name}
		}
	}

	for _, el := range obj.UserProperties {
		if err := AssertMqttUserPropertyRequired(el); err != nil {
			return err
		}
	}
	return nil
}

// AssertMqttDisconnectPacketPropertiesConstraints checks if the values respects the defined constraints
func AssertMqttDisconnectPacketPropertiesConstraints(obj MqttDisconnectPacketProperties) error {
	for _, el := range obj.UserProperties {
		if err := AssertMqttUserPropertyConstraints(el); err != nil {
			return err
		}
	}
	return nil
}
