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

// CloudconfigUsedParameterSource Source is the value source of this parameter
//
// swagger:model cloudconfig.UsedParameter source
type CloudconfigUsedParameterSource struct {
	CloudconfigParameterSource
}

// UnmarshalJSON unmarshals this object from a JSON structure
func (m *CloudconfigUsedParameterSource) UnmarshalJSON(raw []byte) error {
	// AO0
	var aO0 CloudconfigParameterSource
	if err := swag.ReadJSON(raw, &aO0); err != nil {
		return err
	}
	m.CloudconfigParameterSource = aO0

	return nil
}

// MarshalJSON marshals this object to a JSON structure
func (m CloudconfigUsedParameterSource) MarshalJSON() ([]byte, error) {
	_parts := make([][]byte, 0, 1)

	aO0, err := swag.WriteJSON(m.CloudconfigParameterSource)
	if err != nil {
		return nil, err
	}
	_parts = append(_parts, aO0)
	return swag.ConcatJSON(_parts...), nil
}

// Validate validates this cloudconfig used parameter source
func (m *CloudconfigUsedParameterSource) Validate(formats strfmt.Registry) error {
	var res []error

	// validation for a type composition with CloudconfigParameterSource
	if err := m.CloudconfigParameterSource.Validate(formats); err != nil {
		res = append(res, err)
	}

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

// ContextValidate validate this cloudconfig used parameter source based on the context it is used
func (m *CloudconfigUsedParameterSource) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	var res []error

	// validation for a type composition with CloudconfigParameterSource
	if err := m.CloudconfigParameterSource.ContextValidate(ctx, formats); err != nil {
		res = append(res, err)
	}

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

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

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