package com.qqchen.deploy.backend.system.entity;

import com.qqchen.deploy.backend.framework.domain.Entity;
import jakarta.persistence.*;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 系统版本发布记录实体
 */
@Data
@EqualsAndHashCode(callSuper = true)
@jakarta.persistence.Entity
@Table(name = "system_release")
public class SystemRelease extends Entity<Long> {

    /**
     * 发布版本号（如 1.51）
     */
    @Column(name = "release_version", nullable = false, precision = 10, scale = 2)
    private BigDecimal releaseVersion;

    /**
     * 模块类型：BACKEND/FRONTEND/ALL
     */
    @Column(name = "module", nullable = false, length = 20)
    private String module;

    /**
     * 发布时间
     */
    @Column(name = "release_date", nullable = false)
    private LocalDateTime releaseDate;

    /**
     * 变更内容（换行分隔）
     */
    @Column(name = "changes", columnDefinition = "TEXT")
    private String changes;

    /**
     * 是否已发送版本发布通知
     */
    @Column(name = "notified", nullable = false)
    private Boolean notified = false;

    /**
     * 延迟执行分钟数（创建后多久开始维护，为空则不触发维护）
     */
    @Column(name = "delay_minutes")
    private Integer delayMinutes;

    /**
     * 预计维护时长（分钟）
     */
    @Column(name = "estimated_duration")
    private Integer estimatedDuration;

    /**
     * 是否自动停止服务
     */
    @Column(name = "enable_auto_shutdown", nullable = false)
    private Boolean enableAutoShutdown = false;
}
