package plans

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

func getWorkerInfo(hub cortypes.Hub) exec.WorkerInfo {
	switch addr := hub.Address.(type) {
	case *cortypes.HttpAddressInfo:
		return &ioswitch2.HttpHubWorker{Hub: hub}

	case *cortypes.GRPCAddressInfo:
		return &ioswitch2.HubWorker{Hub: hub, Address: *addr}

	default:
		return nil
	}
}
