/*
 * Pipeline API
 *
 * Pipeline is a feature rich application platform, built for containers on top of Kubernetes to automate the DevOps experience, continuous application development and the lifecycle of deployments. 
 *
 * API version: latest
 * Contact: info@banzaicloud.com
 * Generated by: OpenAPI Generator (https://openapi-generator.tech)
 */

package pipeline

type CreateBackupRequest struct {

	Name string `json:"name"`

	Ttl string `json:"ttl"`

	Labels Labels `json:"labels,omitempty"`

	Options BackupOptions `json:"options,omitempty"`
}

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

	if err := AssertLabelsRequired(obj.Labels); err != nil {
		return err
	}
	if err := AssertBackupOptionsRequired(obj.Options); err != nil {
		return err
	}
	return nil
}

// AssertRecurseCreateBackupRequestRequired recursively checks if required fields are not zero-ed in a nested slice.
// Accepts only nested slice of CreateBackupRequest (e.g. [][]CreateBackupRequest), otherwise ErrTypeAssertionError is thrown.
func AssertRecurseCreateBackupRequestRequired(objSlice interface{}) error {
	return AssertRecurseInterfaceRequired(objSlice, func(obj interface{}) error {
		aCreateBackupRequest, ok := obj.(CreateBackupRequest)
		if !ok {
			return ErrTypeAssertionError
		}
		return AssertCreateBackupRequestRequired(aCreateBackupRequest)
	})
}
