package coordinator

import (
	"gitlink.org.cn/cloudream/common/pkgs/mq"
	cortypes "gitlink.org.cn/cloudream/jcs-pub/coordinator/types"
)

type StorageService interface {
	GetStorageDetails(msg *GetStorageDetails) (*GetStorageDetailsResp, *mq.CodeMessage)
}

// 获取Storage信息
var _ = Register(Service.GetStorageDetails)

type GetStorageDetails struct {
	mq.MessageBodyBase
	StorageIDs []cortypes.StorageID `json:"storageIDs"`
}
type GetStorageDetailsResp struct {
	mq.MessageBodyBase
	Storage []*cortypes.StorageDetail `json:"storages"`
}

func ReqGetStorageDetails(storageIDs []cortypes.StorageID) *GetStorageDetails {
	return &GetStorageDetails{
		StorageIDs: storageIDs,
	}
}
func RespGetStorageDetails(stgs []*cortypes.StorageDetail) *GetStorageDetailsResp {
	return &GetStorageDetailsResp{
		Storage: stgs,
	}
}
func (client *Client) GetStorageDetails(msg *GetStorageDetails) (*GetStorageDetailsResp, error) {
	return mq.Request(Service.GetStorageDetails, client.rabbitCli, msg)
}
