package v1alpha1

import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

type PrivateLinkServiceMigrationPhase string

const (
	PrivateLinkServiceMigrationPhaseNone      PrivateLinkServiceMigrationPhase = ""
	PrivateLinkServiceMigrationPhasePending   PrivateLinkServiceMigrationPhase = "Pending"
	PrivateLinkServiceMigrationPhaseRunning   PrivateLinkServiceMigrationPhase = "Running"
	PrivateLinkServiceMigrationPhaseCompleted PrivateLinkServiceMigrationPhase = "Completed"
	PrivateLinkServiceMigrationPhaseFailed    PrivateLinkServiceMigrationPhase = "Failed"
)

// EDIT THIS FILE!  THIS IS SCAFFOLDING FOR YOU TO OWN!
// NOTE: json tags are required.  Any new fields you add must have json tags for the fields to be serialized.

// +kubebuilder:object:root=true
// +kubebuilder:resource:categories=regionserver
// +kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="PHASE",type="string",JSONPath=".status.phase"
// +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp"
// PrivateLinkServiceMigration is the Schema for the PrivateLinkServiceMigration API
type PrivateLinkServiceMigration struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec   PrivateLinkServiceMigrationSpec   `json:"spec,omitempty"`
	Status PrivateLinkServiceMigrationStatus `json:"status,omitempty"`
}

type PrivateLinkServiceMigrationSpec struct {
	ClusterID                   string `json:"clusterId"`
	TidbGroupID                 string `json:"tidbGroupId"`
	PrivateLinkServiceNamespace string `json:"privateLinkServiceNamespace"`
	PrivateLinkServiceName      string `json:"privateLinkServiceName"`
	ProjectID                   string `json:"projectId"`
	TargetClusterID             string `json:"targetClusterId"`
	TargetTidbGroupID           string `json:"targetTidbGroupId"`
}

type PrivateLinkServiceMigrationStatus struct {
	Phase  PrivateLinkServiceMigrationPhase `json:"phase,omitempty"`
	Reason string                           `json:"reason,omitempty"`
	// +patchMergeKey=type
	// +patchStrategy=merge
	// +optional
	Conditions Conditions `json:"conditions,omitempty"`
}

// +kubebuilder:object:root=true
// PrivateLinkServiceMigrationList contains a list of PrivateLinkServiceMigration
type PrivateLinkServiceMigrationList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`

	Items []PrivateLinkServiceMigration `json:"items"`
}

func init() {
	SchemeBuilder.Register(&PrivateLinkServiceMigration{}, &PrivateLinkServiceMigrationList{})
}
