package procedure

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, infra client.Client, info ProcedureInfo) error
	// Status retrieves the status for the deploying step.
	Status(ctx context.Context, base, infra client.Reader, info ProcedureInfo) (bool, error)
	// Name returns the name of the step.
	Name() string
}

// ProcedureInfo contains the procedure information.
type ProcedureInfo struct {
	// Region specifies the AWS region of the EKS info.
	Region string
	// Cluster specifies the name of the EKS info.
	Cluster string
	// ProviderConfigRef specifies the crossplane providerconfig reference.
	ProviderConfigRef string
	// VpcID is the ID of the VPC.
	VpcID string
	// SubnetIDs is the subnet IDs of the VPC.
	SubnetIDs []string
	// SecurityGroupIDs is the list of security groups for the EKS info.
	SecurityGroupIDs []string
	// eksConnection is the pointer to EKSConnection object
	eksConnection *eksv1alpha1.EKSConnection
	// namespace is the namespace for procedure information
	namespace string
	// assumeRole is the tenant role to be assumed for resource provision.
	assumeRole string
	// externalID is the external ID for the tenant role.
	externalID string
}
