package com.fuint.common.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.fuint.common.dto.TaskDto;
import com.fuint.common.param.TaskPage;
import com.fuint.common.param.TaskRecordPage;
import com.fuint.framework.exception.BusinessCheckException;
import com.fuint.framework.pagination.PaginationResponse;
import com.fuint.repository.model.MtTask;

import java.util.List;
import java.util.Map;

/**
 * 任务中心业务接口
 *
 * Created by Codex
 */
public interface TaskService extends IService<MtTask> {

    /**
     * 分页查询列表
     */
    PaginationResponse<MtTask> queryTaskListByPagination(TaskPage taskPage) throws BusinessCheckException;

    /**
     * 分页查询任务完成记录
     */
    PaginationResponse<Map<String, Object>> queryTaskRecordListByPagination(TaskRecordPage taskRecordPage) throws BusinessCheckException;

    /**
     * 添加任务
     */
    MtTask addTask(TaskDto taskDto) throws BusinessCheckException;

    /**
     * 根据ID获取任务信息
     */
    MtTask queryTaskById(Integer id) throws BusinessCheckException;

    /**
     * 更新任务
     */
    MtTask updateTask(TaskDto taskDto) throws BusinessCheckException;

    /**
     * 根据条件查询任务列表
     */
    List<MtTask> queryTaskListByParams(Map<String, Object> params) throws BusinessCheckException;

    /**
     * 会员端任务列表（含完成/领取进度）
     */
    List<Map<String, Object>> queryClientTaskList(Integer merchantId, Integer storeId, Integer userId) throws BusinessCheckException;

    /**
     * 完成任务
     */
    Map<String, Object> completeTask(Integer merchantId, Integer storeId, Integer userId, Integer taskId, String operator) throws BusinessCheckException;

    /**
     * 领取任务奖励
     */
    Map<String, Object> claimTask(Integer merchantId, Integer storeId, Integer userId, Integer taskId, String operator) throws BusinessCheckException;

    /**
     * 导入公共任务（merchantId=0, storeId=0）到指定商户/店铺
     */
    Map<String, Object> importPublicTask(Integer merchantId, Integer storeId, List<Integer> taskIds, String operator) throws BusinessCheckException;
}
