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

	strfmt "github.com/go-openapi/strfmt"

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

// MultiClusterRecommendationReq MultiClusterRecommendationReq encapsulates the recommendation input data
// swagger:model MultiClusterRecommendationReq
type MultiClusterRecommendationReq struct {

	// Are burst instances allowed in recommendation
	AllowBurst bool `json:"allowBurst,omitempty"`

	// AllowOlderGen allow older generations of virtual machines (applies for EC2 only)
	AllowOlderGen bool `json:"allowOlderGen,omitempty"`

	// Category specifies the virtual machine category
	Category []string `json:"category"`

	// continents
	Continents []string `json:"continents"`

	// Excludes is a blacklist - a slice with vm types to be excluded from the recommendation
	Excludes map[string]map[string][]string `json:"excludes,omitempty"`

	// Includes is a whitelist - a slice with vm types to be contained in the recommendation
	Includes map[string]map[string][]string `json:"includes,omitempty"`

	// Maximum number of nodes in the recommended cluster
	MaxNodes int64 `json:"maxNodes,omitempty"`

	// Minimum number of nodes in the recommended cluster
	MinNodes int64 `json:"minNodes,omitempty"`

	// NetworkPerf specifies the network performance category
	NetworkPerf []string `json:"networkPerf"`

	// Percentage of regular (on-demand) nodes in the recommended cluster
	OnDemandPct int64 `json:"onDemandPct,omitempty"`

	// providers
	Providers []*Provider `json:"providers"`

	// Maximum number of response per service
	RespPerService int64 `json:"respPerService,omitempty"`

	// If true, recommended instance types will have a similar size
	SameSize bool `json:"sameSize,omitempty"`

	// Total number of CPUs requested for the cluster
	SumCPU float64 `json:"sumCpu,omitempty"`

	// Total number of GPUs requested for the cluster
	SumGpu int64 `json:"sumGpu,omitempty"`

	// Total memory requested for the cluster (GB)
	SumMem float64 `json:"sumMem,omitempty"`
}

// Validate validates this multi cluster recommendation req
func (m *MultiClusterRecommendationReq) Validate(formats strfmt.Registry) error {
	var res []error

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

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

func (m *MultiClusterRecommendationReq) validateProviders(formats strfmt.Registry) error {

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

	for i := 0; i < len(m.Providers); i++ {
		if swag.IsZero(m.Providers[i]) { // not required
			continue
		}

		if m.Providers[i] != nil {
			if err := m.Providers[i].Validate(formats); err != nil {
				if ve, ok := err.(*errors.Validation); ok {
					return ve.ValidateName("providers" + "." + strconv.Itoa(i))
				}
				return err
			}
		}

	}

	return nil
}

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

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