package com.test.test.controller;

import com.test.common.annotation.Log;
import com.test.common.core.controller.BaseController;
import com.test.common.core.domain.AjaxResult;
import com.test.common.enums.BusinessType;
import com.test.test.domain.TestTaskCase;
import com.test.test.service.ITestTaskCaseService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 定时任务用例关联Controller
 */
@RestController
@RequestMapping("/test/taskCase")
public class TestTaskCaseController extends BaseController {
    @Resource
    private ITestTaskCaseService testTaskCaseService;

    /**
     * 新增定时任务用例关联
     */
    @Log(title = "定时任务用例关联", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    public AjaxResult add(@RequestBody TestTaskCase testTaskCase) {
        return toAjax(testTaskCaseService.insertTestTaskCase(testTaskCase));
    }

    /**
     * 删除定时任务用例关联
     */
    @Log(title = "定时任务用例关联", businessType = BusinessType.DELETE)
    @PostMapping("/del")
    public AjaxResult remove(@RequestBody TestTaskCase testTaskCase) {
        return toAjax(testTaskCaseService.deleteTestTaskCase(testTaskCase));
    }

    /**
     * 更新定时任务用例关联
     */
    @Log(title = "更新任务用例关联", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    public AjaxResult edit(@RequestBody TestTaskCase testTaskCase) {
        return toAjax(testTaskCaseService.updateTestTaskCase(testTaskCase));
    }
}
