package cn.com.ctop.kuaishou.modules.clean.controller;

import cn.com.ctop.kuaishou.modules.clean.entity.KuaiShouAccountCleanTemplateInfo;
import cn.com.ctop.kuaishou.modules.clean.service.KuaiShouAccountCleanService;
import org.apache.ibatis.annotations.Param;
import org.jeecg.common.api.vo.Result;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @Description: 快手-账户清理
 * @Author: zzy
 * @Date: 2021-07-20
 * @Version: V1.0
 */
@RestController
@RequestMapping("/accountClean")
public class KuaiShouAccountCleanController {

    @Resource
    KuaiShouAccountCleanService kuaiShouAccountCleanService;

    /**
     * 创建规则模板
     *
     * @param kuaiShouAccountCleanTemplateInfo
     * @return
     */
    @PostMapping("/createTemplate")
    public Result createCleanTemplate(@RequestBody KuaiShouAccountCleanTemplateInfo kuaiShouAccountCleanTemplateInfo){
        return   kuaiShouAccountCleanService.createCleanTemplate(kuaiShouAccountCleanTemplateInfo);
    }

    /**
     * 查询模板列表
     *
     * @param templateId 模板id  createUser创建人  userId当前登录人id
     * @return
     */
    @GetMapping("/getTemplateList")
    public Result getTemplateList(@Param("templateId")String templateId,@Param("createUser")String createUser,@Param("userId")String userId,
                                  @Param("pageNum")String pageNum,@Param("pageSize")String pageSize  ){
        return   kuaiShouAccountCleanService.getTemplateList(templateId,createUser,userId,pageNum,pageSize);
    }

    /**
     * 预览模板
     *
     * @param templateId 模板id
     * @return
     */
    @GetMapping("/previewTemplate")
    public Result previewTemplate(@Param("templateId")String templateId){
        return   kuaiShouAccountCleanService.previewTemplate(templateId);
    }

    /**
     * 推送模板
     *
     * @param templateId 模板id，accountId 账户id
     * @return
     */
    @GetMapping("/pushTemplate")
    public Result pushTemplate(@Param("templateId")String templateId,@Param("accountId")String accountId){
        return   kuaiShouAccountCleanService.pushTemplate(templateId,accountId);
    }

    /**
     * 修改模板
     *
     * @param kuaiShouAccountCleanTemplateInfo
     * @return
     */
    @PostMapping("/updateTemplate")
    public Result updateTemplate(@RequestBody KuaiShouAccountCleanTemplateInfo kuaiShouAccountCleanTemplateInfo){
        return   kuaiShouAccountCleanService.updateTemplate(kuaiShouAccountCleanTemplateInfo);
    }


    /**
     * 查询个人清理模板列表
     *
     * @param accountId  账户id  userName运营名称  userId当前登录人id
     * @return
     */
    @GetMapping("/getMyselfTemplateList")
    public Result getMyselfTemplateList(@Param("accountId")String accountId,@Param("userName")String userName,@Param("userId")String userId,
                                  @Param("pageNum")String pageNum,@Param("pageSize")String pageSize  ){
        return   kuaiShouAccountCleanService.getMyselfTemplateList(accountId,userName,userId,pageNum,pageSize);
    }

    /**
     * 开启/暂停模板
     *
     * @param templateId 模板id   status状态  0-开始   1-暂停
     * @return
     */
    @GetMapping("/updateTemplateStatus")
    public Result updateTemplateStatus(@Param("templateId")String templateId,@Param("status")String status){
        return   kuaiShouAccountCleanService.updateTemplateStatus(templateId,status);
    }


    /**
     * 解除模板绑定
     *
     * @param templateId 模板id，accountId 账户id
     * @return
     */
    @GetMapping("/removeBinding")
    public Result removeBinding(@Param("templateId")String templateId,@Param("accountId")String accountId){
        return   kuaiShouAccountCleanService.removeBinding(templateId,accountId);
    }


    /**
     * 查询清理记录
     *
     * @param userName 运营名称  accountId 账户id
     * @return
     */
    @GetMapping("/getCleanUpLog")
    public Result getCleanUpLog(@Param("userName")String userName,@Param("accountId")String accountId,
                                  @Param("pageNum")String pageNum,@Param("pageSize")String pageSize  ){
        return   kuaiShouAccountCleanService.getCleanUpLog(userName,accountId,pageNum,pageSize);
    }

    /**
     * 查询清理记录
     *
     * @param
     * @return
     */
    @GetMapping("/cleanAccount")
    public Result cleanAccount(){
        return   kuaiShouAccountCleanService.cleanAccount();
    }
}
