package planreplayer

import (
	"context"

	globalngv1 "github.com/tidbcloud/tidb-management-service/api/spec/global/nextgen/v1"
	planreplayersvc "github.com/tidbcloud/tidb-management-service/nextgen-global-service/domain/service/planreplayer"
)

func NewServer(svc planreplayersvc.Service) globalngv1.PlanReplayerServiceServer {
	return &server{svc: svc}
}

type server struct {
	svc planreplayersvc.Service
}

func (s *server) GetPlanReplayerStatus(
	ctx context.Context,
	req *globalngv1.GetPlanReplayerStatusRequest,
) (*globalngv1.PlanReplayerStatus, error) {
	return s.svc.GetPlanReplayerStatus(ctx, req.GetClusterId())
}

func (s *server) UpdatePlanReplayerStatus(
	ctx context.Context,
	req *globalngv1.UpdatePlanReplayerStatusRequest,
) (*globalngv1.PlanReplayerStatus, error) {
	return s.svc.UpdatePlanReplayerStatus(ctx, req)
}
