package tidbtools

// ClusterType identifies the architecture of a TiDB Cloud cluster for
// Tools-page routing. Values match the ccproto.ClusterType string names.
type ClusterType string

const (
	ClusterTypeDedicatedTiDB  ClusterType = "DEDICATED_TIDB"
	ClusterTypeSharedPool     ClusterType = "SHARED_POOL"
	ClusterTypeLogicalCluster ClusterType = "LOGICAL_CLUSTER"
)

// ExportStatus is the lifecycle status for a Premium/Essential v2 Export
// service task. It is distinct from Dedicated BackupExportStatus even though
// the current wire values overlap.
type ExportStatus string

const (
	ExportStatusPending   ExportStatus = "pending"
	ExportStatusRunning   ExportStatus = "running"
	ExportStatusSucceeded ExportStatus = "succeeded"
	ExportStatusFailed    ExportStatus = "failed"
	ExportStatusCanceled  ExportStatus = "canceled"
	ExportStatusUnknown   ExportStatus = "unknown"
)

// DMJobStatus is the lifecycle state of a DM migration job or sub-task.
type DMJobStatus string

const (
	DMJobStatusRunning  DMJobStatus = "running"
	DMJobStatusPaused   DMJobStatus = "paused"
	DMJobStatusFinished DMJobStatus = "finished"
	DMJobStatusFailed   DMJobStatus = "failed"
	DMJobStatusStopped  DMJobStatus = "stopped"
	DMJobStatusUnknown  DMJobStatus = "unknown"
)

// DMJobMode is the replication mode of a DM job or sub-task.
type DMJobMode string

const (
	DMJobModeFull        DMJobMode = "full"
	DMJobModeIncremental DMJobMode = "incremental"
	DMJobModeAll         DMJobMode = "all"
)

// DMPrecheckStatus is the result status of a DM precheck run or item.
type DMPrecheckStatus string

const (
	DMPrecheckStatusPassed  DMPrecheckStatus = "passed"
	DMPrecheckStatusFailed  DMPrecheckStatus = "failed"
	DMPrecheckStatusWarning DMPrecheckStatus = "warning"
	DMPrecheckStatusRunning DMPrecheckStatus = "running"
)

// ImportStatus is the lifecycle status for Dedicated import jobs and
// Premium IMPORT INTO tasks.
type ImportStatus string

const (
	ImportStatusPending   ImportStatus = "pending"
	ImportStatusPreparing ImportStatus = "preparing"
	ImportStatusRunning   ImportStatus = "running"
	ImportStatusSucceeded ImportStatus = "succeeded"
	ImportStatusFailed    ImportStatus = "failed"
	ImportStatusCanceled  ImportStatus = "canceled"
)

// ImportSourceType identifies the data origin for an import job.
type ImportSourceType string

const (
	ImportSourceTypeLocalFile ImportSourceType = "LOCAL_FILE"
	ImportSourceTypeS3        ImportSourceType = "S3"
	ImportSourceTypeGCS       ImportSourceType = "GCS"
)

// ImportFileType is the data format of the import source.
type ImportFileType string

const (
	ImportFileTypeCSV     ImportFileType = "CSV"
	ImportFileTypeSQL     ImportFileType = "SQL"
	ImportFileTypeParquet ImportFileType = "PARQUET"
)

// BackupScheduledStatus is the scheduling state of the automatic backup policy.
type BackupScheduledStatus string

const (
	BackupScheduledStatusEnabled  BackupScheduledStatus = "enabled"
	BackupScheduledStatusPaused   BackupScheduledStatus = "paused"
	BackupScheduledStatusDisabled BackupScheduledStatus = "disabled"
)

// SnapshotBackupType distinguishes manually triggered from automatic
// scheduled snapshot backups.
type SnapshotBackupType string

const (
	SnapshotBackupTypeManual SnapshotBackupType = "Manual"
	SnapshotBackupTypeAuto   SnapshotBackupType = "Auto"
)

// BackupStatus is the lifecycle status for a snapshot backup.
type BackupStatus string

const (
	BackupStatusRunning   BackupStatus = "running"
	BackupStatusSucceeded BackupStatus = "succeeded"
	BackupStatusFailed    BackupStatus = "failed"
	BackupStatusCanceled  BackupStatus = "canceled"
	BackupStatusPending   BackupStatus = "pending"
)

// BackupExportStatus is the lifecycle status for a backup export job.
type BackupExportStatus string

const (
	BackupExportStatusPending   BackupExportStatus = "pending"
	BackupExportStatusRunning   BackupExportStatus = "running"
	BackupExportStatusSucceeded BackupExportStatus = "succeeded"
	BackupExportStatusFailed    BackupExportStatus = "failed"
	BackupExportStatusCanceled  BackupExportStatus = "canceled"
	BackupExportStatusUnknown   BackupExportStatus = "unknown"
)

// LogBackupStatus is the lifecycle status for a continuous (log) backup
// stream used for Point-in-Time Recovery (PiTR).
type LogBackupStatus string

const (
	LogBackupStatusPending   LogBackupStatus = "pending"
	LogBackupStatusRunning   LogBackupStatus = "running"
	LogBackupStatusStopping  LogBackupStatus = "stopping"
	LogBackupStatusStopped   LogBackupStatus = "stopped"
	LogBackupStatusPausing   LogBackupStatus = "pausing"
	LogBackupStatusPaused    LogBackupStatus = "paused"
	LogBackupStatusResuming  LogBackupStatus = "resuming"
	LogBackupStatusFailed    LogBackupStatus = "failed"
	LogBackupStatusScheduled LogBackupStatus = "scheduled"
)

// RestoreStatus is the lifecycle status for a cluster restore operation.
type RestoreStatus string

const (
	RestoreStatusPending    RestoreStatus = "pending"
	RestoreStatusRunning    RestoreStatus = "running"
	RestoreStatusSucceeded  RestoreStatus = "succeeded"
	RestoreStatusFailed     RestoreStatus = "failed"
	RestoreStatusCanceled   RestoreStatus = "canceled"
	RestoreStatusTerminated RestoreStatus = "terminated"
	RestoreStatusUnknown    RestoreStatus = "unknown"
)

// RestoreMode identifies the type of restore operation.
type RestoreMode string

const (
	RestoreModeSnapshot RestoreMode = "snapshot"
	RestoreModePITR     RestoreMode = "pitr"
)

// ChangefeedStatus is the lifecycle status for a TiCDC changefeed.
type ChangefeedStatus string

const (
	ChangefeedStatusNormal   ChangefeedStatus = "normal"
	ChangefeedStatusWarning  ChangefeedStatus = "warning"
	ChangefeedStatusError    ChangefeedStatus = "error"
	ChangefeedStatusFailed   ChangefeedStatus = "failed"
	ChangefeedStatusCreating ChangefeedStatus = "creating"
	ChangefeedStatusStarting ChangefeedStatus = "starting"
	ChangefeedStatusStopping ChangefeedStatus = "stopping"
	ChangefeedStatusStopped  ChangefeedStatus = "stopped"
	ChangefeedStatusScaling  ChangefeedStatus = "scaling"
	ChangefeedStatusEditing  ChangefeedStatus = "editing"
	ChangefeedStatusDeleting ChangefeedStatus = "deleting"
	ChangefeedStatusDeleted  ChangefeedStatus = "deleted"
	ChangefeedStatusFinished ChangefeedStatus = "finished"
)
