using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using Newtonsoft.Json;

namespace detect.gui.Models.Entities;

[Table("dat_task")]
[Index(nameof(DeviceSn), IsUnique = false)]
public class DetectTaskEntity
{
    [Key] 
    [JsonProperty(PropertyName = "id")]
    [Column("id")]
    public long? Id { get; set; }

    [StringLength(255), Comment("设备序列号")] 
    [JsonProperty(PropertyName = "deviceSn")]
    [Column("device_sn")]
    public string? DeviceSn { get; set; }
    
    [StringLength(255), Comment("名称")] 
    [JsonProperty(PropertyName = "name")]
    [Column("name")]
    public string? Name { get; set; }

    [Comment("开始时间")] 
    [JsonProperty(PropertyName = "startTime")]
    [Column("start_time")]
    public DateTime? StartTime { get; set; }

    [Comment("结束时间")] 
    [JsonProperty(PropertyName = "endTime")]
    [Column("end_time")]
    public DateTime? EndTime { get; set; }

    [StringLength(2000), Comment("参数")] 
    [JsonProperty(PropertyName = "paramJson")]
    [Column("param_json")]
    public string? ParamJson { get; set; }

    [StringLength(10000), Comment("结果")] 
    [JsonProperty(PropertyName = "resultJson")]
    [Column("result_json")]
    public string? ResultJson { get; set; }
    
    [Comment("状态(0.未开始 1.进行中 2.已结束 3.暂停)")]
    [DefaultValue(0)]
    [JsonProperty(PropertyName = "state")]
    [Column("state")]
    public int State { get; set; }

    [Comment("创建时间")] 
    [JsonProperty(PropertyName = "createTime")]
    [Column("create_time")]
    public DateTime? CreateTime { get; set; }

    [Comment("更新时间")] 
    [JsonProperty(PropertyName = "updateTime")]
    [Column("update_time")]
    public DateTime? UpdateTime { get; set; }
    
    [StringLength(10000), Comment("最终结果")] 
    [JsonProperty(PropertyName = "results")]
    [Column("results")]
    public string? Results { get; set; }
    
    [StringLength(255), Comment("墙体类型")] 
    [JsonProperty(PropertyName = "wallType")]
    [Column("wall_type")]
    public string? WallType { get; set; }
    
    [StringLength(255), Comment("方向")] 
    [JsonProperty(PropertyName = "direction")]
    [Column("direction")]
    public string? Direction { get; set; }
    
    [StringLength(255), Comment("堆芯A点")] 
    [JsonProperty(PropertyName = "coreA")]
    [Column("core_a")]
    public string? CoreA { get; set; }

    [StringLength(255), Comment("堆芯B点")] 
    [JsonProperty(PropertyName = "coreB")]
    [Column("core_b")]
    public string? CoreB { get; set; }

}