package dev.lions.unionflow.server.entity;

import jakarta.persistence.*;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;

@Entity
@Table(name = "backup_records")
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class BackupRecord extends BaseEntity {

    @Column(name = "name", nullable = false, length = 200)
    private String name;

    @Column(name = "description", length = 500)
    private String description;

    /** AUTO, MANUAL, RESTORE_POINT */
    @Column(name = "type", nullable = false, length = 50)
    private String type;

    @Column(name = "size_bytes")
    private Long sizeBytes;

    /** IN_PROGRESS, COMPLETED, FAILED */
    @Column(name = "status", nullable = false, length = 50)
    private String status;

    @Column(name = "completed_at")
    private LocalDateTime completedAt;

    @Column(name = "created_by", length = 200)
    private String createdBy;

    @Column(name = "includes_database", nullable = false)
    @Builder.Default
    private Boolean includesDatabase = true;

    @Column(name = "includes_files", nullable = false)
    @Builder.Default
    private Boolean includesFiles = false;

    @Column(name = "includes_configuration", nullable = false)
    @Builder.Default
    private Boolean includesConfiguration = true;

    @Column(name = "file_path", length = 500)
    private String filePath;

    @Column(name = "error_message", columnDefinition = "TEXT")
    private String errorMessage;
}
