using Hotline.Share.Dtos.Users;
using Hotline.Share.Enums.Article;
using Hotline.Share.Enums.Snapshot;
using Hotline.Share.Requests;
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;

class SnapshotBulletinDto
{
}

/// <summary>
/// 入参
/// </summary>
/// <param name="SnapshotBulletinTypeName">类别名称</param>
/// <param name="Title">标题</param>
/// <param name="No">文档编号</param>
/// <param name="DepartmentName">部门</param>
/// <param name="CreatorName">发布人</param>
/// <param name="BeginCreationTime">发布开始时间</param>
/// <param name="EndCreationTime">发布结束时间</param>
/// <param name="State">状态</param>
public record SnapshotBulletinItemsInDto(string? SnapshotBulletinTypeName, string? Title,
    string? No,
    string? DepartmentName,
    string? CreatorName,
    DateTime? BeginCreationTime,
    DateTime? EndCreationTime,
    EBulletinState? State
    ) : PagedRequest;

public class SnapshotBulletinItemsOutDto
{
    public string Id { get; set; }

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

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

    /// <summary>
    /// 字典中添加类型Id
    /// </summary>
    public string SnapshotBulletinTypeId { get; set; }

    /// <summary>
    /// 系统字典中添加类型名称
    /// </summary>
    public string SnapshotBulletinTypeName { get; set; }

    /// <summary>
    /// 阅读量
    /// </summary>
    public int ReadedNum { get; set; }

    /// <summary>
    /// 发布时间
    /// </summary>
    public DateTime? BulletinTime { get; set; }

    /// <summary>
    /// 公告状态
    /// </summary>
    public EBulletinState BulletinState { get; set; }

    public string BulletinStateText => BulletinState.GetDescription();

    /// <summary>
    /// 所属部门ID
    /// </summary>
    public string SourceOrgId { get; set; }

    /// <summary>
    /// 所属部门
    /// </summary>
    public string SourceOrgName { get; set; }

    /// <summary>
    /// 发布人
    /// </summary>
    public string? CreatorId { get; set; }

    /// <summary>
    /// 发布人名
    /// </summary>
    public string? CreatorName { get; set; }

    /// <summary>
    /// 部门名称
    /// </summary>
    public string? DepartmentName { get; set; }

    /// <summary>
    /// 是否公开
    /// </summary>
    public bool? IsOpen { get; set; }

    /// <summary>
    /// 是否加粗
    /// </summary>
    public bool? IsBold { get; set; }

    /// <summary>
    /// 网站公开
    /// </summary>
    public bool? IsOpenWebsite { get; set; }

    /// <summary>
    /// 微博公开
    /// </summary>
    public bool? IsWeibo { get; set; }

    /// <summary>
    /// 微信公开
    /// </summary>
    public bool? IsWeChat { get; set; }

    /// <summary>
    /// 上下架
    /// </summary>
    public bool IsArrive { get; set; }
}

public class SnapshotBulletinDetailOutDto : UpdateSnapshotBulletinInDto
{
    /// <summary>
    /// 创建时间
    /// </summary>
    public DateTime CreationTime { get; set; }

    /// <summary>
    /// 创建人
    /// </summary>
    public string CreatorName { get; set; }

    /// <summary>
    /// 阅读次数
    /// </summary>
    public int ReadedNum { get; set; }

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

    /// <summary>
    /// 审核状态
    /// </summary>
    public EBulletinState BulletinState { get; set; }

    /// <summary>
    /// 上下架
    /// </summary>
    public bool IsArrive { get; set; }

    /// <summary>
    /// 类型
    /// </summary>
    public IList<string> SafetyTypeNames { get; set; }
}

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

public class AddSnapshotBulletinInDto
{
    /// <summary>
    /// 标题
    /// </summary>
    [Required]
    public string Title { get; set; }

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

    /// <summary>
    /// 公告类型
    /// </summary>
    [Required]
    public string BulletinTypeId { get; set; }

    /// <summary>
    /// 公告类型名称
    /// </summary>
    [Required]
    public string BulletinTypeName { get; set; }

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

    /// <summary>
    /// 所属部门
    /// </summary>
    public string? DepartmentName { get; set; }

    /// <summary>
    /// 所属部门Id
    /// </summary>
    public string? DepartmentId { get; set; }

    /// <summary>
    /// 来源部门名称
    /// </summary>
    public string? SourceOrgName { get; set; }

    /// <summary>
    /// 是否公开
    /// </summary>
    public bool? IsOpen { get; set; }

    /// <summary>
    /// 是否加粗
    /// </summary>
    public bool? IsBold { get; set; }

    /// <summary>
    /// 网站公开
    /// </summary>
    public bool? IsOpenWebsite { get; set; }

    /// <summary>
    /// 微博公开
    /// </summary>
    public bool? IsWeibo { get; set; }

    /// <summary>
    /// 微信公开
    /// </summary>
    public bool? IsWeChat { get; set; }

    /// <summary>
    /// 是否置顶
    /// </summary>
    public bool? IsTop { get; set; }

    /// <summary>
    /// 是否飘窗
    /// </summary>
    public bool IsPopup { get; set; }

    /// <summary>
    /// 公告形式
    /// 0: 消息
    /// 1: 视频
    /// </summary>
    public EBulletinShape? Shape { get; set; }

    /// <summary>
    /// 志愿者类型Id
    /// </summary>
    public IList<string>? SafetyTypeId { get; set; }

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

    /// <summary>
    /// 来源方式
    /// </summary>
    public string SourceMode { get; set; }

    /// <summary>
    /// 视频地址
    /// </summary>
    public string? VideoPath { get; set; }

    /// <summary>
    /// 视频名称
    /// </summary>
    public string? VideoName { get; set; }

    /// <summary>
    /// 视频封面
    /// </summary>
    public string? VideoCoverImgUrl { get; set; }
}
