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

// CloudconfigUnifiedParameterCustom Custom is the custom config value
//
// swagger:model cloudconfig.UnifiedParameter custom
type CloudconfigUnifiedParameterCustom struct {
	CloudconfigParameterValue
}

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

	return nil
}

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

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

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

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

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

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

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

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

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

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