package frps

import (
	"context"

	eksv1alpha1 "github.com/tidbcloud/eks-provider/api/v1alpha1"
	"sigs.k8s.io/controller-runtime/pkg/client"
)

// Procedure is the interface for async deploying a single resource.
type Procedure interface {
	// Deploy deploys resource for the specified tenant.
	// The operation needs to be idempotent.
	Deploy(ctx context.Context, base client.Client, info ProcedureInfo) error
	// Status retrieves the status for the deploying step.
	Status(ctx context.Context, base client.Reader, infra client.Client, info ProcedureInfo) (bool, error)
	// Cleanup cleans up the deploying step.
	Cleanup(ctx context.Context, baseCli client.Client, info ProcedureInfo) error
	// Name returns the name of the step.
	Name() string
}

// ProcedureInfo contains the procedure information.
type ProcedureInfo struct {
	// frps is the pointer to Frpserver object
	frps *eksv1alpha1.Frpserver
	// namespace is the namespace for procedure information
	namespace string
}
