using Hotline.Orders;
using Hotline.Share.Dtos;
using Hotline.Share.Enums.Snapshot;
using SqlSugar;
using System.ComponentModel;
using XF.Domain.Repository;

namespace Hotline.Snapshot;

/// <summary>
/// 工单表扩展
/// Id 和 Order.Id 相同
/// </summary>
[Description("工单表扩展")]
public class OrderSnapshot : CreationSoftDeleteEntity
{
    /// <summary>
    /// 行业Id
    /// <inheritdoc cref="Industry"/> 表的Id
    /// </summary>
    [SugarColumn(ColumnDescription = "行业Id")]
    public string IndustryId { get; set; }

    /// <summary>
    /// 行业名称
    /// <inheritdoc cref="Industry"/> 表的Name
    /// </summary>
    [SugarColumn(ColumnDescription = "行业名称")]
    public string IndustryName { get; set; }

    /// <summary>
    /// 社区Id
    /// <inheritdoc cref="CommunityInfo"/> 表的Id
    /// </summary>
    [SugarColumn(ColumnDescription = "社区Id")]
    public string? CommunityId { get; set; }

    /// <summary>
    /// 社区名字
    /// </summary>
    [SugarColumn(ColumnDescription = "社区名字")]
    public string? CommunityName { get; set; }

    /// <summary>
    /// 社区名字
    /// </summary>
    [SugarColumn(ColumnDescription = "社区名字")]
    public string? CommunityFullName { get; set; }

    /// <summary>
    /// 作业类型
    /// </summary>
    [SugarColumn(ColumnDescription = "作业类型")]
    public int? JobType { get; set; }

    /// <summary>
    /// 作业类型
    /// </summary>
    [SugarColumn(ColumnDescription ="作业类型")]
    public string? JobTypeName { get; set; }

    /// <summary>
    /// 经营单位类别
    /// </summary>
    [SugarColumn(ColumnDescription = "经营单位类别")]
    public string? BusinessUnitType { get; set; }

    /// <summary>
    /// 作业场所
    /// </summary>
    [SugarColumn(ColumnDescription = "作业场所")]
    public string? Workplace { get; set; }

    /// <summary>
    /// 场所名称(多个场所使用 - 连接)
    /// </summary>
    [SugarColumn(ColumnDescription = "场所名称")]
    public string? WorkplaceName { get; set; }

    /// <summary>
    /// 作业区域
    /// </summary>
    [SugarColumn(ColumnDescription = "作业区域")]
    public string? WorkArea { get; set; }

    /// <summary>
    /// 作业区域Id
    /// </summary>
    [SugarColumn(ColumnDescription = "作业区域Id")]
    public string? WorkAreaId { get; set; }

    /// <summary>
    /// 作业时间
    /// </summary>
    [SugarColumn(ColumnDescription = "作业时间")]
    public DateTime? StartWorkTime { get; set; }

    /// <summary>
    /// 作业结束时间
    /// </summary>
    [SugarColumn(ColumnDescription = "作业时间")]
    public DateTime? EndWorkTime { get; set; }

    /// <summary>
    /// 是否重点
    /// </summary>
    [SugarColumn(ColumnDescription = "是否重点")]
    public bool? IsEmphasis { get; set; }

    #region 标记工单是否安全生产字段

    /// <summary>
    /// 部门标记是否安全生产
    /// </summary>
    [SugarColumn(ColumnDescription = "部门标记是否安全生产")]
    public bool? IsSafetyDepartment { get; set; }

    /// <summary>
    /// 标记人
    /// </summary>
    [SugarColumn(ColumnDescription = "标记人")]
    public string? SignUserId { get; set; }

    /// <summary>
    /// 标记人
    /// </summary>
    [SugarColumn(ColumnDescription = "标记人")]
    public string? SignUserName { get; set; }

    /// <summary>
    /// 标记时间
    /// </summary>
    [SugarColumn(ColumnDescription = "标记时间")]
    public DateTime? SignTime { get; set; }

    /// <summary>
    /// 标记备注
    /// </summary>
    [SugarColumn(ColumnDescription = "标记备注")]
    public string? SignRemark { get; set; }
    #endregion

    /// <summary>
    /// 部门是否存在安全隐患
    /// </summary>
    [SugarColumn(ColumnDescription = "部门是否存在安全隐患")]
    public bool? IsDangerDepartment { get; set; }

    /// <summary>
    /// 部门是否属实
    /// </summary>
    [SugarColumn(ColumnDescription = "部门是否属实")]
    public bool? IsTruthDepartment { get; set; }

    /// <summary>
    /// 部门是否整改
    /// </summary>
    [SugarColumn(ColumnDescription = "部门是否整改")]
    public bool? IsRectifyDepartment { get; set; }

    /// <summary>
    /// 线索分类Id
    /// </summary>
    [SugarColumn(ColumnDescription = "线索分类")]
    public string? IndustryCase { get; set; }

    /// <summary>
    /// 小程序公开
    /// </summary>
    [SugarColumn(ColumnDescription = "小程序公开")]
    public bool? IsAppOpened { get; set; }

    /// <summary>
    /// 合规类型
    /// </summary>
    [SugarColumn(ColumnDescription = "合规类型")]
    public ECompliantType? CompliantType { get; set; }

    /// <summary>
    /// 发布工单时标记的工单标签
    /// </summary>
    [SugarColumn(ColumnDescription = "工单标签", ColumnDataType = "json", IsJson = true, IsNullable = true)]
    public IList<Kv>? Labels { get; set; }

    /// <summary>
    /// 发布工单时标记的工单标签(多个使用 | 分隔)
    /// </summary>
    [SugarColumn(ColumnDescription = "工单标签")]
    public string? LabelName { get; set; }

    /// <summary>
    /// 标签用户
    /// </summary>
    [SugarColumn(ColumnDescription = "标签用户")]
    public string? LabelUserName { get; set; }

    /// <summary>
    /// 标签用户Id
    /// </summary>
    [SugarColumn(ColumnDescription = "标签用户Id")]
    public string? LabelUserId { get; set; }

    /// <summary>
    /// 标签时间
    /// </summary>
    [SugarColumn(ColumnDescription = "标签时间")]
    public DateTime? LabelTime { get; set; }

    /// <summary>
    /// 工单办理:
    /// 是否申请追加奖励
    /// </summary>
    [SugarColumn(ColumnDescription = "是否申请追加奖励")]
    public bool? IsAward { get; set; }

    /// <summary>
    /// 追加奖励人开户银行
    /// </summary>
    [SugarColumn(ColumnDescription = "追加奖励人开户银行")]
    public string? AwardOpenBank { get; set; }

    /// <summary>
    /// 追加奖励人姓名
    /// </summary>
    [SugarColumn(ColumnDescription = "追加奖励人姓名")]
    public string? AwardName { get; set; }

    /// <summary>
    /// 追加奖励人银行卡号
    /// </summary>
    [SugarColumn(ColumnDescription = "追加奖励人银行卡号")]
    public string? AwardBankCardNo { get; set; }

    /// <summary>
    /// 追加奖励金额(元)
    /// </summary>
    [SugarColumn(ColumnDescription = "追加奖励金额(元)")]
    public double? AwardAmount { get; set; }

    /// <summary>
    /// 补充奖励类型
    /// </summary>
    [SugarColumn(ColumnDescription = "补充奖励类型")]
    public string? ReplenishTypeId { get; set; }

    /// <summary>
    /// 补充奖励类型
    /// </summary>
    [SugarColumn(ColumnDescription = "补充奖励类型")]
    public string? ReplenishTypeName { get; set; }

    /// <summary>
    /// 核实方式
    /// </summary>
    [SugarColumn(ColumnDescription = "核实方式")]
    public string? VerifyType { get; set; }

    /// <summary>
    /// 是否按清单检查
    /// </summary>
    [SugarColumn(ColumnDescription = "是否按清单检查")]
    public bool? IsCheckList { get; set; }

    #region 网格员回复

    /// <summary>
    /// 网格员系统交互日志
    /// </summary>
    [SugarColumn(ColumnDescription = "网格员系统交互日志")]
    public string? GuiderAccLog { get; set; }

    /// <summary>
    /// 网格员回复截止日期
    /// </summary>
    [SugarColumn(ColumnDescription = "网格员回复截止日期")]
    public DateTime? DeadLine { get; set; }

    /// <summary>
    /// 网格员是否办理
    /// </summary>
    [SugarColumn(ColumnDescription = "网格员是否办理")]
    public bool? IsDeal { get; set; }

    /// <summary>
    /// 网格E通编号
    /// </summary>
    [SugarColumn(ColumnDescription = "网格E通编号")]
    public string? NetworkENumber { get; set; }

    /// <summary>
    /// 网格员是否属实
    /// </summary>
    [SugarColumn(ColumnDescription = "网格员是否属实")]
    public bool? IsTruth { get; set; }

    /// <summary>
    /// 是否重复
    /// </summary>
    [SugarColumn(ColumnDescription = "是否重复")]
    public bool? IsRepetition { get; set; }

    /// <summary>
    /// 是否隐患
    /// </summary>
    [SugarColumn(ColumnDescription = "是否隐患")]
    public bool? IsDanger { get; set; }

    /// <summary>
    /// 网格员回复内容
    /// </summary>
    [SugarColumn(ColumnDescription = "网格员回复内容", Length = 2048)]
    public string? NetworkRemark { get; set; }

    /// <summary>
    /// 网格员办理时间
    /// </summary>
    [SugarColumn(ColumnDescription = "网格员办理时间")]
    public DateTime? ReplyDate { get; set; }

    /// <summary>
    /// 网格员姓名
    /// </summary>
    [SugarColumn(ColumnDescription = "网格员姓名")]
    public string? MemberName { get; set; }

    /// <summary>
    /// 网格员电话
    /// </summary>
    [SugarColumn(ColumnDescription = "网格员电话")]
    public string? MemberMobile { get; set; }

    /// <summary>
    /// 办理人账号
    /// </summary>
    [SugarColumn(ColumnDescription = "办理人账号")]
    public string? ReplyUserName { get; set; }

    /// <summary>
    /// 办理部门
    /// </summary>
    [SugarColumn(ColumnDescription = "办理部门")]
    public string? ReplyBMName { get; set; }

    /// <summary>
    /// 办理状态 1，7：流转 2：办结 3：退回 4：网格员签收 5：消息推送 6: 超时自动退单
    /// </summary>
    [SugarColumn(ColumnDescription ="网格员办理状态")]
    public EGuiderSystemReplyType? ReplyResultType { get; set; }

    #endregion

    /// <summary>
    /// 购气单位/个人名称
    /// </summary>
    [SugarColumn(ColumnDescription = "购气单位/个人名称")]
    public string? CompanyName { get; set; }

    /// <summary>
    /// 发送网格员系统时间
    /// </summary>
    [SugarColumn(ColumnDescription = "发送网格员系统时间")]
    public DateTime? SendGuidSystemTime { get; set; }

    /// <summary>
    /// 网格员系统回调时间
    /// </summary>
    [SugarColumn(ColumnDescription = "网格员系统回调时间")]
    public DateTime? GuidSystemCallBackTime { get; set; }

    /// <summary>
    /// 网格员系统是否回调
    /// </summary>
    [SugarColumn(ColumnDescription = "网格员系统是否回调", DefaultValue = "f")]
    public bool IsGuidSystemCallBack { get; set; }

    #region 重办信息
    /// <summary>
    /// 重办原因Id
    /// </summary>
    [SugarColumn(ColumnDescription = "重办原因Id")]
    public string? SpecialReasonId { get; set; }

    /// <summary>
    /// 重办原因
    /// </summary>
    [SugarColumn(ColumnDescription = "重办原因")]
    public string? SpecialReasonName { get; set; }
    #endregion

    /// <summary>
    /// 扩展字段
    /// 如果别的系统希望通过界面收集某个字段, 然后我们系统不需要使用, 就可以放这里.
    /// 第三方系统在获取我们系统工单时直接把这个字段数据返回即可
    /// </summary>
    [SugarColumn(ColumnDescription = "12345不使用的扩展字段,第三方系统使用")]
    public string? Attach { get; set; }
}