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

package model

// 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"
	"github.com/go-openapi/validate"
)

// V1beta1ClusterUsage Message for usage statistics of a cluster.
//
// swagger:model v1beta1ClusterUsage
type V1beta1ClusterUsage struct {

	// Output_only. The storage used on column-based storage in bytes.
	// Read Only: true
	ColumnarStorage float64 `json:"columnarStorage,omitempty"`

	// Output_only. The Request Units used in this month.
	// Read Only: true
	RequestUnit string `json:"requestUnit,omitempty"`

	// Output_only. The storage used on row-based storage in bytes.
	// Read Only: true
	RowBasedStorage float64 `json:"rowBasedStorage,omitempty"`
}

// Validate validates this v1beta1 cluster usage
func (m *V1beta1ClusterUsage) Validate(formats strfmt.Registry) error {
	return nil
}

// ContextValidate validate this v1beta1 cluster usage based on the context it is used
func (m *V1beta1ClusterUsage) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	var res []error

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

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

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

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

func (m *V1beta1ClusterUsage) contextValidateColumnarStorage(ctx context.Context, formats strfmt.Registry) error {

	if err := validate.ReadOnly(ctx, "columnarStorage", "body", float64(m.ColumnarStorage)); err != nil {
		return err
	}

	return nil
}

func (m *V1beta1ClusterUsage) contextValidateRequestUnit(ctx context.Context, formats strfmt.Registry) error {

	if err := validate.ReadOnly(ctx, "requestUnit", "body", string(m.RequestUnit)); err != nil {
		return err
	}

	return nil
}

func (m *V1beta1ClusterUsage) contextValidateRowBasedStorage(ctx context.Context, formats strfmt.Registry) error {

	if err := validate.ReadOnly(ctx, "rowBasedStorage", "body", float64(m.RowBasedStorage)); err != nil {
		return err
	}

	return nil
}

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

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