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

package ops

// 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"
)

// SecondaryconfirmApplyReq secondaryconfirm apply req
//
// swagger:model secondaryconfirm.ApplyReq
type SecondaryconfirmApplyReq struct {

	// apply strategy
	ApplyStrategy EntityApplyStrategy `json:"apply_strategy,omitempty"`

	// cluster id
	ClusterID string `json:"cluster_id,omitempty"`

	// config revision id
	ConfigRevisionID string `json:"config_revision_id,omitempty"`

	// created time
	CreatedTime int64 `json:"created_time,omitempty"`

	// project id
	ProjectID string `json:"project_id,omitempty"`
}

// Validate validates this secondaryconfirm apply req
func (m *SecondaryconfirmApplyReq) Validate(formats strfmt.Registry) error {
	var res []error

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

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

func (m *SecondaryconfirmApplyReq) validateApplyStrategy(formats strfmt.Registry) error {
	if swag.IsZero(m.ApplyStrategy) { // not required
		return nil
	}

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

	return nil
}

// ContextValidate validate this secondaryconfirm apply req based on the context it is used
func (m *SecondaryconfirmApplyReq) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	var res []error

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

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

func (m *SecondaryconfirmApplyReq) contextValidateApplyStrategy(ctx context.Context, formats strfmt.Registry) error {

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

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

	return nil
}

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

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