namespace Admin.NET.Plugin.AiDOP.Entity.S8;
[SugarTable("ado_s8_config_draft", "S8 统一配置器草稿")]
[SugarIndex("idx_s8_config_draft_tfs", nameof(TenantId), OrderByType.Asc, nameof(FactoryId), OrderByType.Asc, nameof(Status), OrderByType.Asc)]
[SugarIndex("uk_s8_config_draft_tenant_factory_code", nameof(TenantId), OrderByType.Asc, nameof(FactoryId), OrderByType.Asc, nameof(DraftCode), OrderByType.Asc, IsUnique = true)]
[SugarIndex("idx_s8_config_draft_generated_rule", nameof(GeneratedRuleId), OrderByType.Asc)]
public class AdoS8ConfigDraft
{
[SugarColumn(ColumnName = "id", IsPrimaryKey = true, IsIdentity = true, ColumnDataType = "bigint")]
public long Id { get; set; }
[SugarColumn(ColumnName = "tenant_id", ColumnDataType = "bigint")]
public long TenantId { get; set; }
[SugarColumn(ColumnName = "factory_id", ColumnDataType = "bigint")]
public long FactoryId { get; set; }
[SugarColumn(ColumnName = "draft_code", Length = 64)]
public string DraftCode { get; set; } = string.Empty;
[SugarColumn(ColumnName = "draft_name", Length = 128, IsNullable = true)]
public string? DraftName { get; set; }
/// 草稿状态:IN_PROGRESS / GENERATED。
[SugarColumn(ColumnName = "status", Length = 32)]
public string Status { get; set; } = "IN_PROGRESS";
[SugarColumn(ColumnName = "current_step")]
public int CurrentStep { get; set; }
[SugarColumn(ColumnName = "mechanism", Length = 32, IsNullable = true)]
public string? Mechanism { get; set; }
[SugarColumn(ColumnName = "stage_code", Length = 16, IsNullable = true)]
public string? StageCode { get; set; }
[SugarColumn(ColumnName = "order_flow_code", Length = 64, IsNullable = true)]
public string? OrderFlowCode { get; set; }
[SugarColumn(ColumnName = "exception_type_code", Length = 64, IsNullable = true)]
public string? ExceptionTypeCode { get; set; }
/// 向导态序列化 JSON;列表不返回此字段。
[SugarColumn(ColumnName = "wizard_json", ColumnDataType = "mediumtext")]
public string WizardJson { get; set; } = string.Empty;
/// generate-rule 成功后回写 ado_s8_watch_rule.id;幂等返回依据。
[SugarColumn(ColumnName = "generated_rule_id", ColumnDataType = "bigint", IsNullable = true)]
public long? GeneratedRuleId { get; set; }
[SugarColumn(ColumnName = "remark", Length = 512, IsNullable = true)]
public string? Remark { get; set; }
[SugarColumn(ColumnName = "created_at")]
public DateTime CreatedAt { get; set; } = DateTime.Now;
[SugarColumn(ColumnName = "updated_at", IsNullable = true)]
public DateTime? UpdatedAt { get; set; }
}