package constant

import "time"

const (
	ExportIDPrefix = "exp-"

	ExportStatusAnnotation             = AnnoKeyPrefix + "/export-cancel"
	ExportMetaAnnotation               = "export.tidbcloud.com/metadata"
	ExportMeteringAnnotation           = AnnoKeyPrefix + "/export-metering"
	ExportMaxMeteringTimes             = 3
	ExportExpireTime                   = 2 * 24 * time.Hour
	ExportAllowMeteringToZeroThreshold = 2 * time.Minute
)

type ExportState string

const (
	ExportStatePreparing ExportState = "preparing"
	ExportStateRunning   ExportState = "running"
	ExportStateSucceed   ExportState = "succeed"
	ExportStateCanceled  ExportState = "canceled"
	ExportStateFailed    ExportState = "failed"
	ExportStateDeleted   ExportState = "deleted"
)

func (s ExportState) IsFinalState() bool {
	return s == ExportStateSucceed || s == ExportStateCanceled || s == ExportStateFailed
}

func (s ExportState) IsActiveState() bool {
	return s == ExportStatePreparing || s == ExportStateRunning
}

type ExportFileType string

const (
	ExportFileTypeSQL     ExportFileType = "SQL"
	ExportFileTypeCSV     ExportFileType = "CSV"
	ExportFileTypePARQUET ExportFileType = "PARQUET"
)

type ExportTargetType string

const (
	ExportTargetTypeLocal     ExportTargetType = "LOCAL"
	ExportTargetTypeS3        ExportTargetType = "S3"
	ExportTargetTypeGCS       ExportTargetType = "GCS"
	ExportTargetTypeAzureBlob ExportTargetType = "Azure"
	ExportTargetTypeOSS       ExportTargetType = "OSS"
)

type ExportMeteringStatus string

const (
	ExportMeteringStatePending ExportMeteringStatus = "pending"
	ExportMeteringStateRunning ExportMeteringStatus = "running"
	ExportMeteringStateSucceed ExportMeteringStatus = "succeed"
)

type Compression string

const (
	CompressionNone   Compression = "none"
	CompressionGzip   Compression = "gzip"
	CompressionZstd   Compression = "zstd"
	CompressionSnappy Compression = "snappy"
)

type ParquetCompression string

const (
	ParquetCompressionNone   ParquetCompression = "none"
	ParquetCompressionGzip   ParquetCompression = "gzip"
	ParquetCompressionZstd   ParquetCompression = "zstd"
	ParquetCompressionSnappy ParquetCompression = "snappy"
)
