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

namespace Hotline.Snapshot;
/// <summary>
/// 随手拍公告
/// </summary>
[Description("随手拍公告")]
public class SnapshotBulletin : CreationEntity
{
    /// <summary>
    /// 标题
    /// </summary>
    [SugarColumn(ColumnDescription = "标题")]
    public string Title { get; set; }

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

    /// <summary>
    /// 所属部门
    /// </summary>
    [SugarColumn(ColumnDescription = "所属部门")]
    public string? DepartmentName { get; set; }

    /// <summary>
    /// 所属部门Id
    /// </summary>
    [SugarColumn(ColumnDescription = "所属部门Id")]
    public string? DepartmentId { get; set; }

    /// <summary>
    /// 来源部门名称
    /// </summary>
    [SugarColumn(ColumnDescription = "来源部门名称")]
    public string? SourceOrgName { get; set; }

    /// <summary>
    /// 内容
    /// </summary>
    [SugarColumn(ColumnDataType = "text")]
    public string Content { get; set; }

    /// <summary>
    /// 字典中添加类型Id
    /// </summary>
    [SugarColumn(ColumnDescription = "字典中添加类型Id")]
    public string SnapshotBulletinTypeId { get; set; }

    /// <summary>
    /// 系统字典中添加类型名称
    /// </summary>
    [SugarColumn(ColumnDescription = "系统字典中添加类型名称")]
    public string SnapshotBulletinTypeName { get; set; }

    /// <summary>
    /// 阅读量
    /// </summary>
    [SugarColumn(ColumnDescription = "阅读量")]
    public int ReadedNum { get; set; }

    /// <summary>
    /// 公告状态
    /// </summary>
    [SugarColumn(ColumnDescription = "公告状态")]
    public EBulletinState BulletinState { get; set; }

    /// <summary>
    /// 提交时间
    /// </summary>
    [SugarColumn(ColumnDescription = "提交时间")]
    public DateTime? CommitTime { get; set; }

    /// <summary>
    /// 审核意见
    /// </summary>
    [SugarColumn(ColumnDescription = "审核意见")]
    public string? ExaminOpinion { get; set; }

    /// <summary>
    /// 审核人
    /// </summary>
    [SugarColumn(ColumnDescription = "审核人")]
    public string? ExaminManId { get; set; }

    /// <summary>
    /// 审核人
    /// </summary>
    [Navigate(NavigateType.OneToOne, nameof(ExaminManId))]
    public User? ExaminMan { get; set; }

    /// <summary>
    /// 审核时间
    /// </summary>
    [SugarColumn(ColumnDescription = "审核时间")]
    public DateTime? ExaminTime { get; set; }

    /// <summary>
    /// 是否公开
    /// </summary>
    [SugarColumn(ColumnDescription = "是否公开")]
    public bool? IsOpen { get; set; }

    /// <summary>
    /// 是否加粗
    /// </summary>
    [SugarColumn(ColumnDescription = "是否加粗")]
    public bool? IsBold { get; set; }

    /// <summary>
    /// 网站公开
    /// </summary>
    [SugarColumn(ColumnDescription = "网站公开")]
    public bool? IsOpenWebsite { get; set; }

    /// <summary>
    /// 微博公开
    /// </summary>
    [SugarColumn(ColumnDescription = "微博公开")]
    public bool? IsWeibo { get; set; }

    /// <summary>
    /// 微信公开
    /// </summary>
    [SugarColumn(ColumnDescription = "微信公开")]
    public bool? IsWeChat { get; set; }

    /// <summary>
    /// 是否置顶
    /// </summary>
    [SugarColumn(ColumnDescription = "是否置顶")]
    public bool? IsTop { get; set; }

    /// <summary>
    /// 是否弹窗
    /// </summary>
    [SugarColumn(DefaultValue = "f", ColumnDescription = "是否弹窗")]
    public bool IsPopup { get; set; }

    /// <summary>
    /// 通知时间
    /// </summary>
    [SugarColumn(ColumnDescription = "通知时间")]
    public DateTime? BulletinTime { get; set; }

    /// <summary>
    /// 视频地址
    /// </summary>
    [SugarColumn(ColumnDescription = "视频地址")]
    public string? VideoPath { get; set; }

    /// <summary>
    /// 来源方式
    /// </summary>
    [SugarColumn(ColumnDescription = "来源方式")]
    public string? SourceMode { get; set; }

    /// <summary>
    /// 上下架
    /// </summary>
    [SugarColumn(ColumnDescription = "上下架")]
    public bool? IsArrive { get; set; }

    /// <summary>
    /// 阅读量+1
    /// </summary>
    public void Read()
    {
        ReadedNum++;
    }

    /// <summary>
    /// 公告形式
    /// </summary>
    [SugarColumn(ColumnDescription = "公告形式")]
    public EBulletinShape? Shape { get; set; }

    /// <summary>
    /// 志愿者类型Id
    /// </summary>
    [SugarColumn(ColumnDescription = "志愿者类型Id", ColumnDataType = "json", IsJson = true)]
    public List<string>? SafetyTypeId { get; set; }

    /// <summary>
    /// 视频封面
    /// </summary>
    [SugarColumn(ColumnDescription = "视频封面")]
    public string? VideoCoverImgUrl { get; set; }

    /// <summary>
    /// 视频名称
    /// </summary>
    [SugarColumn(ColumnDescription = "视频封面")]
    public string? VideoName { get; set; }
}

