package com.template.api;

import com.alibaba.fastjson2.JSONObject;
import com.template.model.pojo.SmartDataTask;
import com.template.model.result.CommonResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

/**
 * @Author: binguo
 * @Date: 2023/3/30 星期四 17:28
 * @Description: com.video.api
 * @Version: 1.0
 */
@RequestMapping("/api/smartDataTask")
@Api(tags = {"SmartDataTaskControllerAPI"}, value = "操作记录")
public interface SmartDataTaskControllerAPI {
    @PostMapping(value = "/createJob")
    @ApiOperation(value = "创建定时任务", notes = "创建定时任务", httpMethod = "POST")
    CommonResult createJob(@Validated @RequestBody SmartDataTask smartDataTask, HttpServletRequest httpServletRequest, BindingResult bindingResult);

    @PostMapping(value = "/pauseJob")
    @ApiOperation(value = "暂定定时任务", notes = "暂停定时任务", httpMethod = "POST")
    CommonResult pauseJob(@Validated @RequestBody SmartDataTask smartDataTask, HttpServletRequest httpServletRequest, BindingResult bindingResult);

    @PostMapping(value = "/resumeJob")
    @ApiOperation(value = "恢复定时任务", notes = "恢复定时任务", httpMethod = "POST")
    CommonResult resumeJob(@Validated @RequestBody SmartDataTask smartDataTask, HttpServletRequest httpServletRequest, BindingResult bindingResult);

    @PostMapping(value = "/updateJob")
    @ApiOperation(value = "修改定时任务", notes = "修改定时任务", httpMethod = "POST")
    CommonResult updateJob(@Validated @RequestBody SmartDataTask smartDataTask, HttpServletRequest httpServletRequest, BindingResult bindingResult);

    @PostMapping(value = "/deleteJob")
    @ApiOperation(value = "修改定时任务", notes = "修改定时任务", httpMethod = "POST")
    CommonResult deleteJob(@Validated @RequestBody SmartDataTask smartDataTask, HttpServletRequest httpServletRequest, BindingResult bindingResult);

    @PostMapping(value = "/runOnceJob")
    @ApiOperation(value = "运行一次定时任务", notes = "运行一次定时任务", httpMethod = "POST")
    CommonResult runOnceJob(@Validated @RequestBody SmartDataTask smartDataTask, HttpServletRequest httpServletRequest, BindingResult bindingResult);

    @GetMapping(value = "/getDepart")
    @ApiOperation(value = "获取部门", notes = "获取部门", httpMethod = "GET")
    CommonResult getDepart();

    @GetMapping(value = "/getSyncPolicy")
    @ApiOperation(value = "同步策略", notes = "同步策略", httpMethod = "GET")
    CommonResult getSyncPolicy();

    @GetMapping(value = "/getExchangeType")
    @ApiOperation(value = "交换方式", notes = "交换方式", httpMethod = "GET")
    CommonResult getExchangeType();

    @PostMapping(value = "/testSql")
    @ApiOperation(value = "测试sql", notes = "测试sql", httpMethod = "POST")
    CommonResult testSql(@RequestBody String json);

    @PostMapping(value = "/getTables")
    @ApiOperation(value = "根据数据源获取所有的表", notes = "根据数据源获取所有的表", httpMethod = "POST")
    CommonResult getTables(@RequestBody String json);

    @PostMapping(value = "/getViews")
    @ApiOperation(value = "根据数据源获取所有的表", notes = "根据数据源获取所有的表", httpMethod = "POST")
    CommonResult getViews(@RequestBody String json);

    @PostMapping(value = "/insertSmartDataTask1")
    @ApiOperation(value = "添加数据源任务管理数据", notes = "添加数据源任务管理数据-任务基本信息", httpMethod = "POST")
    CommonResult insertSmartDataTask1(@Validated @RequestBody SmartDataTask smartDataTask, HttpServletRequest httpServletRequest, BindingResult bindingResult);

    @PostMapping(value = "/insertSmartDataTask2")
    @ApiOperation(value = "添加数据源任务管理数据", notes = "添加数据源任务管理数据-字段配置", httpMethod = "POST")
    CommonResult insertSmartDataTask2(@Validated @RequestBody JSONObject json, HttpServletRequest httpServletRequest, BindingResult bindingResult);

    @PostMapping(value = "/insertSmartDataTask3")
    @ApiOperation(value = "添加数据源任务管理数据", notes = "添加数据源任务管理数据-定时信息", httpMethod = "POST")
    CommonResult insertSmartDataTask3(@Validated @RequestBody SmartDataTask smartDataTask, HttpServletRequest httpServletRequest, BindingResult bindingResult);

    @PostMapping(value = "/updateSmartDataTaskById1")
    @ApiOperation(value = "编辑数据源任务管理数据", notes = "编辑数据源任务管理数据-任务基本信息", httpMethod = "POST")
    CommonResult updateSmartDataTaskById1(@Validated @RequestBody SmartDataTask smartDataTask, HttpServletRequest httpServletRequest, BindingResult bindingResult);

    @PostMapping(value = "/updateSmartDataTaskById2")
    @ApiOperation(value = "编辑数据源任务管理数据", notes = "编辑数据源任务管理数据-字段配置", httpMethod = "POST")
    CommonResult updateSmartDataTaskById2(@Validated @RequestBody JSONObject json, HttpServletRequest httpServletRequest, BindingResult bindingResult);

    @PostMapping(value = "/updateSmartDataTaskById3")
    @ApiOperation(value = "编辑数据源任务管理数据", notes = "编辑数据源任务管理数据-定时信息", httpMethod = "POST")
    CommonResult updateSmartDataTaskById3(@Validated @RequestBody SmartDataTask smartDataTask, HttpServletRequest httpServletRequest, BindingResult bindingResult);

    @GetMapping(value = "/queryPageSmartDataTask")
    @ApiOperation(value = "数据源任务管理分页数据", notes = "数据源任务管理分页数据", httpMethod = "GET")
    CommonResult queryPageSmartDataTasks(@RequestParam int currentPage, @RequestParam int pageCount, SmartDataTask smartDataTask);

    @GetMapping(value = "/deleteSmartDataTaskById")
    @ApiOperation(value = "根据ID删除数据源任务数据", notes = "根据ID删除数据源任务数据", httpMethod = "GET")
    CommonResult deleteSmartDataTaskById(@RequestParam int id, @RequestParam int delMethod, HttpServletRequest httpServletRequest);

    @GetMapping(value = "/queryPageSmartDataTaskDebug")
    @ApiOperation(value = "任务debug日志记录分页数据", notes = "任务debug日志记录分页数据", httpMethod = "GET")
    CommonResult queryPageSmartDataTaskDebug(@RequestParam int currentPage, @RequestParam int pageCount,
                                             @RequestParam(required = false) Integer eTaskId,
                                             @RequestParam(required = false) String startTime,
                                             @RequestParam(required = false) String endTime);

    @PostMapping(value = "/delSmartDataTaskDebugByIds")
    @ApiOperation(value = "删除任务debug日志记录", notes = "删除任务debug日志记录", httpMethod = "POST")
    CommonResult delSmartDataTaskDebugByIds(@Validated @RequestBody JSONObject json, HttpServletRequest httpServletRequest, BindingResult bindingResult);

    @GetMapping(value = "/queryPageSmartDataTaskLog")
    @ApiOperation(value = "任务运行日志记录分页数据", notes = "任务运行日志记录分页数据", httpMethod = "GET")
    CommonResult queryPageSmartDataTaskLog(@RequestParam int currentPage, @RequestParam int pageCount,
                                           @RequestParam(required = false) Integer eTaskId,
                                           @RequestParam(required = false) String tkLogTaskName,
                                           @RequestParam(required = false) Integer tkLogAutoManual,
                                           @RequestParam(required = false) Integer tkLogDsSourceId,
                                           @RequestParam(required = false) Integer tkLogDsDestinationId,
                                           @RequestParam(required = false) Integer tkLogCostTime,
                                           @RequestParam(required = false) Integer tkLogExeStatus,
                                           @RequestParam(required = false) String startTime,
                                           @RequestParam(required = false) String endTime);
}
