package models

import (
	"time"

	"github.com/google/uuid"
)

// BackupLog 备份记录
type BackupLog struct {
	ID           uuid.UUID `gorm:"type:uuid;primary_key;default:gen_random_uuid()" json:"id"`
	FileName     string    `gorm:"type:varchar(255)" json:"fileName"`
	FilePath     string    `gorm:"type:varchar(500)" json:"filePath"` // MinIO path
	Size         int64     `gorm:"type:bigint" json:"size"`
	Status       string    `gorm:"type:varchar(20)" json:"status"` // SUCCESS, FAILED
	Message      string    `gorm:"type:text" json:"message"`
	StartTime    time.Time `gorm:"type:timestamp" json:"startTime"`
	EndTime      time.Time `gorm:"type:timestamp" json:"endTime"`
	UploadStatus string    `gorm:"type:varchar(20)" json:"uploadStatus"` // PENDING, UPLOADED, FAILED
}

// BackupConfig 备份配置 (非数据库表，仅用于API交互，实际存储在 SysConfig)
type BackupConfig struct {
	Enabled         bool   `json:"enabled"`         // 数据库自动备份开关
	ResourceEnabled bool   `json:"resourceEnabled"` // 资源与物联中心自动备份开关
	Time            string `json:"time"`            // "03:00"
	KeepDays        int    `json:"keepDays"`        // Local retention or logic retention
	Endpoint        string `json:"endpoint"`
	AccessKey string `json:"accessKey"`
	SecretKey string `json:"secretKey"`
	Bucket    string `json:"bucket"`
}
