using QYZH.InteractiveMagazine.Models.Dto;
using QYZH.InteractiveMagazine.Models.Entity;

namespace QYZH.InteractiveMagazine.IService;

/// <summary>
/// 勋章服务接口
/// </summary>
public interface IMedalService : IBaseService<Medal>
{
    /// <summary>
    /// 创建勋章
    /// </summary>
    /// <param name="input">勋章输入</param>
    /// <returns>创建的勋章信息</returns>
    Task<MedalOutput> CreateAsync(MedalInput input);

    /// <summary>
    /// 更新勋章
    /// </summary>
    /// <param name="id">勋章ID</param>
    /// <param name="input">勋章输入</param>
    /// <returns>更新后的勋章信息</returns>
    Task<MedalOutput> UpdateAsync(long id, MedalInput input);

    /// <summary>
    /// 删除勋章（软删除）
    /// </summary>
    /// <param name="id">勋章ID</param>
    Task DeleteAsync(long id);

    /// <summary>
    /// 根据ID获取勋章
    /// </summary>
    /// <param name="id">勋章ID</param>
    /// <returns>勋章信息</returns>
    Task<MedalOutput> GetByIdAsync(long id);

    /// <summary>
    /// 分页查询勋章列表
    /// </summary>
    /// <param name="input">查询条件</param>
    /// <returns>分页结果</returns>
    Task<PageListModel<MedalOutput>> GetListAsync(MedalQueryInput input);

    /// <summary>
    /// 更新勋章启用/禁用状态
    /// </summary>
    /// <param name="id">勋章ID</param>
    /// <param name="status">状态: 0=禁用, 1=启用</param>
    Task<bool> UpdateStatusAsync(long id);

    /// <summary>
    /// 获取勋章的规则列表
    /// </summary>
    /// <param name="medalId">勋章ID</param>
    /// <returns>规则列表</returns>
    Task<List<MedalRuleOutput>> GetRulesByMedalIdAsync(long medalId);

    /// <summary>
    /// 获取所有启用勋章列表（含当前用户拥有状态）
    /// </summary>
    /// <param name="userId">当前用户ID</param>
    /// <returns>勋章列表</returns>
    Task<List<WxMedalListOutput>> GetAllMedalsAsync(long userId);

    /// <summary>
    /// 获取用户已拥有的勋章列表
    /// </summary>
    /// <param name="userId">用户ID</param>
    /// <returns>用户勋章列表</returns>
    Task<List<WxUserMedalOutput>> GetUserMedalsAsync(long userId);

    /// <summary>
    /// 激活/获得勋章
    /// </summary>
    /// <param name="userId">用户ID</param>
    /// <param name="input">激活输入</param>
    Task ActivateMedalAsync(long userId, WxMedalActivateInput input);

    /// <summary>
    /// 获取规则配置中可用的目标表列表
    /// </summary>
    Task<List<MedalRuleTableOptionOutput>> GetAvailableTablesAsync();

    /// <summary>
    /// 获取指定表的可用字段列表
    /// </summary>
    /// <param name="tableName">表名</param>
    Task<List<MedalRuleFieldOptionOutput>> GetTableFieldsAsync(string tableName);
}
