package com.ytpm.dao;

import com.ytpm.agent.model.YtPlatformBanned;
import com.ytpm.agent.model.YtPlatformDeblocking;
import com.ytpm.risk.param.RiskBannedListParam;
import com.ytpm.risk.param.RiskDeblockingListParam;
import com.ytpm.risk.param.RiskRelativeAppParam;
import com.ytpm.risk.view.RiskBannedListView;
import com.ytpm.risk.view.RiskDeblockingListView;
import org.apache.ibatis.annotations.Param;
import org.mapstruct.Mapper;

import java.util.Date;
import java.util.List;

@Mapper
public interface RiskManageMapper {
    /**
     * 查询封禁用户列表
     */
    List<RiskBannedListView> getBannedList(RiskBannedListParam param);
    /**
     * 查询解封记录
     */
    List<RiskDeblockingListView> getDeblockingList(RiskDeblockingListParam param);

    /**
     * 查询封禁时间之后的解禁记录
     */
    List<RiskDeblockingListView> getDeblockByBanned(@Param("bannedId")String bannedId,@Param("userId")String userId
            ,@Param("bannedTime")Date bannedTime);

    /**
     * 查询用户最新的封禁记录
     */
    YtPlatformBanned getLastBanned(@Param("userId") String userId);

    YtPlatformBanned getLastBannedByApp(@Param("userId") String userId,@Param("appId")String appId);

    /**
     * 增加风控解禁记录
     */
    void addDeblockingRecord(YtPlatformDeblocking deblocking);

    /**
     * 风控配置关联应用
     */
    void relativeApps(RiskRelativeAppParam param);

    /**
     * 清除旧配置关联数据
     */
    void deleteRelatives(@Param("templateId") String templateId);

    List<YtPlatformBanned> queryBannedRecord(@Param("startTime") Date startTime, @Param("endTime") Date endTime,@Param("appIdList")List<String> appList);

    List<YtPlatformBanned> queryBannedRecordGroupByUserId(@Param("startTime") Date startTime, @Param("endTime") Date endTime,@Param("appIdList")List<String> appList);

    /**
     * 根据用户查询当天解封记录
     */
    List<RiskDeblockingListView> queryTodayDeblock(@Param("userId") String userId);
}
