namespace QYZH.InteractiveMagazine.Models.Dto;

#region 后台管理 DTO

/// <summary>
/// 社区消息分页查询输入（后台）
/// </summary>
public class AdminMessageQueryInput : PageQueryModel
{
    /// <summary>
    /// 期刊ID
    /// </summary>
    public long? JournalId { get; set; }

    /// <summary>
    /// 消息类型: Article, Quote, Announcement
    /// </summary>
    public string? Type { get; set; }

    /// <summary>
    /// 状态: 0=审核中, 1=已通过, 2=已冻结
    /// </summary>
    public int? Status { get; set; }

    /// <summary>
    /// 是否精选: 0=否, 1=是
    /// </summary>
    public int? IsFeatured { get; set; }

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


    /// <summary>
    /// 用户ID
    /// </summary>
    public long? UserId { get; set; }
}

/// <summary>
/// 社区消息详情输出（后台）
/// </summary>
public class AdminMessageDetailOutput
{
    /// <summary>
    /// 主键ID
    /// </summary>
    public long Id { get; set; }

    /// <summary>
    /// 期刊ID
    /// </summary>
    public long JournalId { get; set; }

    /// <summary>
    /// 用户ID
    /// </summary>
    public long UserId { get; set; }

    /// <summary>
    /// 用户实例期刊ID
    /// </summary>
    public long UserJournalId { get; set; }

    /// <summary>
    /// 期刊任务ID
    /// </summary>
    public long JournalTaskId { get; set; }

    /// <summary>
    /// 用户期刊任务回答ID
    /// </summary>
    public long JournalTaskAnswerId { get; set; }

    /// <summary>
    /// 消息内容
    /// </summary>
    public string Content { get; set; } = string.Empty;

    /// <summary>
    /// 配图
    /// </summary>
    public string? ImageUrl { get; set; }

    /// <summary>
    /// 排序权重
    /// </summary>
    public int SortOrder { get; set; }

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

    /// <summary>
    /// 消息类型
    /// </summary>
    public string Type { get; set; } = string.Empty;

    /// <summary>
    /// 点赞数
    /// </summary>
    public int LikeCount { get; set; }

    /// <summary>
    /// 是否精选
    /// </summary>
    public int IsFeatured { get; set; }

    /// <summary>
    /// 状态: 0=审核中, 1=已通过, 2=已冻结
    /// </summary>
    public int Status { get; set; }

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

    /// <summary>
    /// 创建时间
    /// </summary>
    public DateTime CreatedAt { get; set; }

    /// <summary>
    /// 更新人
    /// </summary>
    public string? UpdatedBy { get; set; }

    /// <summary>
    /// 更新时间
    /// </summary>
    public DateTime? UpdatedAt { get; set; }
}

/// <summary>
/// 设置精选入参
/// </summary>
public class AdminSetFeaturedInput
{
    /// <summary>
    /// 是否精选: 0=否, 1=是
    /// </summary>
    public int IsFeatured { get; set; }
}

/// <summary>
/// 设置排序权重入参
/// </summary>
public class AdminSetSortOrderInput
{
    /// <summary>
    /// 排序权重
    /// </summary>
    public int SortOrder { get; set; }
}

/// <summary>
/// 冻结/解冻入参
/// </summary>
public class AdminFreezeInput
{
    /// <summary>
    /// 状态: 1=解冻(通过), 2=冻结
    /// </summary>
    public int Status { get; set; }
}

/// <summary>
/// 批量发布消息入参
/// </summary>
public class AdminBatchPublishInput
{
    /// <summary>
    /// 消息ID列表
    /// </summary>
    public List<long> Ids { get; set; } = new();
}

#endregion

#region 微信端 DTO

/// <summary>
/// 微信端社区Feed消息输出
/// </summary>
public class WxFeedMessageOutput
{
    /// <summary>
    /// 消息ID
    /// </summary>
    public long Id { get; set; }

    /// <summary>
    /// 期刊ID
    /// </summary>
    public long JournalId { get; set; }

    /// <summary>
    /// 作者用户ID
    /// </summary>
    public long UserId { get; set; }

    /// <summary>
    /// 消息内容
    /// </summary>
    public string Content { get; set; } = string.Empty;

    /// <summary>
    /// 配图
    /// </summary>
    public string? ImageUrl { get; set; }

    /// <summary>
    /// 消息类型
    /// </summary>
    public string Type { get; set; } = string.Empty;

    /// <summary>
    /// 点赞数
    /// </summary>
    public int LikeCount { get; set; }

    /// <summary>
    /// 是否精选
    /// </summary>
    public int IsFeatured { get; set; }

    /// <summary>
    /// 当前用户是否已点赞
    /// </summary>
    public bool IsLiked { get; set; }

    /// <summary>
    /// 创建时间
    /// </summary>
    public DateTime CreatedAt { get; set; }
}

/// <summary>
/// 微信端社区Feed输出（含游标）
/// </summary>
public class WxFeedOutput
{
    /// <summary>
    /// 消息列表
    /// </summary>
    public List<WxFeedMessageOutput> Messages { get; set; } = new();

    /// <summary>
    /// 下一页游标（为null表示没有更多数据）
    /// </summary>
    public long? NextCursor { get; set; }

    /// <summary>
    /// 是否还有更多数据
    /// </summary>
    public bool HasMore { get; set; }
}

/// <summary>
/// 微信端点赞入参
/// </summary>
public class WxLikeInput
{
    /// <summary>
    /// 消息ID
    /// </summary>
    public long MessageId { get; set; }
}

/// <summary>
/// 微信端点赞输出
/// </summary>
public class WxLikeOutput
{
    /// <summary>
    /// 消息ID
    /// </summary>
    public long MessageId { get; set; }

    /// <summary>
    /// 当前点赞数
    /// </summary>
    public int LikeCount { get; set; }

    /// <summary>
    /// 是否已点赞
    /// </summary>
    public bool IsLiked { get; set; }
}

#endregion
