export type BackupTarget = 'POSTGRES' | 'MPC_POSTGRES' | 'REDIS' | 'KAFKA' | 'ZOOKEEPER' | 'MINIO' | 'UPLOADS';
export type StorageType = 'MINIO' | 'LOCAL';
export type SnapshotStatus = 'PENDING' | 'RUNNING' | 'COMPLETED' | 'FAILED';

export const BACKUP_TARGET_LABELS: Record<BackupTarget, string> = {
  POSTGRES: 'PostgreSQL',
  MPC_POSTGRES: 'MPC PostgreSQL',
  REDIS: 'Redis',
  KAFKA: 'Kafka',
  ZOOKEEPER: 'ZooKeeper',
  MINIO: 'MinIO',
  UPLOADS: 'Uploads',
};

export interface SnapshotDetail {
  id: string;
  target: BackupTarget;
  status: SnapshotStatus;
  progress: number;
  progressMsg: string | null;
  fileSize: string;
  fileName: string | null;
  error: string | null;
  startedAt: string | null;
  completedAt: string | null;
}

export interface SnapshotTask {
  id: string;
  status: SnapshotStatus;
  storageType: StorageType;
  storagePath: string;
  targets: BackupTarget[];
  totalSize: string;
  error: string | null;
  startedAt: string | null;
  completedAt: string | null;
  createdAt: string;
  details: SnapshotDetail[];
}

export interface CreateSnapshotDto {
  storageType: StorageType;
  storagePath: string;
  targets: BackupTarget[];
}

export interface SnapshotProgress {
  taskId: string;
  target: BackupTarget;
  percent: number;
  message: string;
}
