// 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 (
	"context"

	"github.com/go-openapi/errors"
	"github.com/go-openapi/strfmt"
	"github.com/go-openapi/swag"
	"github.com/go-openapi/validate"
)

// HostResource host resource
//
// swagger:model HostResource
type HostResource struct {

	// Free
	// Required: true
	Free *float64 `json:"free"`

	// Total
	// Required: true
	Total *float64 `json:"total"`

	// Used
	// Required: true
	Used *float64 `json:"used"`
}

// Validate validates this host resource
func (m *HostResource) Validate(formats strfmt.Registry) error {
	var res []error

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

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

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

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

func (m *HostResource) validateFree(formats strfmt.Registry) error {

	if err := validate.Required("free", "body", m.Free); err != nil {
		return err
	}

	return nil
}

func (m *HostResource) validateTotal(formats strfmt.Registry) error {

	if err := validate.Required("total", "body", m.Total); err != nil {
		return err
	}

	return nil
}

func (m *HostResource) validateUsed(formats strfmt.Registry) error {

	if err := validate.Required("used", "body", m.Used); err != nil {
		return err
	}

	return nil
}

// ContextValidate validates this host resource based on context it is used
func (m *HostResource) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	return nil
}

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

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