package globaldedicatedcli

import (
	"context"
	"errors"
	"fmt"
	"sync"
	"time"

	"github.com/samber/lo"
	"github.com/tidbcloud/tiinf/monitor/tilog"
	"go.uber.org/zap"
	"google.golang.org/grpc"
	"google.golang.org/grpc/codes"
	"google.golang.org/grpc/status"
	"google.golang.org/protobuf/proto"
	"google.golang.org/protobuf/types/known/emptypb"
	"google.golang.org/protobuf/types/known/timestamppb"

	globalcommonv1 "github.com/tidbcloud/tidb-management-service/api/spec/global/common/v1"
	globaldedicatedv1 "github.com/tidbcloud/tidb-management-service/api/spec/global/dedicated/v1"
)

// Deprecated: For newly-written tests, use mock in tests instead. Do not add mock data here.
type fakeImpl struct {
	clusters map[uint64]*globaldedicatedv1.Cluster
	lock     *sync.RWMutex
}

func (c *fakeImpl) RunDedicatedToPremiumCompatibilityCheck(
	ctx context.Context,
	in *globaldedicatedv1.RunDedicatedToPremiumCompatibilityCheckRequest,
	opts ...grpc.CallOption,
) (*globaldedicatedv1.RunDedicatedToPremiumCompatibilityCheckResponse, error) {
	return nil, status.Error(codes.Unimplemented, "migration compatibility precheck is not implemented by local fake")
}

func (c *fakeImpl) BuildDesiredComponents(
	ctx context.Context,
	in *globaldedicatedv1.BuildDesiredComponentsRequest,
	opts ...grpc.CallOption,
) (*globaldedicatedv1.BuildDesiredComponentsResponse, error) {
	return nil, errors.New("unimplemented")
}

func (c *fakeImpl) ApplyGKEHeterogeneousDeploy(
	ctx context.Context,
	in *globaldedicatedv1.ApplyGKEHeterogeneousDeployRequest,
	opts ...grpc.CallOption,
) (*globaldedicatedv1.GKEHeterogeneousDeploy, error) {
	return nil, status.Errorf(codes.Unimplemented, "unimplemented")
}

func (c *fakeImpl) GetGKEHeterogeneousDeploy(
	ctx context.Context,
	in *globaldedicatedv1.GetGKEHeterogeneousDeployRequest,
	opts ...grpc.CallOption,
) (*globaldedicatedv1.GKEHeterogeneousDeploy, error) {
	return nil, status.Errorf(codes.Unimplemented, "unimplemented")
}

func (c *fakeImpl) DeleteGKEHeterogeneousDeploy(
	ctx context.Context,
	in *globaldedicatedv1.DeleteGKEHeterogeneousDeployRequest,
	opts ...grpc.CallOption,
) (*emptypb.Empty, error) {
	return nil, status.Errorf(codes.Unimplemented, "unimplemented")
}

func (c *fakeImpl) GetDefaultTidbVersion(
	ctx context.Context,
	in *globaldedicatedv1.GetDefaultTidbVersionRequest,
	opts ...grpc.CallOption,
) (*globaldedicatedv1.GetDefaultTidbVersionResponse, error) {
	return &globaldedicatedv1.GetDefaultTidbVersionResponse{Version: "v8.5.0"}, nil
}

func (c *fakeImpl) CreateCluster(
	ctx context.Context,
	in *globaldedicatedv1.CreateClusterRequest,
	opts ...grpc.CallOption,
) (*globaldedicatedv1.Cluster, error) {
	if in == nil || in.Cluster == nil {
		return nil, status.Errorf(codes.InvalidArgument, "cluster is invalid")
	}

	c.lock.Lock()
	defer c.lock.Unlock()

	if _, ok := c.clusters[in.Cluster.ClusterId]; ok {
		return nil, status.Errorf(codes.AlreadyExists, "cluster already exists")
	}

	cluster := in.Cluster

	cluster.CreateTime = timestamppb.Now()
	cluster.UpdateTime = timestamppb.Now()
	cluster.Version = "v8.5.5"
	cluster.Port = 4000
	cluster.State = globaldedicatedv1.Cluster_AVAILABLE
	cluster.HealthState = globaldedicatedv1.Cluster_HEALTHY
	cluster.Features = []globalcommonv1.AvailableFeature{
		globalcommonv1.AvailableFeature_DISABLE_PUBLIC_LB,
		globalcommonv1.AvailableFeature_DELEGATE_USER,
		globalcommonv1.AvailableFeature_PRIVATELINK,
	}

	cluster.ClusterComponents = in.Cluster.ClusterComponents
	for _, component := range cluster.ClusterComponents {
		component.IsDefaultTidbGroup = true
		component.TidbGroupId = 1
	}

	cluster.RegionDisplayName = fmt.Sprintf("Fake Region Display Name %s-%s", cluster.CloudProviderId, cluster.RegionId)

	if cluster.RootPassword != "" {
		cluster.HasRootPassword = true
	}

	if in.ValidateOnly {
		return cluster, nil
	}

	c.clusters[cluster.ClusterId] = cluster

	return cluster, nil
}

func (c *fakeImpl) ListClusters(
	ctx context.Context,
	in *globaldedicatedv1.ListClustersRequest,
	opts ...grpc.CallOption,
) (*globaldedicatedv1.ListClustersResponse, error) {
	if in == nil || len(in.ClusterIds) == 0 {
		return nil, status.Errorf(codes.InvalidArgument, "filter is invalid")
	}

	var clusters []*globaldedicatedv1.Cluster

	c.lock.RLock()
	defer c.lock.RUnlock()
	for _, id := range in.ClusterIds {
		if _, ok := c.clusters[id]; ok {
			if c.clusters[id].State != globaldedicatedv1.Cluster_DELETED {
				// deep copy
				clusterCopy, ok := proto.Clone(c.clusters[id]).(*globaldedicatedv1.Cluster)
				if !ok {
					return nil, status.Errorf(codes.Internal, "failed to clone cluster")
				}
				clusters = append(clusters, clusterCopy)
			}
		}
	}

	resp := &globaldedicatedv1.ListClustersResponse{
		Clusters: clusters,
		Total:    uint32(len(clusters)),
	}

	return resp, nil
}

func (c *fakeImpl) GetCluster(
	ctx context.Context,
	in *globaldedicatedv1.GetClusterRequest,
	opts ...grpc.CallOption,
) (*globaldedicatedv1.Cluster, error) {
	if in == nil || in.ClusterId == 0 {
		return nil, status.Errorf(codes.InvalidArgument, "cluster id is invalid")
	}

	c.lock.RLock()
	defer c.lock.RUnlock()
	if cluster, ok := c.clusters[in.ClusterId]; ok {
		// deep copy
		clusterCopy, ok := proto.Clone(cluster).(*globaldedicatedv1.Cluster)
		if !ok {
			return nil, status.Errorf(codes.Internal, "failed to clone cluster")
		}
		return clusterCopy, nil
	}
	return nil, status.Errorf(codes.NotFound, "cluster not found")
}

// DeleteCluster deletes the cluster but keeps the backup records. The cluster can be restored from the backup.
func (c *fakeImpl) DeleteCluster(
	ctx context.Context,
	in *globaldedicatedv1.DeleteClusterRequest,
	opts ...grpc.CallOption,
) (*globaldedicatedv1.Cluster, error) {
	if in == nil || in.ClusterId == 0 {
		return nil, status.Errorf(codes.InvalidArgument, "cluster id is invalid")
	}

	c.lock.Lock()
	defer c.lock.Unlock()
	if cluster, ok := c.clusters[in.ClusterId]; ok {
		if in.ValidateOnly {
			return cluster, nil
		}

		if cluster.State == globaldedicatedv1.Cluster_DELETED {
			tilog.Warn(ctx, "cluster already deleted", zap.Uint64("cluster_id", in.ClusterId))
			return cluster, nil
		}
		cluster.State = globaldedicatedv1.Cluster_DELETED
		cluster.UpdateTime = timestamppb.Now()
		cluster.DeleteTime = timestamppb.Now()

		// deep copy
		clusterCopy, ok := proto.Clone(cluster).(*globaldedicatedv1.Cluster)
		if !ok {
			return nil, status.Errorf(codes.Internal, "failed to clone cluster")
		}

		return clusterCopy, nil
	}

	return nil, status.Errorf(codes.NotFound, "cluster not found")
}

func (c *fakeImpl) ScaleClusterWithMultiComponent(
	ctx context.Context,
	in *globaldedicatedv1.ScaleClusterWithMultiComponentRequest,
	opts ...grpc.CallOption,
) (*globaldedicatedv1.Cluster, error) {
	if in == nil || in.ClusterId == 0 {
		return nil, status.Errorf(codes.InvalidArgument, "cluster id is invalid")
	}

	if in.ClusterComponents == nil {
		return nil, status.Errorf(codes.InvalidArgument, "cluster components is invalid")
	}

	c.lock.Lock()
	defer c.lock.Unlock()
	if cluster, ok := c.clusters[in.ClusterId]; ok {
		if in.ValidateOnly {
			clusterCopy, ok := proto.Clone(cluster).(*globaldedicatedv1.Cluster)
			if !ok {
				return nil, status.Errorf(codes.Internal, "failed to clone cluster")
			}
			clusterCopy.State = globaldedicatedv1.Cluster_SCALING
			return clusterCopy, nil
		}

		cluster.UpdateTime = timestamppb.Now()

		newComponents := make(map[string]*globaldedicatedv1.Cluster_ClusterComponent)
		for _, component := range in.ClusterComponents {
			switch component.ComponentType {
			case globaldedicatedv1.ComponentType_TIDB, globaldedicatedv1.ComponentType_TIPROXY:
				if component.TidbGroupId == 1 {
					component.IsDefaultTidbGroup = true
				}
				newComponents[getComponentKey(component.ComponentType, component.TidbGroupId)] = component
			default:
				newComponents[getComponentKey(component.ComponentType, 1)] = component
			}
		}
		for _, component := range cluster.ClusterComponents {
			switch component.ComponentType {
			case globaldedicatedv1.ComponentType_TIDB, globaldedicatedv1.ComponentType_TIPROXY:
				if component.TidbGroupId == 1 {
					component.IsDefaultTidbGroup = true
				}
				key := getComponentKey(component.ComponentType, component.TidbGroupId)
				if _, ok := newComponents[key]; !ok {
					newComponents[key] = component
				}
			default:
				key := getComponentKey(component.ComponentType, 1)
				if _, ok := newComponents[key]; !ok {
					newComponents[key] = component
				}
			}
		}

		cluster.ClusterComponents = lo.MapToSlice(
			newComponents,
			func(_ string, v *globaldedicatedv1.Cluster_ClusterComponent) *globaldedicatedv1.Cluster_ClusterComponent {
				return v
			},
		)
		cluster.State = globaldedicatedv1.Cluster_SCALING

		// deep copy
		clusterCopy, ok := proto.Clone(cluster).(*globaldedicatedv1.Cluster)
		if !ok {
			return nil, status.Errorf(codes.Internal, "failed to clone cluster")
		}

		go func(lock *sync.RWMutex) {
			lock.Lock()
			defer lock.Unlock()
			time.Sleep(2 * time.Second)
			cluster.State = globaldedicatedv1.Cluster_AVAILABLE
			cluster.UpdateTime = timestamppb.Now()
		}(c.lock)

		return clusterCopy, nil
	}

	return nil, status.Errorf(codes.NotFound, "cluster not found")
}

func getComponentKey(componentType globaldedicatedv1.ComponentType, tidbGroupId uint64) string {
	return fmt.Sprintf("%d-%d", componentType, tidbGroupId)
}

func (c *fakeImpl) ScaleCluster(
	ctx context.Context,
	in *globaldedicatedv1.ScaleClusterRequest,
	opts ...grpc.CallOption,
) (*globaldedicatedv1.Cluster, error) {
	if in == nil || in.ClusterId == 0 {
		return nil, status.Errorf(codes.InvalidArgument, "cluster id is invalid")
	}

	if in.ClusterComponent == nil {
		return nil, status.Errorf(codes.InvalidArgument, "cluster components is invalid")
	}

	c.lock.Lock()
	defer c.lock.Unlock()
	if cluster, ok := c.clusters[in.ClusterId]; ok {
		if in.ValidateOnly {
			cluster.State = globaldedicatedv1.Cluster_SCALING
			return cluster, nil
		}

		cluster.UpdateTime = timestamppb.Now()

		newComponents := make([]*globaldedicatedv1.Cluster_ClusterComponent, 0, len(cluster.ClusterComponents))

		for _, component := range cluster.ClusterComponents {
			component.IsDefaultTidbGroup = true
			component.TidbGroupId = 1
			if component.ComponentType == in.ClusterComponent.ComponentType {
				newComponents = append(newComponents, in.ClusterComponent)
			} else {
				newComponents = append(newComponents, component)
			}
		}
		cluster.ClusterComponents = newComponents
		cluster.State = globaldedicatedv1.Cluster_SCALING

		// deep copy
		clusterCopy, ok := proto.Clone(cluster).(*globaldedicatedv1.Cluster)
		if !ok {
			return nil, status.Errorf(codes.Internal, "failed to clone cluster")
		}

		go func(lock *sync.RWMutex) {
			lock.Lock()
			defer lock.Unlock()
			time.Sleep(2 * time.Second)
			cluster.State = globaldedicatedv1.Cluster_AVAILABLE
			cluster.UpdateTime = timestamppb.Now()
		}(c.lock)

		return clusterCopy, nil
	}

	return nil, status.Errorf(codes.NotFound, "cluster not found")
}

func (c *fakeImpl) PauseCluster(
	ctx context.Context,
	in *globaldedicatedv1.PauseClusterRequest,
	opts ...grpc.CallOption,
) (*globaldedicatedv1.Cluster, error) {
	if in == nil || in.ClusterId == 0 {
		return nil, status.Errorf(codes.InvalidArgument, "cluster id is invalid")
	}

	c.lock.Lock()
	defer c.lock.Unlock()
	if cluster, ok := c.clusters[in.ClusterId]; ok {
		if in.ValidateOnly {
			cluster.State = globaldedicatedv1.Cluster_PAUSING
			return cluster, nil
		}
		cluster.UpdateTime = timestamppb.Now()
		cluster.State = globaldedicatedv1.Cluster_PAUSING
		// deep copy
		clusterCopy, ok := proto.Clone(cluster).(*globaldedicatedv1.Cluster)
		if !ok {
			return nil, status.Errorf(codes.Internal, "failed to clone cluster")
		}

		go func(lock *sync.RWMutex) {
			lock.Lock()
			defer lock.Unlock()
			time.Sleep(2 * time.Second)
			cluster.State = globaldedicatedv1.Cluster_PAUSED
			cluster.UpdateTime = timestamppb.Now()
		}(c.lock)

		return clusterCopy, nil
	}

	return nil, status.Errorf(codes.NotFound, "cluster not found")
}

func (c *fakeImpl) ResumeCluster(
	ctx context.Context,
	in *globaldedicatedv1.ResumeClusterRequest,
	opts ...grpc.CallOption,
) (*globaldedicatedv1.Cluster, error) {
	if in == nil || in.ClusterId == 0 {
		return nil, status.Errorf(codes.InvalidArgument, "cluster id is invalid")
	}

	c.lock.Lock()
	defer c.lock.Unlock()
	if cluster, ok := c.clusters[in.ClusterId]; ok {
		if in.ValidateOnly {
			cluster.State = globaldedicatedv1.Cluster_RESUMING
			return cluster, nil
		}
		cluster.UpdateTime = timestamppb.Now()
		cluster.State = globaldedicatedv1.Cluster_RESUMING
		// deep copy
		clusterCopy, ok := proto.Clone(cluster).(*globaldedicatedv1.Cluster)
		if !ok {
			return nil, status.Errorf(codes.Internal, "failed to clone cluster")
		}

		go func(lock *sync.RWMutex) {
			lock.Lock()
			defer lock.Unlock()
			time.Sleep(2 * time.Second)
			cluster.State = globaldedicatedv1.Cluster_AVAILABLE
			cluster.UpdateTime = timestamppb.Now()
		}(c.lock)

		return clusterCopy, nil
	}

	return nil, status.Errorf(codes.NotFound, "cluster not found")
}

func (c *fakeImpl) GetComponentNodeInfo(
	ctx context.Context,
	in *globaldedicatedv1.GetComponentNodeInfoRequest,
	opts ...grpc.CallOption,
) (*globaldedicatedv1.GetComponentNodeInfoResponse, error) {
	if in == nil || in.ClusterId == 0 {
		return nil, status.Errorf(codes.InvalidArgument, "cluster id is invalid")
	}

	c.lock.RLock()
	defer c.lock.RUnlock()

	if cluster, ok := c.clusters[in.ClusterId]; ok {
		nodeInfo := &globaldedicatedv1.ComponentNodeInfo{
			Tidb:    make([]*globaldedicatedv1.ComponentNodeInfo_Component, 0),
			Tiproxy: make([]*globaldedicatedv1.ComponentNodeInfo_Component, 0),
			Tikv:    &globaldedicatedv1.ComponentNodeInfo_Component{},
			Tiflash: &globaldedicatedv1.ComponentNodeInfo_Component{},
		}

		if cluster.ClusterComponents != nil {
			for _, tier := range cluster.ClusterComponents {
				switch tier.ComponentType {
				case globaldedicatedv1.ComponentType_TIKV:
					for i := 1; i <= int(tier.GetCount()); i++ {
						nodeInfo.Tikv.Nodes = append(
							nodeInfo.Tikv.Nodes,
							&globaldedicatedv1.ComponentNodeInfo_Component_Node{
								InstanceName: fmt.Sprintf("tikv-%d", i),
							},
						)
					}
				case globaldedicatedv1.ComponentType_TIDB:
					nodeInfo.Tidb = append(nodeInfo.Tidb, &globaldedicatedv1.ComponentNodeInfo_Component{
						Nodes:              make([]*globaldedicatedv1.ComponentNodeInfo_Component_Node, 0),
						IsDefaultTidbGroup: true,
					})
					for i := 1; i <= int(tier.GetCount()); i++ {
						nodeInfo.Tidb[0].Nodes = append(
							nodeInfo.Tidb[0].Nodes,
							&globaldedicatedv1.ComponentNodeInfo_Component_Node{
								InstanceName: fmt.Sprintf("tidb-%d", i),
							},
						)
					}
				case globaldedicatedv1.ComponentType_TIPROXY:
					nodeInfo.Tiproxy = append(nodeInfo.Tiproxy, &globaldedicatedv1.ComponentNodeInfo_Component{
						Nodes:              make([]*globaldedicatedv1.ComponentNodeInfo_Component_Node, 0),
						IsDefaultTidbGroup: true,
					})
					for i := 1; i <= int(tier.GetCount()); i++ {
						nodeInfo.Tiproxy[0].Nodes = append(
							nodeInfo.Tiproxy[0].Nodes,
							&globaldedicatedv1.ComponentNodeInfo_Component_Node{
								InstanceName: fmt.Sprintf("tiproxy-%d", i),
							},
						)
					}
				case globaldedicatedv1.ComponentType_TIFLASH:
					for i := 1; i <= int(tier.GetCount()); i++ {
						nodeInfo.Tiflash.Nodes = append(
							nodeInfo.Tiflash.Nodes,
							&globaldedicatedv1.ComponentNodeInfo_Component_Node{
								InstanceName: fmt.Sprintf("tiflash-%d", i),
							},
						)
					}
				}
			}
		}
		return &globaldedicatedv1.GetComponentNodeInfoResponse{ComponentNodeInfo: nodeInfo}, nil
	}

	return nil, status.Errorf(codes.NotFound, "cluster not found")
}

func (c *fakeImpl) ApplyCluster(
	ctx context.Context,
	in *globaldedicatedv1.ApplyClusterRequest,
	opts ...grpc.CallOption,
) (*globaldedicatedv1.Cluster, error) {
	if in == nil || in.ClusterId == 0 {
		return nil, status.Errorf(codes.InvalidArgument, "cluster id is invalid")
	}

	c.lock.RLock()
	defer c.lock.RUnlock()
	if cluster, ok := c.clusters[in.ClusterId]; ok {
		// deep copy
		clusterCopy, ok := proto.Clone(cluster).(*globaldedicatedv1.Cluster)
		if !ok {
			return nil, status.Errorf(codes.Internal, "failed to clone cluster")
		}
		return clusterCopy, nil
	}
	return nil, status.Errorf(codes.NotFound, "cluster not found")
}

func (c *fakeImpl) GetClusterConfidentialInfo(
	ctx context.Context,
	in *globaldedicatedv1.GetClusterConfidentialInfoRequest,
	opts ...grpc.CallOption,
) (*globaldedicatedv1.GetClusterConfidentialInfoResponse, error) {
	return nil, errors.New("unimplemented")
}

// vpc service

func (c *fakeImpl) ListVpcs(
	ctx context.Context,
	in *globaldedicatedv1.ListVpcsRequest,
	opts ...grpc.CallOption,
) (*globaldedicatedv1.ListVpcsResponse, error) {
	return nil, errors.New("unimplemented")
}

func (c *fakeImpl) DeleteVpc(
	ctx context.Context,
	in *globaldedicatedv1.DeleteVpcRequest,
	opts ...grpc.CallOption,
) (*emptypb.Empty, error) {
	return nil, errors.New("unimplemented")
}

func (c *fakeImpl) DeleteVpcPeering(
	ctx context.Context,
	in *globaldedicatedv1.DeleteVpcPeeringRequest,
	opts ...grpc.CallOption,
) (*emptypb.Empty, error) {
	return nil, errors.New("unimplemented")
}

func (c *fakeImpl) ListVpcPeerings(
	ctx context.Context,
	in *globaldedicatedv1.ListVpcPeeringsRequest,
	opts ...grpc.CallOption,
) (*globaldedicatedv1.ListVpcPeeringsResponse, error) {
	return nil, errors.New("unimplemented")
}

func (c *fakeImpl) GetCmekAccessIamPrincipal(
	ctx context.Context,
	in *globaldedicatedv1.GetCmekAccessIamPrincipalRequest,
	opts ...grpc.CallOption,
) (*globaldedicatedv1.GetCmekAccessIamPrincipalResponse, error) {
	return nil, errors.New("unimplemented")
}

// Region service

func (c *fakeImpl) RegisterCloudProvider(
	ctx context.Context,
	in *globaldedicatedv1.RegisterCloudProviderRequest,
	opts ...grpc.CallOption,
) (*globalcommonv1.CloudProvider, error) {
	panic("implement me")
}

func (c *fakeImpl) ListCloudProviders(
	ctx context.Context,
	req *globaldedicatedv1.ListCloudProvidersRequest,
	opts ...grpc.CallOption,
) (*globaldedicatedv1.ListCloudProvidersResponse, error) {
	panic("implement me")
}

func (c *fakeImpl) RegisterRegion(
	ctx context.Context,
	in *globaldedicatedv1.RegisterRegionRequest,
	opts ...grpc.CallOption,
) (*globalcommonv1.Region, error) {
	panic("implement me")
}

func (c *fakeImpl) UpdateRegion(
	ctx context.Context,
	in *globaldedicatedv1.UpdateRegionRequest,
	opts ...grpc.CallOption,
) (*globalcommonv1.Region, error) {
	panic("implement me")
}

func (c *fakeImpl) SelectRegionByOrgId(
	ctx context.Context,
	in *globaldedicatedv1.SelectRegionByOrgIdRequest,
	opts ...grpc.CallOption,
) (*globalcommonv1.Region, error) {
	return &globalcommonv1.Region{
		Id:              in.RegionId,
		LogicalName:     in.RegionId.String(),
		CloudProviderId: in.CloudProviderId,
		DisplayName:     fmt.Sprintf("Fake Region Display Name %s", in.GetRegionId()),
	}, nil
}

func (c *fakeImpl) GetRegionByLogicalName(
	ctx context.Context,
	in *globaldedicatedv1.GetRegionByLogicalNameRequest,
	opts ...grpc.CallOption,
) (*globalcommonv1.Region, error) {
	panic("implement me")
}

func (c *fakeImpl) CheckRegionStatus(
	ctx context.Context,
	in *globaldedicatedv1.CheckRegionStatusRequest,
	opts ...grpc.CallOption,
) (*emptypb.Empty, error) {
	panic("implement me")
}

func (c *fakeImpl) ListRegions(
	ctx context.Context,
	in *globaldedicatedv1.ListRegionsRequest,
	opts ...grpc.CallOption,
) (*globaldedicatedv1.ListRegionsResponse, error) {
	panic("implement me")
}

func (c *fakeImpl) DeleteRegion(
	ctx context.Context,
	in *globaldedicatedv1.DeleteRegionRequest,
	opts ...grpc.CallOption,
) (*emptypb.Empty, error) {
	panic("implement me")
}

func (c *fakeImpl) CreateCustomerManagedEncryptionKey(
	ctx context.Context,
	in *globaldedicatedv1.CreateCustomerManagedEncryptionKeyRequest,
	opts ...grpc.CallOption,
) (*globaldedicatedv1.CustomerManagedEncryptionKey, error) {
	panic("implement me")
}

func (c *fakeImpl) GetCustomerManagedEncryptionKey(
	ctx context.Context,
	in *globaldedicatedv1.GetCustomerManagedEncryptionKeyRequest,
	opts ...grpc.CallOption,
) (*globaldedicatedv1.CustomerManagedEncryptionKey, error) {
	panic("implement me")
}

func (c *fakeImpl) ListCustomerManagedEncryptionKeys(
	ctx context.Context,
	in *globaldedicatedv1.ListCustomerManagedEncryptionKeysRequest,
	opts ...grpc.CallOption,
) (*globaldedicatedv1.ListCustomerManagedEncryptionKeysResponse, error) {
	panic("implement me")
}

func (c *fakeImpl) DeleteCustomerManagedEncryptionKey(
	ctx context.Context,
	in *globaldedicatedv1.DeleteCustomerManagedEncryptionKeyRequest,
	opts ...grpc.CallOption,
) (*emptypb.Empty, error) {
	panic("implement me")
}

func (c *fakeImpl) CreateCidr(
	ctx context.Context,
	in *globaldedicatedv1.CreateCidrRequest,
	opts ...grpc.CallOption,
) (*globaldedicatedv1.CreateCidrResponse, error) {
	panic("implement me")
}

func (c *fakeImpl) QueryCidrs(
	ctx context.Context,
	in *globaldedicatedv1.QueryCidrsRequest,
	opts ...grpc.CallOption,
) (*globaldedicatedv1.QueryCidrsResponse, error) {
	panic("implement me")
}

func (c *fakeImpl) UpdateCidr(
	ctx context.Context,
	in *globaldedicatedv1.UpdateCidrRequest,
	opts ...grpc.CallOption,
) (*globaldedicatedv1.UpdateCidrResponse, error) {
	panic("implement me")
}

func (c *fakeImpl) DeleteCidr(
	ctx context.Context,
	in *globaldedicatedv1.DeleteCidrRequest,
	opts ...grpc.CallOption,
) (*emptypb.Empty, error) {
	panic("implement me")
}

func (c *fakeImpl) GetDefaultCidr(
	ctx context.Context,
	in *globaldedicatedv1.GetDefaultCidrRequest,
	opts ...grpc.CallOption,
) (*globaldedicatedv1.GetDefaultCidrResponse, error) {
	panic("implement me")
}

func (c *fakeImpl) CreatePrivateLinkService(
	ctx context.Context,
	in *globaldedicatedv1.CreatePrivateLinkServiceRequest,
	opts ...grpc.CallOption,
) (*globaldedicatedv1.CreatePrivateLinkServiceResponse, error) {
	panic("implement me")
}

func (c *fakeImpl) DeletePrivateLinkService(
	ctx context.Context,
	in *globaldedicatedv1.DeletePrivateLinkServiceRequest,
	opts ...grpc.CallOption,
) (*emptypb.Empty, error) {
	panic("implement me")
}

func (c *fakeImpl) GetPrivateLinkService(
	ctx context.Context,
	in *globaldedicatedv1.GetPrivateLinkServiceRequest,
	opts ...grpc.CallOption,
) (*globaldedicatedv1.GetPrivateLinkServiceResponse, error) {
	panic("implement me")
}

func (c *fakeImpl) CreatePrivateLinkEndpoint(
	ctx context.Context,
	in *globaldedicatedv1.CreatePrivateLinkEndpointRequest,
	opts ...grpc.CallOption,
) (*globaldedicatedv1.CreatePrivateLinkEndpointResponse, error) {
	panic("implement me")
}

func (c *fakeImpl) DeletePrivateLinkEndpoint(
	ctx context.Context,
	in *globaldedicatedv1.DeletePrivateLinkEndpointRequest,
	opts ...grpc.CallOption,
) (*emptypb.Empty, error) {
	panic("implement me")
}

func (c *fakeImpl) ListPrivateLinkEndpoints(
	ctx context.Context,
	in *globaldedicatedv1.ListPrivateLinkEndpointsRequest,
	opts ...grpc.CallOption,
) (*globaldedicatedv1.ListPrivateLinkEndpointsResponse, error) {
	panic("implement me")
}

func (c *fakeImpl) ListTidbNodeGroupPrivateLinkEndpoints(
	ctx context.Context,
	in *globaldedicatedv1.ListTidbNodeGroupPrivateLinkEndpointsRequest,
	opts ...grpc.CallOption,
) (*globaldedicatedv1.ListTidbNodeGroupPrivateLinkEndpointsResponse, error) {
	panic("implement me")
}

func (c *fakeImpl) RejectVpcEndpointConnections(
	ctx context.Context,
	in *globaldedicatedv1.RejectVpcEndpointConnectionsRequest,
	opts ...grpc.CallOption,
) (*emptypb.Empty, error) {
	panic("implement me")
}

func (c *fakeImpl) PausePrivateLinkService(
	ctx context.Context,
	in *globaldedicatedv1.PausePrivateLinkServiceRequest,
	opts ...grpc.CallOption,
) (*emptypb.Empty, error) {
	panic("implement me")
}

func (c *fakeImpl) PurgePrivateLinkServiceMetadata(
	ctx context.Context,
	in *globaldedicatedv1.PurgePrivateLinkServiceMetadataRequest,
	opts ...grpc.CallOption,
) (*emptypb.Empty, error) {
	panic("implement me")
}

func (c *fakeImpl) CreateTidbNodeGroup(
	ctx context.Context,
	in *globaldedicatedv1.CreateTidbNodeGroupRequest,
	opts ...grpc.CallOption,
) (*globaldedicatedv1.TidbNodeGroup, error) {
	panic("implement me")
}

func (c *fakeImpl) UpdateTidbNodeGroup(
	ctx context.Context,
	in *globaldedicatedv1.UpdateTidbNodeGroupRequest,
	opts ...grpc.CallOption,
) (*globaldedicatedv1.TidbNodeGroup, error) {
	panic("implement me")
}

func (c *fakeImpl) DeleteTidbNodeGroup(
	ctx context.Context,
	in *globaldedicatedv1.DeleteTidbNodeGroupRequest,
	opts ...grpc.CallOption,
) (*emptypb.Empty, error) {
	panic("implement me")
}

func (c *fakeImpl) ListTidbNodeGroups(
	ctx context.Context,
	in *globaldedicatedv1.ListTidbNodeGroupsRequest,
	opts ...grpc.CallOption,
) (*globaldedicatedv1.ListTidbNodeGroupsResponse, error) {
	panic("implement me")
}

func (c *fakeImpl) GetVpcPeering(
	ctx context.Context,
	in *globaldedicatedv1.GetVpcPeeringRequest,
	opts ...grpc.CallOption,
) (*globaldedicatedv1.VpcPeering, error) {
	panic("implement me")
}

func (c *fakeImpl) CreateVpcPeering(
	ctx context.Context,
	in *globaldedicatedv1.CreateVpcPeeringRequest,
	opts ...grpc.CallOption,
) (*globaldedicatedv1.CreateVpcPeeringResponse, error) {
	panic("implement me")
}

func (c *fakeImpl) GetCompatCluster(
	ctx context.Context,
	in *globaldedicatedv1.GetCompatClusterRequest,
	opts ...grpc.CallOption,
) (*globaldedicatedv1.CompatCluster, error) {
	panic("implement me")
}

func (c *fakeImpl) GetCompatNetwork(
	ctx context.Context,
	in *globaldedicatedv1.GetCompatNetworkRequest,
	opts ...grpc.CallOption,
) (*globaldedicatedv1.CompatNetwork, error) {
	panic("implement me")
}

func (c *fakeImpl) GetCompatProvider(
	ctx context.Context,
	in *globaldedicatedv1.GetCompatProviderRequest,
	opts ...grpc.CallOption,
) (*globaldedicatedv1.CompatProvider, error) {
	panic("implement me")
}

func (c *fakeImpl) CalcClusterFee(
	ctx context.Context,
	in *globaldedicatedv1.CalcClusterFeeRequest,
	opts ...grpc.CallOption,
) (*globaldedicatedv1.CalcClusterFeeResponse, error) {
	panic("implement me")
}

func (c *fakeImpl) SetClientCaCertificate(
	ctx context.Context,
	in *globaldedicatedv1.SetClientCaCertificateRequest,
	opts ...grpc.CallOption,
) (*emptypb.Empty, error) {
	panic("implement me")
}

func (c *fakeImpl) GetClientCaCertificate(
	ctx context.Context,
	in *globaldedicatedv1.GetClientCaCertificateRequest,
	opts ...grpc.CallOption,
) (*globaldedicatedv1.GetClientCaCertificateResponse, error) {
	panic("implement me")
}

func (c *fakeImpl) GetBillableClustersCount(
	ctx context.Context,
	in *globaldedicatedv1.GetBillableClustersCountRequest,
	opts ...grpc.CallOption,
) (*globaldedicatedv1.GetBillableClustersCountResponse, error) {
	panic("implement me")
}

func (c *fakeImpl) CreateClusterSnapshot(
	ctx context.Context,
	in *globaldedicatedv1.CreateClusterSnapshotRequest,
	opts ...grpc.CallOption,
) (*globaldedicatedv1.CreateClusterSnapshotResponse, error) {
	panic("implement me")
}

func (c *fakeImpl) ListClusterSnapshots(
	ctx context.Context,
	in *globaldedicatedv1.ListClusterSnapshotsRequest,
	opts ...grpc.CallOption,
) (*globaldedicatedv1.ListClusterSnapshotsResponse, error) {
	panic("implement me")
}

func (c *fakeImpl) ListTenantQuota(
	ctx context.Context,
	in *globaldedicatedv1.ListTenantQuotaRequest,
	opts ...grpc.CallOption,
) (*globaldedicatedv1.ListTenantQuotaResponse, error) {
	panic("implement me")
}

func (c *fakeImpl) UpdateTenantQuota(
	ctx context.Context,
	in *globaldedicatedv1.UpdateTenantQuotaRequest,
	opts ...grpc.CallOption,
) (*globaldedicatedv1.UpdateTenantQuotaResponse, error) {
	panic("implement me")
}

func (c *fakeImpl) ChangeClusterPasswd(
	ctx context.Context,
	in *globaldedicatedv1.ChangeClusterPasswdRequest,
	opts ...grpc.CallOption,
) (*globaldedicatedv1.ChangeClusterPasswdResponse, error) {
	if in == nil || in.ClusterId == 0 {
		return nil, status.Errorf(codes.InvalidArgument, "cluster id is invalid")
	}

	if in.GetPasswd() == "" {
		return nil, status.Errorf(codes.InvalidArgument, "root password is invalid")
	}

	c.lock.Lock()
	defer c.lock.Unlock()
	cluster, ok := c.clusters[in.ClusterId]
	if !ok {
		return nil, status.Errorf(codes.NotFound, "cluster not found")
	}

	cluster.UpdateTime = timestamppb.Now()
	cluster.HasRootPassword = true
	cluster.RootPassword = in.GetPasswd()

	return &globaldedicatedv1.ChangeClusterPasswdResponse{}, nil
}

func (c *fakeImpl) ListSpus(
	ctx context.Context,
	in *globaldedicatedv1.ListSpusRequest,
	opts ...grpc.CallOption,
) (*globaldedicatedv1.ListSpusResponse, error) {
	return &globaldedicatedv1.ListSpusResponse{
		Spus: []*globaldedicatedv1.Spu{
			{
				Name:          "8C16G",
				ComponentType: globaldedicatedv1.ComponentType_TIKV,
				SupportedDiskPairs: []*globaldedicatedv1.Spu_DiskPair{
					{
						DataVolumeType:    globaldedicatedv1.StorageMu_IO2,
						RaftlogVolumeType: globaldedicatedv1.StorageMu_VOLUME_TYPE_UNSPECIFIED,
					},
					{
						DataVolumeType:    globaldedicatedv1.StorageMu_GP3,
						RaftlogVolumeType: globaldedicatedv1.StorageMu_VOLUME_TYPE_UNSPECIFIED,
					},
					{
						DataVolumeType:    globaldedicatedv1.StorageMu_GP3,
						RaftlogVolumeType: globaldedicatedv1.StorageMu_GP3,
					},
					{
						DataVolumeType:    globaldedicatedv1.StorageMu_GP3,
						RaftlogVolumeType: globaldedicatedv1.StorageMu_IO2,
					},
				},
			},
			{
				Name:          "16C32G",
				ComponentType: globaldedicatedv1.ComponentType_TIKV,
				SupportedDiskPairs: []*globaldedicatedv1.Spu_DiskPair{
					{
						DataVolumeType:    globaldedicatedv1.StorageMu_IO2,
						RaftlogVolumeType: globaldedicatedv1.StorageMu_VOLUME_TYPE_UNSPECIFIED,
					},
					{
						DataVolumeType:    globaldedicatedv1.StorageMu_GP3,
						RaftlogVolumeType: globaldedicatedv1.StorageMu_VOLUME_TYPE_UNSPECIFIED,
					},
					{
						DataVolumeType:    globaldedicatedv1.StorageMu_GP3,
						RaftlogVolumeType: globaldedicatedv1.StorageMu_GP3,
					},
					{
						DataVolumeType:    globaldedicatedv1.StorageMu_GP3,
						RaftlogVolumeType: globaldedicatedv1.StorageMu_IO2,
					},
				},
			},
			{
				ComponentType: globaldedicatedv1.ComponentType_TIFLASH,
				SupportedDiskPairs: []*globaldedicatedv1.Spu_DiskPair{
					{
						DataVolumeType:    globaldedicatedv1.StorageMu_IO2,
						RaftlogVolumeType: globaldedicatedv1.StorageMu_VOLUME_TYPE_UNSPECIFIED,
					},
					{
						DataVolumeType:    globaldedicatedv1.StorageMu_GP3,
						RaftlogVolumeType: globaldedicatedv1.StorageMu_VOLUME_TYPE_UNSPECIFIED,
					},
				},
			},
		},
	}, nil
}

func (c *fakeImpl) GetSpu(
	ctx context.Context,
	in *globaldedicatedv1.GetSpuRequest,
	opts ...grpc.CallOption,
) (*globaldedicatedv1.Spu, error) {
	if in.GetId() == 0 && in.GetByAttributes().GetSpuName() == "" {
		return &globaldedicatedv1.Spu{}, nil
	}

	// Currently only fake GetByAttributes requests.
	switch in.GetByAttributes().GetComponentType() {
	case globaldedicatedv1.ComponentType_TIKV:
		switch in.GetByAttributes().GetSpuName() {
		case "8C16G":
			return &globaldedicatedv1.Spu{
				Name:          "8C16G",
				ComponentType: globaldedicatedv1.ComponentType_TIKV,
				SupportedDiskPairs: []*globaldedicatedv1.Spu_DiskPair{
					{
						DataVolumeType:    globaldedicatedv1.StorageMu_IO2,
						RaftlogVolumeType: globaldedicatedv1.StorageMu_VOLUME_TYPE_UNSPECIFIED,
					},
					{
						DataVolumeType:    globaldedicatedv1.StorageMu_GP3,
						RaftlogVolumeType: globaldedicatedv1.StorageMu_VOLUME_TYPE_UNSPECIFIED,
					},
					{
						DataVolumeType:    globaldedicatedv1.StorageMu_GP3,
						RaftlogVolumeType: globaldedicatedv1.StorageMu_GP3,
					},
					{
						DataVolumeType:    globaldedicatedv1.StorageMu_GP3,
						RaftlogVolumeType: globaldedicatedv1.StorageMu_IO2,
					},
				},
			}, nil
		case "16C32G":
			return &globaldedicatedv1.Spu{
				Name:          "16C32G",
				ComponentType: globaldedicatedv1.ComponentType_TIKV,
				SupportedDiskPairs: []*globaldedicatedv1.Spu_DiskPair{
					{
						DataVolumeType:    globaldedicatedv1.StorageMu_IO2,
						RaftlogVolumeType: globaldedicatedv1.StorageMu_VOLUME_TYPE_UNSPECIFIED,
					},
					{
						DataVolumeType:    globaldedicatedv1.StorageMu_GP3,
						RaftlogVolumeType: globaldedicatedv1.StorageMu_VOLUME_TYPE_UNSPECIFIED,
					},
					{
						DataVolumeType:    globaldedicatedv1.StorageMu_GP3,
						RaftlogVolumeType: globaldedicatedv1.StorageMu_GP3,
					},
					{
						DataVolumeType:    globaldedicatedv1.StorageMu_GP3,
						RaftlogVolumeType: globaldedicatedv1.StorageMu_IO2,
					},
				},
			}, nil
		}
	case globaldedicatedv1.ComponentType_TIFLASH:
		return &globaldedicatedv1.Spu{
			ComponentType: globaldedicatedv1.ComponentType_TIFLASH,
			SupportedDiskPairs: []*globaldedicatedv1.Spu_DiskPair{
				{
					DataVolumeType:    globaldedicatedv1.StorageMu_IO2,
					RaftlogVolumeType: globaldedicatedv1.StorageMu_VOLUME_TYPE_UNSPECIFIED,
				},
				{
					DataVolumeType:    globaldedicatedv1.StorageMu_GP3,
					RaftlogVolumeType: globaldedicatedv1.StorageMu_VOLUME_TYPE_UNSPECIFIED,
				},
			},
		}, nil
	default:
		return &globaldedicatedv1.Spu{}, nil
	}
	return &globaldedicatedv1.Spu{}, nil
}

func (c *fakeImpl) BatchUpsertSpus(
	ctx context.Context,
	in *globaldedicatedv1.BatchUpsertSpusRequest,
	opts ...grpc.CallOption,
) (*globaldedicatedv1.BatchUpsertSpusResponse, error) {
	panic("implement me")
}

func (c *fakeImpl) GetInstanceMu(
	ctx context.Context,
	in *globaldedicatedv1.GetInstanceMuRequest,
	opts ...grpc.CallOption,
) (*globaldedicatedv1.InstanceMu, error) {
	panic("implement me")
}

func (c *fakeImpl) GetStorageMu(
	ctx context.Context,
	in *globaldedicatedv1.GetStorageMuRequest,
	opts ...grpc.CallOption,
) (*globaldedicatedv1.StorageMu, error) {
	panic("implement me")
}

func (c *fakeImpl) ListInstanceMus(
	ctx context.Context,
	in *globaldedicatedv1.ListInstanceMusRequest,
	opts ...grpc.CallOption,
) (*globaldedicatedv1.ListInstanceMusResponse, error) {
	panic("implement me")
}

func (c *fakeImpl) ListStorageMus(
	ctx context.Context,
	in *globaldedicatedv1.ListStorageMusRequest,
	opts ...grpc.CallOption,
) (*globaldedicatedv1.ListStorageMusResponse, error) {
	panic("implement me")
}

func (c *fakeImpl) BatchUpsertInstanceMus(
	ctx context.Context,
	in *globaldedicatedv1.BatchUpsertInstanceMusRequest,
	opts ...grpc.CallOption,
) (*globaldedicatedv1.BatchUpsertInstanceMusResponse, error) {
	panic("implement me")
}

func (c *fakeImpl) BatchUpsertStorageMus(
	ctx context.Context,
	in *globaldedicatedv1.BatchUpsertStorageMusRequest,
	opts ...grpc.CallOption,
) (*globaldedicatedv1.BatchUpsertStorageMusResponse, error) {
	panic("implement me")
}

func (c *fakeImpl) GetSku(
	ctx context.Context,
	in *globaldedicatedv1.GetSkuRequest,
	opts ...grpc.CallOption,
) (*globaldedicatedv1.Sku, error) {
	panic("implement me")
}

func (c *fakeImpl) ListSkus(
	ctx context.Context,
	in *globaldedicatedv1.ListSkusRequest,
	opts ...grpc.CallOption,
) (*globaldedicatedv1.ListSkusResponse, error) {
	panic("implement me")
}

func (c *fakeImpl) BatchUpsertSkus(
	ctx context.Context,
	in *globaldedicatedv1.BatchUpsertSkusRequest,
	opts ...grpc.CallOption,
) (*globaldedicatedv1.BatchUpsertSkusResponse, error) {
	panic("implement me")
}

func (c *fakeImpl) GetLogRedactionPolicy(
	ctx context.Context,
	in *globaldedicatedv1.GetLogRedactionPolicyRequest,
	opts ...grpc.CallOption,
) (*globaldedicatedv1.LogRedactionPolicy, error) {
	panic("implement me")
}

func (c *fakeImpl) UpdateLogRedactionPolicy(
	ctx context.Context,
	in *globaldedicatedv1.UpdateLogRedactionPolicyRequest,
	opts ...grpc.CallOption,
) (*globaldedicatedv1.LogRedactionPolicy, error) {
	panic("implement me")
}

func (c *fakeImpl) AddSecondaryCidr(
	ctx context.Context,
	in *globaldedicatedv1.AddSecondaryCidrRequest,
	opts ...grpc.CallOption,
) (*globaldedicatedv1.Vpc, error) {
	panic("implement me")
}

func (c *fakeImpl) GetAuditLogConfig(
	ctx context.Context,
	in *globaldedicatedv1.GetAuditLogConfigRequest,
	opts ...grpc.CallOption,
) (*globaldedicatedv1.AuditLogConfig, error) {
	// TODO implement me
	panic("implement me")
}

func (c *fakeImpl) UpdateAuditLogConfig(
	ctx context.Context,
	in *globaldedicatedv1.UpdateAuditLogConfigRequest,
	opts ...grpc.CallOption,
) (*globaldedicatedv1.AuditLogConfig, error) {
	// TODO implement me
	panic("implement me")
}

func (c *fakeImpl) PrecheckAuditLogConfig(
	ctx context.Context,
	in *globaldedicatedv1.PrecheckAuditLogConfigRequest,
	opts ...grpc.CallOption,
) (*globaldedicatedv1.PrecheckAuditLogConfigResponse, error) {
	// TODO implement me
	panic("implement me")
}

func (c *fakeImpl) ListAuditLogFilterRules(
	ctx context.Context,
	in *globaldedicatedv1.ListAuditLogFilterRulesRequest,
	opts ...grpc.CallOption,
) (*globaldedicatedv1.ListAuditLogFilterRulesResponse, error) {
	// TODO implement me
	panic("implement me")
}

func (c *fakeImpl) CreateAuditLogFilterRule(
	ctx context.Context,
	in *globaldedicatedv1.CreateAuditLogFilterRuleRequest,
	opts ...grpc.CallOption,
) (*globaldedicatedv1.AuditLogFilterRule, error) {
	// TODO implement me
	panic("implement me")
}

func (c *fakeImpl) DeleteAuditLogFilterRule(
	ctx context.Context,
	in *globaldedicatedv1.DeleteAuditLogFilterRuleRequest,
	opts ...grpc.CallOption,
) (*emptypb.Empty, error) {
	// TODO implement me
	panic("implement me")
}

func (c *fakeImpl) ReplaceAuditLogFilterRule(
	ctx context.Context,
	in *globaldedicatedv1.ReplaceAuditLogFilterRuleRequest,
	opts ...grpc.CallOption,
) (*globaldedicatedv1.AuditLogFilterRule, error) {
	// TODO implement me
	panic("implement me")
}

func (c *fakeImpl) GetAccount(
	ctx context.Context,
	in *globaldedicatedv1.GetAccountRequest,
	opts ...grpc.CallOption,
) (*globaldedicatedv1.GetAccountResponse, error) {
	// TODO implement me
	panic("implement me")
}

func (c *fakeImpl) QueryAuditLogFiles(
	ctx context.Context,
	in *globaldedicatedv1.QueryAuditLogFilesRequest,
	opts ...grpc.CallOption,
) (*globaldedicatedv1.QueryAuditLogFilesResponse, error) {
	// TODO implement me
	panic("implement me")
}

func (c *fakeImpl) GenerateAuditLogFileDownloadAddress(
	ctx context.Context,
	in *globaldedicatedv1.GenerateAuditLogFileDownloadAddressRequest,
	opts ...grpc.CallOption,
) (*globaldedicatedv1.GenerateAuditLogFileDownloadAddressResponse, error) {
	// TODO implement me
	panic("implement me")
}

func (c *fakeImpl) CreatePrivateLinkServiceMigration(
	ctx context.Context,
	in *globaldedicatedv1.CreatePrivateLinkServiceMigrationRequest,
	opts ...grpc.CallOption,
) (*globaldedicatedv1.PrivateLinkServiceMigration, error) {
	panic("implement me")
}

func (c *fakeImpl) GetPrivateLinkServiceMigration(
	ctx context.Context,
	in *globaldedicatedv1.GetPrivateLinkServiceMigrationRequest,
	opts ...grpc.CallOption,
) (*globaldedicatedv1.PrivateLinkServiceMigration, error) {
	panic("implement me")
}

func (c *fakeImpl) ListPrivateLinkServiceMigrations(
	ctx context.Context,
	in *globaldedicatedv1.ListPrivateLinkServiceMigrationsRequest,
	opts ...grpc.CallOption,
) (*globaldedicatedv1.ListPrivateLinkServiceMigrationsResponse, error) {
	panic("implement me")
}

func (c *fakeImpl) CancelPrivateLinkServiceMigration(
	ctx context.Context,
	in *globaldedicatedv1.CancelPrivateLinkServiceMigrationRequest,
	opts ...grpc.CallOption,
) (*emptypb.Empty, error) {
	panic("implement me")
}

func (c *fakeImpl) GetClusterCustomParams(
	ctx context.Context,
	in *globaldedicatedv1.GetClusterCustomParamsRequest,
	opts ...grpc.CallOption,
) (*globaldedicatedv1.GetClusterCustomParamsResponse, error) {
	panic("implement me")
}

func (c *fakeImpl) SyncSystemVariables(
	ctx context.Context,
	in *globaldedicatedv1.SyncSystemVariablesRequest,
	opts ...grpc.CallOption,
) (*emptypb.Empty, error) {
	panic("implement me")
}

func (c *fakeImpl) SyncPdOnlineConfig(
	ctx context.Context,
	in *globaldedicatedv1.SyncPdOnlineConfigRequest,
	opts ...grpc.CallOption,
) (*emptypb.Empty, error) {
	panic("implement me")
}

func (c *fakeImpl) ShutdownUpgradeCluster(
	ctx context.Context,
	in *globaldedicatedv1.ShutdownUpgradeClusterRequest,
	opts ...grpc.CallOption,
) (*emptypb.Empty, error) {
	panic("implement me")
}

func (c *fakeImpl) DisableTidbGroupDNS(
	ctx context.Context,
	in *globaldedicatedv1.DisableTidbGroupDNSRequest,
	opts ...grpc.CallOption,
) (*emptypb.Empty, error) {
	panic("implement me")
}

func (c *fakeImpl) EnableTidbGroupDNS(
	ctx context.Context,
	in *globaldedicatedv1.EnableTidbGroupDNSRequest,
	opts ...grpc.CallOption,
) (*emptypb.Empty, error) {
	panic("implement me")
}

func (c *fakeImpl) GetPrivateLinkIPAddressType(
	context.Context,
	*globaldedicatedv1.GetPrivateLinkIPAddressTypeRequest,
	...grpc.CallOption,
) (*globaldedicatedv1.TidbGroupPrivateLinkIPAddressTypeStatus, error) {
	return &globaldedicatedv1.TidbGroupPrivateLinkIPAddressTypeStatus{}, nil
}

func (c *fakeImpl) SetPrivateLinkIPAddressType(
	_ context.Context,
	_ *globaldedicatedv1.SetPrivateLinkIPAddressTypeRequest,
	_ ...grpc.CallOption,
) (*globaldedicatedv1.TidbGroupPrivateLinkIPAddressTypeStatus, error) {
	return &globaldedicatedv1.TidbGroupPrivateLinkIPAddressTypeStatus{}, nil
}

func (c *fakeImpl) EnableClusterConfigBackup(
	ctx context.Context,
	in *globaldedicatedv1.EnableClusterConfigBackupRequest,
	opts ...grpc.CallOption,
) (*globaldedicatedv1.ClusterConfigBackupPolicy, error) {
	panic("implement me")
}

func (c *fakeImpl) DisableClusterConfigBackup(
	ctx context.Context,
	in *globaldedicatedv1.DisableClusterConfigBackupRequest,
	opts ...grpc.CallOption,
) (*globaldedicatedv1.ClusterConfigBackupPolicy, error) {
	panic("implement me")
}

func (c *fakeImpl) ListClusterConfigBackup(
	ctx context.Context,
	in *globaldedicatedv1.ListClusterConfigBackupRequest,
	opts ...grpc.CallOption,
) (*globaldedicatedv1.ListClusterConfigBackupResponse, error) {
	panic("implement me")
}
