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

import com.qqchen.deploy.backend.deploy.enums.DeployRecordStatusEnums;
import com.qqchen.deploy.backend.framework.annotation.LogicDelete;
import com.qqchen.deploy.backend.framework.domain.Entity;
import jakarta.persistence.Column;
import jakarta.persistence.EnumType;
import jakarta.persistence.Enumerated;
import jakarta.persistence.Table;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.time.LocalDateTime;

/**
 * 部署记录实体
 *
 * @author qqchen
 * @since 2025-11-02
 */
@Data
@EqualsAndHashCode(callSuper = true)
@jakarta.persistence.Entity
@Table(name = "deploy_record")
@LogicDelete
public class DeployRecord extends Entity<Long> {

    /**
     * 工作流实例ID
     */
    @Column(name = "workflow_instance_id", nullable = false)
    private Long workflowInstanceId;

    /**
     * 业务标识（UUID）
     */
    @Column(name = "business_key", nullable = false, length = 64)
    private String businessKey;

    /**
     * 团队应用配置ID
     */
    @Column(name = "team_application_id", nullable = false)
    private Long teamApplicationId;

    /**
     * 团队ID
     */
    @Column(name = "team_id", nullable = false)
    private Long teamId;

    /**
     * 应用ID
     */
    @Column(name = "application_id", nullable = false)
    private Long applicationId;

    /**
     * 环境ID
     */
    @Column(name = "environment_id", nullable = false)
    private Long environmentId;

    /**
     * 部署人
     */
    @Column(name = "deploy_by", length = 50)
    private String deployBy;

    /**
     * 部署备注
     */
    @Column(name = "deploy_remark", length = 500)
    private String deployRemark;

    /**
     * 部署状态
     */
    @Column(name = "status", nullable = false, length = 50)
    @Enumerated(EnumType.STRING)
    private DeployRecordStatusEnums status;

    /**
     * 开始时间
     */
    @Column(name = "start_time")
    private LocalDateTime startTime;

    /**
     * 结束时间
     */
    @Column(name = "end_time")
    private LocalDateTime endTime;
}

