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

namespace QYZH.InteractiveMagazine.IService;

/// <summary>
/// 用户期刊关联服务接口
/// </summary>
public interface IUserJournalService : IBaseService<UserJournal>
{
    /// <summary>
    /// 用户绑定期刊（扫码绑定）
    /// </summary>
    /// <param name="userId">当前用户Id</param>
    /// <param name="input">绑定输入</param>
    /// <returns>绑定结果</returns>
    Task<BindJournalOutput> BindJournalAsync(long userId, BindJournalInput input);

    /// <summary>
    /// 获取用户的期刊绑定列表
    /// </summary>
    /// <param name="userId">用户Id</param>
    /// <param name="input">查询条件</param>
    /// <returns>分页结果</returns>
    Task<PageListModel<BindJournalOutput>> GetUserJournalsAsync(long userId, UserJournalQueryInput input);

    /// <summary>
    /// 取消期刊绑定
    /// </summary>
    /// <param name="userId">用户Id</param>
    /// <param name="id">绑定记录Id</param>
    Task UnbindJournalAsync(long userId, long id);

    /// <summary>
    /// 批量提交期刊二维码生成任务
    /// </summary>
    /// <param name="input">生成输入</param>
    /// <param name="operatorName">操作人名称</param>
    /// <returns>提交结果</returns>
    Task<CreateUserJournalQrCodeOutput> CreateQrCodesAsync(CreateUserJournalQrCodeInput input, string operatorName);

    /// <summary>
    /// 分页查询期刊二维码记录
    /// </summary>
    /// <param name="input">查询条件</param>
    /// <returns>分页结果</returns>
    Task<PageListModel<UserJournalQrCodeOutput>> GetQrCodePageListAsync(UserJournalQrCodeQueryInput input);

    /// <summary>
    /// 获取期刊二维码详情
    /// </summary>
    /// <param name="id">二维码记录Id</param>
    /// <returns>二维码记录</returns>
    Task<UserJournalQrCodeOutput> GetQrCodeDetailAsync(long id);

    /// <summary>
    /// 根据期刊Id获取未绑定用户的二维码列表
    /// </summary>
    /// <param name="journalId">期刊Id</param>
    /// <returns>未绑定二维码列表</returns>
    Task<List<UserJournalQrCodeOutput>> GetUnboundQrCodesByJournalIdAsync(long journalId);

    /// <summary>
    /// 删除未绑定的期刊二维码记录
    /// </summary>
    /// <param name="input">删除输入</param>
    /// <param name="operatorName">操作人名称</param>
    /// <returns>是否成功</returns>
    Task<bool> DeleteQrCodeAsync(DeleteUserJournalQrCodeInput input, string operatorName);
}
