// 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 (
	"github.com/go-openapi/errors"
	"github.com/go-openapi/strfmt"
	"github.com/go-openapi/swag"
)

// CalcClusterFeeRespComponentCost calc cluster fee resp component cost
//
// swagger:model CalcClusterFeeRespComponentCost
type CalcClusterFeeRespComponentCost struct {

	// component type
	ComponentType CentralComponentType `json:"component_type,omitempty"`

	// compute
	Compute float64 `json:"compute,omitempty"`

	// storage
	Storage float64 `json:"storage,omitempty"`
}

// Validate validates this calc cluster fee resp component cost
func (m *CalcClusterFeeRespComponentCost) Validate(formats strfmt.Registry) error {
	var res []error

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

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

func (m *CalcClusterFeeRespComponentCost) validateComponentType(formats strfmt.Registry) error {

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

	if err := m.ComponentType.Validate(formats); err != nil {
		if ve, ok := err.(*errors.Validation); ok {
			return ve.ValidateName("component_type")
		}
		return err
	}

	return nil
}

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

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