using Hotline.Share.Dtos.File;
using Hotline.Share.Dtos.Settings;
using Hotline.Share.Enums.Order;
using Hotline.Share.Enums.Settings;
using Hotline.Share.Enums.Snapshot;
using Hotline.Share.Requests;
using Hotline.Share.Tools;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using XF.Utility.EnumExtensions;

namespace Hotline.Share.Dtos.Snapshot;
internal class IndustryDto
{
}

public class IndustryDetailOutDto : IndustryItemsOutDto
{
    /// <summary>
    /// 背景图片 url
    /// </summary>
    public string? BackgroundImgUrl { get; set; }

    /// <summary>
    /// Banner 图片 url
    /// </summary>
    public string? BannerImgUrl { get; set; }

    /// <summary>
    /// 宫格图
    /// </summary>
    public string? CellImgUrl { get; set; }

    /// <summary>
    /// 关怀宫格图
    /// </summary>
    public string? CareCellImgUrl { get; set; }

    /// <summary>
    /// 附件集合(小程序上面可以下载的 doc 文件)
    /// </summary>
    public IList<IndustryFileDto> Files { get; set; }

    /// <summary>
    /// 阶段性回复间隔时间(小时)
    /// </summary>
    public int IntervalTime { get; set; } = 0;

    /// <summary>
    /// 关联宣传学习
    /// 从字典中取"公告类型"
    /// </summary>
    public string BulletinTypePublicityId { get; set; }

    /// <summary>
    /// 关联宣传学习
    /// 从字典中取"公告类型"
    /// </summary>
    public string BulletinTypePublicityName { get; set; }

    /// <summary>
    /// 关联操作指引
    /// 从字典中取"公告类型"
    /// </summary>
    public string BulletinTypeGuideId { get; set; }

    /// <summary>
    /// 关联操作指引
    /// 从字典中取"公告类型"
    /// </summary>
    public string BulletinTypeGuideName { get; set; }

    /// <summary>
    /// App是否启用
    /// </summary>
    public bool IsAppEnable { get; set; }

    /// <summary>
    /// 是否开启积分
    /// </summary>
    public bool? IsPoints { get; set; }
}

public class IndustryItemsOutDto : IndustryOutDto
{
    /// <summary>
    /// 受理类型
    /// </summary>
    public string AcceptType { get; set; }

    /// <summary>
    /// 受理类型代码
    /// </summary>
    public string? AcceptTypeCode { get; set; }

    /// <summary>
    /// 标题追加信息
    /// </summary>
    public string? TitleSuffix { get; set; }

    /// <summary>
    /// 审批部门Id
    /// </summary>
    public string? ApproveOrgId { get; set; }

    /// <summary>
    /// 审批部门名字
    /// </summary>
    public string? ApproveOrgName { get; set; }

    /// <summary>
    /// 市民发放红包金额(单位:元)
    /// </summary>
    public double CitizenReadPackAmount { get; set; }

    /// <summary>
    /// 网络员发放红包金额(单位:元)
    /// </summary>
    public double GuiderReadPackAmount { get; set; }

    /// <summary>
    /// 是否启用
    /// </summary>
    public bool IsEnable { get; set; }

    /// <summary>
    /// 是否启用
    /// </summary>
    public string IsEnableTxt => IsEnable ? "启用" : "禁用";

    /// <summary>
    /// 排序
    /// </summary>
    public int DisplayOrder { get; set; }
}

public class IndustryOutDto
{
    /// <summary>
    /// Id
    /// </summary>
    public string Id { get; set; }

    /// <summary>
    /// 名字
    /// </summary>
    public string Name { get; set; }

    /// <summary>
    /// 帮助引导用语
    /// </summary>
    public string? TxtHelpRemarks { get; set; }

    /// <summary>
    /// 宫格说明文本
    /// </summary>
    public string? TxtRemarks { get; set; }

    /// <summary>
    /// 关怀说明
    /// </summary>
    public string? TxtCareRemarks { get; set; }

    /// <summary>
    /// 页面Url
    /// </summary>
    public string? PageUrl { get; set; }

    /// <summary>
    /// 关怀页面Url
    /// </summary>
    public string? PageCareUrl { get; set; }

    /// <summary>
    /// 上报积分
    /// </summary>
    public int? ReportPoints { get; set; }

    /// <summary>
    /// 审核同意积分
    /// </summary>
    public int? ArgeePoints { get; set; }

    /// <summary>
    /// 审核不同意扣除积分
    /// </summary>
    public int? RefusePoints { get; set; }

    /// <summary>
    /// 额外扣除积分
    /// </summary>
    public int? ExtraDeductedPoints { get; set; }

    /// <summary>
    /// 是否开启积分
    /// </summary>
    public bool? IsPoints { get; set; }

}

/// <summary>
/// 行业集合入参
/// </summary>
/// <param name="name">名称</param>
/// <param name="departmentName">审批部门</param>
public record IndustryListInDto(string? Name, string? ApproveOrgName) : PagedRequest;

/// <summary>
/// 行业线索集合入参
/// </summary>
/// <param name="CaseName">线索名称</param>
/// <param name="IndustryName">行业名称</param>
public record IndustryCaseItemInDto(string? CaseName, string? IndustryName) : PagedRequest;


public class SystemWebPageInDto
{
    /// <summary>
    /// 页面类型;
    /// 1: 正常;
    /// 2: 关怀;
    /// </summary>
    [Required]
    public EPageType PageType { get; set; }

    /// <summary>
    /// 页面名称
    /// </summary>
    [Required]
    public string Name { get; set; }
}
public class IndustryBaseOutDto
{
    /// <summary>
    /// 行业信息
    /// </summary>
    public IndustryOutDto Industry { get; set; }

    /// <summary>
    /// 通知公告Id
    /// </summary>
    public string? BulletinId { get; set; }

    /// <summary>
    /// 作业区域集合
    /// </summary>
    public IList<SystemAreaOutDto> AreaTree { get; set; } = [];

    /// <summary>
    /// 附件集合
    /// </summary>
    public IList<IndustryFileDto> Files { get; set; } = [];

    /// <summary>
    /// 作业场所集合
    /// </summary>
    public IReadOnlyList<SystemDicDataOutDto> Workplace { get; set; }

    /// <summary>
    /// 场所名称集合
    /// </summary>
    public IReadOnlyList<SystemDicDataOutDto> WorkplaceName { get; set; }

    /// <summary>
    /// 作业类型集合
    /// </summary>
    public IReadOnlyList<SystemDicDataOutDto> JobType { get; set; }

    /// <summary>
    /// 经营单位类别集合
    /// </summary>
    public IReadOnlyList<SystemDicDataOutDto> BusinessUnitType { get; set; }
}

public class UpdateIndustryInDto : AddIndustryDto
{
    /// <summary>
    /// Id
    /// </summary>
    [Required]
    public string Id { get; set; }
}

public class AddIndustryDto
{
    /// <summary>
    /// 行业名称
    /// </summary>
    [Required]
    public string Name { get; set; }

    /// <summary>
    /// 标题追加信息
    /// </summary>
    public string TitleSuffix { get; set; } = string.Empty;

    /// <summary>
    /// 审批部门Id
    /// </summary>
    public string? ApproveOrgId { get; set; }

    /// <summary>
    /// 审批部门名字
    /// </summary>
    public string? ApproveOrgName { get; set; }

    /// <summary>
    /// 受理类型
    /// </summary>
    public string AcceptType { get; set; } = string.Empty;

    /// <summary>
    /// 受理类型代码
    /// </summary>
    public string? AcceptTypeCode { get; set; }

    /// <summary>
    /// 市民发放红包金额(单位:元)
    /// </summary>
    [Required]
    public int CitizenReadPackAmount { get; set; }

    /// <summary>
    /// 网络员发放红包金额(单位:元)
    /// </summary>
    [Required]
    public int GuiderReadPackAmount { get; set; }

    /// <summary>
    /// 是否启用
    /// </summary>
    public bool IsEnable { get; set; }

    /// <summary>
    /// App是否启用
    /// </summary>
    public bool IsAppEnable { get; set; }

    /// <summary>
    /// 帮助引导用语
    /// </summary>
    public string? TxtHelpRemarks { get; set; }

    /// <summary>
    /// 宫格说明文本
    /// </summary>
    public string TxtRemarks { get; set; } = string.Empty;

    /// <summary>
    /// 关怀说明
    /// </summary>
    public string TxtCareRemarks { get; set; }

    /// <summary>
    /// 排序
    /// </summary>
    public int DisplayOrder { get; set; } = 0;

    /// <summary>
    /// 阶段性回复间隔时间(小时)
    /// </summary>
    public int IntervalTime { get; set; } = 0;

    /// <summary>
    /// 页面Url
    /// </summary>
    public string PageUrl { get; set; }

    /// <summary>
    /// 关怀页面Url
    /// </summary>
    public string PageCareUrl { get; set; }

    /// <summary>
    /// 关联宣传学习
    /// 从字典中取"公告类型"
    /// </summary>
    public string BulletinTypePublicityId { get; set; }

    /// <summary>
    /// 关联宣传学习
    /// 从字典中取"公告类型"
    /// </summary>
    public string BulletinTypePublicityName { get; set; }

    /// <summary>
    /// 关联操作指引
    /// 从字典中取"公告类型"
    /// </summary>
    public string BulletinTypeGuideId { get; set; }

    /// <summary>
    /// 关联操作指引
    /// 从字典中取"公告类型"
    /// </summary>
    public string BulletinTypeGuideName { get; set; }

    /// <summary>
    /// 背景图片 url
    /// </summary>
    public string BackgroundImgUrl { get; set; }

    /// <summary>
    /// Banner 图片 url
    /// </summary>
    public string BannerImgUrl { get; set; }

    /// <summary>
    /// 宫格图
    /// </summary>
    public string CellImgUrl { get; set; }

    /// <summary>
    /// 关怀宫格图
    /// </summary>
    public string CareCellImgUrl { get; set; }

    /// <summary>
    /// 附件集合(小程序上面可以下载的 doc 文件)
    /// </summary>
    public IList<IndustryFileDto> Files { get; set; }

    /// <summary>
    /// 上报积分
    /// </summary>
    public int? ReportPoints { get; set; }

    /// <summary>
    /// 审核同意积分
    /// </summary>
    public int? ArgeePoints { get; set; }

    /// <summary>
    /// 审核不同意扣除积分
    /// </summary>
    public int? RefusePoints { get; set; }

    /// <summary>
    /// 额外扣除积分
    /// </summary>
    public int? ExtraDeductedPoints { get; set; }

    /// <summary>
    /// 是否开启积分
    /// </summary>
    public bool? IsPoints { get; set; }

}

public class IndustryCaseItemOutDto : AddIndustryCaseDto
{
    /// <summary>
    /// Id
    /// </summary>
    public string Id { get; set; }

    /// <summary>
    /// 行业名称
    /// </summary>
    public string IndustryName { get; set; }

    /// <summary>
    /// 市民发放红包金额(单位:元)
    /// </summary>
    public string CitizenReadPackAmountTxt => CitizenReadPackAmount.ToYuanFinance();

    /// <summary>
    /// 网络员发放红包金额(单位:元)
    /// </summary>
    public string GuiderReadPackAmountTxt => GuiderReadPackAmount.ToYuanFinance();

    /// <summary>
    /// 是否启用
    /// </summary>
    public string IsEnableTxt => IsEnable ? "启用" : "禁用";
}

public class UpdateIndustryCaseDto : AddIndustryCaseDto
{
    /// <summary>
    /// Id
    /// </summary>
    [Required]
    public string Id { get; set; }
}

public class AddIndustryCaseDto
{
    /// <summary>
    /// 行业Id
    /// </summary>
    [Required]
    public string IndustryId { get; set; }

    /// <summary>
    /// 线索名称
    /// </summary>
    [Required]
    public string Name { get; set; }

    /// <summary>
    /// 市民发放红包金额(单位:元)
    /// </summary>
    public double CitizenReadPackAmount { get; set; }

    /// <summary>
    /// 网络员发放红包金额(单位:元)
    /// </summary>
    public double GuiderReadPackAmount { get; set; }

    /// <summary>
    /// 是否启用
    /// </summary>
    public bool IsEnable { get; set; }

    /// <summary>
    /// 排序
    /// </summary>
    public int DisplayOrder { get; set; }
}

/// <summary>
/// 行业短信模板集合入参
/// </summary>
/// <param name="IndustryName">行业名称</param>
public record SnapshotSMSTemplateItemsInDto(string? IndustryName) : PagedRequest;

public class SnapshotSMSTemplateItemsOutDto : AddSnapshotSMSTemplateInDto
{
    /// <summary>
    /// Id
    /// </summary>
    public string Id { get; set; }

    /// <summary>
    /// 审核状态
    /// </summary>
    public string StatusTxt => Status.GetDescription();

    /// <summary>
    /// 行业名称
    /// </summary>
    public string IndustryName { get; set; }

    /// <summary>
    /// 是否启用
    /// </summary>
    public string IsEnableTxt => IsEnable ? "启用" : "禁用";

    /// <summary>
    /// 是否公用
    /// </summary>
    public string IsPublicTxt => IsPublic ? "是" : "否";

}

public class UpdateSnapshotSMSTemplateInDto : AddSnapshotSMSTemplateInDto
{
    /// <summary>
    /// Id
    /// </summary>
    public string Id { get; set; }
}
public class AddSnapshotSMSTemplateInDto
{
    /// <summary>
    /// 行业Id
    /// </summary>
    [Required]
    public string IndustryId { get; set; }

    /// <summary>
    /// 模板内容
    /// </summary>
    [Required]
    public string Content { get; set; }

    /// <summary>
    /// 审核状态
    /// </summary>
    public ESnapshotSMSStatus Status { get; set; }

    /// <summary>
    /// 是否启用
    /// </summary>
    public bool IsEnable { get; set; }

    /// <summary>
    /// 是否公用
    /// </summary>
    public bool IsPublic { get; set; }

    /// <summary>
    /// 排序
    /// </summary>
    public int DisplayOrder { get; set; }
}

/// <summary>
/// 区域从业人员集合入参
/// </summary>
/// <param name="Name">姓名</param>
/// <param name="PhoneNumber">联系方式</param>
/// <param name="SystemAreaName">区县</param>
public record PractitionerItemsInDto(string? Name, string? PhoneNumber, string? SystemAreaName) : PagedRequest;

public class PractitionerItemsOutDto
{
    /// <summary>
    /// Id
    /// </summary>
    public string Id { get; set; }

    /// <summary>
    /// 名字
    /// </summary>
    public string Name { get; set; }

    /// <summary>
    /// 区域Id
    /// </summary>
    public string SystemAreaId { get; set; }

    /// <summary>
    /// 区域名称
    /// </summary>
    public string SystemAreaName { get; set; }

    /// <summary>
    /// 详细街道
    /// </summary>
    public string Street { get; set; }

    /// <summary>
    /// 电话
    /// </summary>
    public string PhoneNumber { get; set; }

    /// <summary>
    /// 性别
    /// </summary>
    public EGender Gender { get; set; }

    /// <summary>
    /// 性别
    /// </summary>
    public string GenderTxt => Gender.GetDescription();
}

/// <summary>
/// 修改行业记录入参
/// </summary>
/// <param name="No">编号</param>
/// <param name="ChangeName">修改人</param>
/// <param name="oldIndustryName">旧行业名称</param>
/// <param name="IndustryName">新行业名称</param>
/// <param name="BeginTime">开始时间</param>
/// <param name="EndTime">结束时间</param>
public record IndustryLogItemsInDto(string? No, string? ChangeName, string? oldIndustryName, string? IndustryName
    , DateTime? BeginTime, DateTime? EndTime) : PagedRequest;


public class IndustryLogItemsOutDto
{
    /// <summary>
    /// OrderId
    /// </summary>
    public string OrderId { get; set; }

    /// <summary>
    /// 行业名称
    /// </summary>
    public string OldIndustryName { get; set; }

    /// <summary>
    /// 行业名称
    /// </summary>
    public string IndustryName { get; set; }

    /// <summary>
    /// 编号
    /// </summary>
    public string No { get; set; }

    /// <summary>
    /// 标题
    /// </summary>
    public string Title { get; set; }

    /// <summary>
    /// 时间
    /// </summary>
    public DateTime CreationTime { get; set; }

    /// <summary>
    /// 修改人
    /// </summary>
    public string CreatorName { get; set; }
}
