using Newtonsoft.Json.Linq;

namespace SafeCampus.Application.Services.Business.Warn.Dto;

public class WarnInfoDto
{
    public long? ID { get; set; }
    /// <summary>
    /// 租户id
    /// </summary>
    public string TenantCode { get; set; }
    /// <summary>
    /// 门店id
    /// </summary>
    public string PoiId { get; set; }
    /// <summary>
    /// 预警id
    /// </summary>
    public string AlarmId { get; set; }
    /// <summary>
    /// 预警类型
    /// </summary>
    public string AlarmType { get; set; }
    /// <summary>
    /// 预警类型名称
    /// </summary>
    public string AlarmTypeDesc { get; set; }
    /// <summary>
    /// 摄像头id
    /// </summary>
    public string CameraId { get; set; }
    /// <summary>
    /// 摄像头名称
    /// </summary>
    public string CameraName { get; set; }
    /// <summary>
    /// 事件发生时间
    /// </summary>
    public DateTime Tick { get; set; }
    /// <summary>
    /// 摄像头快照，原链接有效期为2小时，获取到数据后下载到本地
    /// </summary>
    public string SnapshotUrl { get; set; }
    /// <summary>
    /// 预警关联视频（有些报警有，有些没有）
    /// </summary>
    public string VideoUrl { get; set; }
    /// <summary>
    /// 目标在快照中的位置
    /// </summary>
    public string Rects { get; set; }
    /// <summary>
    /// 人员名称
    /// </summary>
    public string PersonName { get; set; }
    /// <summary>
    /// 性别
    /// </summary>
    public string Gender { get; set; }
    /// <summary>
    /// 班级id
    /// </summary>
    public string PersonSetId { get; set; }
    /// <summary>
    /// 班级名称
    /// </summary>
    public string PersonSetName { get; set; }
    /// <summary>
    /// 人员id
    /// </summary>
    public string PersonId { get; set; }
    /// <summary>
    /// 人脸相似度
    /// </summary>
    public float? FaceSimilarity { get; set; }
    /// <summary>
    /// 人员跟踪id,同一个id表示是同一个人
    /// </summary>
    public string TrackId { get; set; }
    /// <summary>
    /// 服装库id
    /// </summary>
    public string ClothsSetId { get; set; }
    /// <summary>
    /// 服装id
    /// </summary>
    public string ClothId { get; set; }
    /// <summary>
    /// 服装相似度
    /// </summary>
    public float? ClothSimilarity { get; set; }
    /// <summary>
    /// 奔跑速度
    /// </summary>
    public string SpeedLevel { get; set; }
    /// <summary>
    /// 奔跑时周围人数
    /// </summary>
    public int? MaxAroundTracks { get; set; }
    /// <summary>
    /// 人群数量
    /// </summary>
    public int? Count { get; set; }
    /// <summary>
    /// 持续时长
    /// </summary>
    public int? Duration { get; set; }
    /// <summary>
    /// 人员类型
    /// </summary>
    public string PersonType { get; set; }
    /// <summary>
    ///场景标签
    /// </summary>
    public string Tags { get; set; }
    /// <summary>
    /// 额外数据，每个预警类型不同
    /// </summary>
    public string Extend { get; set; }
    /// <summary>
    /// 预警处理状态
    /// </summary>
    public int WarnHand { get; set; }
    /// <summary>
    /// 处理意见
    /// </summary>
    public string Remark { get; set; }
    /// <summary>
    /// 处理时间
    /// </summary>
    public DateTime? HandTime { get; set; }
}
public class WarnInfoDtoMapper : IRegister
{
    public void Register(TypeAdapterConfig config)
    {
        config.ForType<WarnInfo, WarnInfoDto>()
            //.Map(dest => dest.CameraName, src => src.CameraId.GetDescriptionByEnum<CameraType>());
            .Map(x => x.PersonSetName,x=>x.PersonSetInfoItem.PersonSetName)
            .Map(x => x.PersonName,x=>x.PersonInfoItem.Name)
            .Map(dest => dest.CameraName, src => src.CameraInfoItem.SensorName);
    }
}
