package region

import (
	"context"

	"go.opentelemetry.io/otel"

	openapidedicatedv1beta1 "github.com/tidbcloud/tidb-management-service/api/spec/tidb_cloud_open_api/dedicated/v1beta1"
	"github.com/tidbcloud/tidb-management-service/tidb-mgmt-service/domain/adapter/account"
	"github.com/tidbcloud/tidb-management-service/tidb-mgmt-service/domain/adapter/dedicatedglobal"
)

var tracer = otel.Tracer("App.Dedicated.Region")

type Server interface {
	openapidedicatedv1beta1.RegionServiceServer

	GetNodeSpecForPrice(ctx context.Context, req *openapidedicatedv1beta1.GetNodeSpecRequest) (*openapidedicatedv1beta1.NodeSpec, error)
}

type serverImpl struct {
	dedicatedCli dedicatedglobal.DedicatedGlobal
	accountCli   account.Client
}

func NewServer(
	dedicatedCli dedicatedglobal.DedicatedGlobal,
	accountCli account.Client,
) Server {
	return &serverImpl{
		dedicatedCli: dedicatedCli,
		accountCli:   accountCli,
	}
}
