// Code generated by go-swagger; DO NOT EDIT.

package models

// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command

import (
	"context"

	"github.com/go-openapi/errors"
	"github.com/go-openapi/strfmt"
	"github.com/go-openapi/swag"
)

// Secrets20231128GetUsageResponse secrets 20231128 get usage response
//
// swagger:model secrets_20231128GetUsageResponse
type Secrets20231128GetUsageResponse struct {

	// access api counts
	AccessAPICounts *Secrets20231128UsageOptLimitRemaining `json:"access_api_counts,omitempty"`

	// apps
	Apps *Secrets20231128Usage `json:"apps,omitempty"`

	// billing tier
	BillingTier *Secrets20231128Tier `json:"billing_tier,omitempty"`

	// connected syncs
	ConnectedSyncs *Secrets20231128Usage `json:"connected_syncs,omitempty"`

	// dynamic secrets
	DynamicSecrets *Secrets20231128Usage `json:"dynamic_secrets,omitempty"`

	// gateway pools
	GatewayPools *Secrets20231128Usage `json:"gateway_pools,omitempty"`

	// integrations
	Integrations *Secrets20231128Usage `json:"integrations,omitempty"`

	// rotating secrets
	RotatingSecrets *Secrets20231128Usage `json:"rotating_secrets,omitempty"`

	// static secrets
	StaticSecrets *Secrets20231128Usage `json:"static_secrets,omitempty"`
}

// Validate validates this secrets 20231128 get usage response
func (m *Secrets20231128GetUsageResponse) Validate(formats strfmt.Registry) error {
	var res []error

	if err := m.validateAccessAPICounts(formats); err != nil {
		res = append(res, err)
	}

	if err := m.validateApps(formats); err != nil {
		res = append(res, err)
	}

	if err := m.validateBillingTier(formats); err != nil {
		res = append(res, err)
	}

	if err := m.validateConnectedSyncs(formats); err != nil {
		res = append(res, err)
	}

	if err := m.validateDynamicSecrets(formats); err != nil {
		res = append(res, err)
	}

	if err := m.validateGatewayPools(formats); err != nil {
		res = append(res, err)
	}

	if err := m.validateIntegrations(formats); err != nil {
		res = append(res, err)
	}

	if err := m.validateRotatingSecrets(formats); err != nil {
		res = append(res, err)
	}

	if err := m.validateStaticSecrets(formats); err != nil {
		res = append(res, err)
	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}

func (m *Secrets20231128GetUsageResponse) validateAccessAPICounts(formats strfmt.Registry) error {
	if swag.IsZero(m.AccessAPICounts) { // not required
		return nil
	}

	if m.AccessAPICounts != nil {
		if err := m.AccessAPICounts.Validate(formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("access_api_counts")
			} else if ce, ok := err.(*errors.CompositeError); ok {
				return ce.ValidateName("access_api_counts")
			}
			return err
		}
	}

	return nil
}

func (m *Secrets20231128GetUsageResponse) validateApps(formats strfmt.Registry) error {
	if swag.IsZero(m.Apps) { // not required
		return nil
	}

	if m.Apps != nil {
		if err := m.Apps.Validate(formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("apps")
			} else if ce, ok := err.(*errors.CompositeError); ok {
				return ce.ValidateName("apps")
			}
			return err
		}
	}

	return nil
}

func (m *Secrets20231128GetUsageResponse) validateBillingTier(formats strfmt.Registry) error {
	if swag.IsZero(m.BillingTier) { // not required
		return nil
	}

	if m.BillingTier != nil {
		if err := m.BillingTier.Validate(formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("billing_tier")
			} else if ce, ok := err.(*errors.CompositeError); ok {
				return ce.ValidateName("billing_tier")
			}
			return err
		}
	}

	return nil
}

func (m *Secrets20231128GetUsageResponse) validateConnectedSyncs(formats strfmt.Registry) error {
	if swag.IsZero(m.ConnectedSyncs) { // not required
		return nil
	}

	if m.ConnectedSyncs != nil {
		if err := m.ConnectedSyncs.Validate(formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("connected_syncs")
			} else if ce, ok := err.(*errors.CompositeError); ok {
				return ce.ValidateName("connected_syncs")
			}
			return err
		}
	}

	return nil
}

func (m *Secrets20231128GetUsageResponse) validateDynamicSecrets(formats strfmt.Registry) error {
	if swag.IsZero(m.DynamicSecrets) { // not required
		return nil
	}

	if m.DynamicSecrets != nil {
		if err := m.DynamicSecrets.Validate(formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("dynamic_secrets")
			} else if ce, ok := err.(*errors.CompositeError); ok {
				return ce.ValidateName("dynamic_secrets")
			}
			return err
		}
	}

	return nil
}

func (m *Secrets20231128GetUsageResponse) validateGatewayPools(formats strfmt.Registry) error {
	if swag.IsZero(m.GatewayPools) { // not required
		return nil
	}

	if m.GatewayPools != nil {
		if err := m.GatewayPools.Validate(formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("gateway_pools")
			} else if ce, ok := err.(*errors.CompositeError); ok {
				return ce.ValidateName("gateway_pools")
			}
			return err
		}
	}

	return nil
}

func (m *Secrets20231128GetUsageResponse) validateIntegrations(formats strfmt.Registry) error {
	if swag.IsZero(m.Integrations) { // not required
		return nil
	}

	if m.Integrations != nil {
		if err := m.Integrations.Validate(formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("integrations")
			} else if ce, ok := err.(*errors.CompositeError); ok {
				return ce.ValidateName("integrations")
			}
			return err
		}
	}

	return nil
}

func (m *Secrets20231128GetUsageResponse) validateRotatingSecrets(formats strfmt.Registry) error {
	if swag.IsZero(m.RotatingSecrets) { // not required
		return nil
	}

	if m.RotatingSecrets != nil {
		if err := m.RotatingSecrets.Validate(formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("rotating_secrets")
			} else if ce, ok := err.(*errors.CompositeError); ok {
				return ce.ValidateName("rotating_secrets")
			}
			return err
		}
	}

	return nil
}

func (m *Secrets20231128GetUsageResponse) validateStaticSecrets(formats strfmt.Registry) error {
	if swag.IsZero(m.StaticSecrets) { // not required
		return nil
	}

	if m.StaticSecrets != nil {
		if err := m.StaticSecrets.Validate(formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("static_secrets")
			} else if ce, ok := err.(*errors.CompositeError); ok {
				return ce.ValidateName("static_secrets")
			}
			return err
		}
	}

	return nil
}

// ContextValidate validate this secrets 20231128 get usage response based on the context it is used
func (m *Secrets20231128GetUsageResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	var res []error

	if err := m.contextValidateAccessAPICounts(ctx, formats); err != nil {
		res = append(res, err)
	}

	if err := m.contextValidateApps(ctx, formats); err != nil {
		res = append(res, err)
	}

	if err := m.contextValidateBillingTier(ctx, formats); err != nil {
		res = append(res, err)
	}

	if err := m.contextValidateConnectedSyncs(ctx, formats); err != nil {
		res = append(res, err)
	}

	if err := m.contextValidateDynamicSecrets(ctx, formats); err != nil {
		res = append(res, err)
	}

	if err := m.contextValidateGatewayPools(ctx, formats); err != nil {
		res = append(res, err)
	}

	if err := m.contextValidateIntegrations(ctx, formats); err != nil {
		res = append(res, err)
	}

	if err := m.contextValidateRotatingSecrets(ctx, formats); err != nil {
		res = append(res, err)
	}

	if err := m.contextValidateStaticSecrets(ctx, formats); err != nil {
		res = append(res, err)
	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}

func (m *Secrets20231128GetUsageResponse) contextValidateAccessAPICounts(ctx context.Context, formats strfmt.Registry) error {

	if m.AccessAPICounts != nil {

		if swag.IsZero(m.AccessAPICounts) { // not required
			return nil
		}

		if err := m.AccessAPICounts.ContextValidate(ctx, formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("access_api_counts")
			} else if ce, ok := err.(*errors.CompositeError); ok {
				return ce.ValidateName("access_api_counts")
			}
			return err
		}
	}

	return nil
}

func (m *Secrets20231128GetUsageResponse) contextValidateApps(ctx context.Context, formats strfmt.Registry) error {

	if m.Apps != nil {

		if swag.IsZero(m.Apps) { // not required
			return nil
		}

		if err := m.Apps.ContextValidate(ctx, formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("apps")
			} else if ce, ok := err.(*errors.CompositeError); ok {
				return ce.ValidateName("apps")
			}
			return err
		}
	}

	return nil
}

func (m *Secrets20231128GetUsageResponse) contextValidateBillingTier(ctx context.Context, formats strfmt.Registry) error {

	if m.BillingTier != nil {

		if swag.IsZero(m.BillingTier) { // not required
			return nil
		}

		if err := m.BillingTier.ContextValidate(ctx, formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("billing_tier")
			} else if ce, ok := err.(*errors.CompositeError); ok {
				return ce.ValidateName("billing_tier")
			}
			return err
		}
	}

	return nil
}

func (m *Secrets20231128GetUsageResponse) contextValidateConnectedSyncs(ctx context.Context, formats strfmt.Registry) error {

	if m.ConnectedSyncs != nil {

		if swag.IsZero(m.ConnectedSyncs) { // not required
			return nil
		}

		if err := m.ConnectedSyncs.ContextValidate(ctx, formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("connected_syncs")
			} else if ce, ok := err.(*errors.CompositeError); ok {
				return ce.ValidateName("connected_syncs")
			}
			return err
		}
	}

	return nil
}

func (m *Secrets20231128GetUsageResponse) contextValidateDynamicSecrets(ctx context.Context, formats strfmt.Registry) error {

	if m.DynamicSecrets != nil {

		if swag.IsZero(m.DynamicSecrets) { // not required
			return nil
		}

		if err := m.DynamicSecrets.ContextValidate(ctx, formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("dynamic_secrets")
			} else if ce, ok := err.(*errors.CompositeError); ok {
				return ce.ValidateName("dynamic_secrets")
			}
			return err
		}
	}

	return nil
}

func (m *Secrets20231128GetUsageResponse) contextValidateGatewayPools(ctx context.Context, formats strfmt.Registry) error {

	if m.GatewayPools != nil {

		if swag.IsZero(m.GatewayPools) { // not required
			return nil
		}

		if err := m.GatewayPools.ContextValidate(ctx, formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("gateway_pools")
			} else if ce, ok := err.(*errors.CompositeError); ok {
				return ce.ValidateName("gateway_pools")
			}
			return err
		}
	}

	return nil
}

func (m *Secrets20231128GetUsageResponse) contextValidateIntegrations(ctx context.Context, formats strfmt.Registry) error {

	if m.Integrations != nil {

		if swag.IsZero(m.Integrations) { // not required
			return nil
		}

		if err := m.Integrations.ContextValidate(ctx, formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("integrations")
			} else if ce, ok := err.(*errors.CompositeError); ok {
				return ce.ValidateName("integrations")
			}
			return err
		}
	}

	return nil
}

func (m *Secrets20231128GetUsageResponse) contextValidateRotatingSecrets(ctx context.Context, formats strfmt.Registry) error {

	if m.RotatingSecrets != nil {

		if swag.IsZero(m.RotatingSecrets) { // not required
			return nil
		}

		if err := m.RotatingSecrets.ContextValidate(ctx, formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("rotating_secrets")
			} else if ce, ok := err.(*errors.CompositeError); ok {
				return ce.ValidateName("rotating_secrets")
			}
			return err
		}
	}

	return nil
}

func (m *Secrets20231128GetUsageResponse) contextValidateStaticSecrets(ctx context.Context, formats strfmt.Registry) error {

	if m.StaticSecrets != nil {

		if swag.IsZero(m.StaticSecrets) { // not required
			return nil
		}

		if err := m.StaticSecrets.ContextValidate(ctx, formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("static_secrets")
			} else if ce, ok := err.(*errors.CompositeError); ok {
				return ce.ValidateName("static_secrets")
			}
			return err
		}
	}

	return nil
}

// MarshalBinary interface implementation
func (m *Secrets20231128GetUsageResponse) MarshalBinary() ([]byte, error) {
	if m == nil {
		return nil, nil
	}
	return swag.WriteJSON(m)
}

// UnmarshalBinary interface implementation
func (m *Secrets20231128GetUsageResponse) UnmarshalBinary(b []byte) error {
	var res Secrets20231128GetUsageResponse
	if err := swag.ReadJSON(b, &res); err != nil {
		return err
	}
	*m = res
	return nil
}
