package param

import (
	"gitlink.org.cn/JointCloud/pcm-coordinator/internal/scheduler/algorithm/providerPricing"
	"strconv"
)

type ResourcePricingParams struct {
	Replicas int32
	task     *providerPricing.Task
	*Params
}

func (r *ResourcePricingParams) GetReplicas() int32 {
	return r.Replicas
}

func (r *ResourcePricingParams) GetTask() *providerPricing.Task {
	return r.task
}

func (r *ResourcePricingParams) GetProviders() []*providerPricing.Provider {
	var providerList []*providerPricing.Provider
	for _, resource := range r.Resources {
		id, _ := strconv.ParseInt(resource.ClusterId, 10, 64)
		provider := providerPricing.NewProvider(
			id,
			float64(resource.CpuCoreAvail),
			resource.MemAvail,
			resource.DiskAvail, 0.0, 0.0, 0.0)
		providerList = append(providerList, provider)
	}
	return providerList
}
