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

// CloudconfigUnifiedParameterAttribute Attribute is the attribute of this config
// It may be nil if the parameter is not defined in the param dict.
//
// swagger:model cloudconfig.UnifiedParameter attribute
type CloudconfigUnifiedParameterAttribute struct {
	CloudconfigParameterAttribute
}

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

	return nil
}

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

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

// Validate validates this cloudconfig unified parameter attribute
func (m *CloudconfigUnifiedParameterAttribute) Validate(formats strfmt.Registry) error {
	var res []error

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

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

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

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

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

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

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