package com.yuchen.saas.park.service.controller.work;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.yuchen.saas.park.api.dto.work.SaasWorkOrderHandleTimeLimitDto;
import com.yuchen.saas.park.api.vo.work.SaasWorkOrderHandleTimeLimitVo;
import com.yuchen.saas.park.service.service.work.ISaasWorkOrderHandleTimeLimitService;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nest.springwrap.core.tool.api.R;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 工单处理时限表 前端控制器
 * </p>
 *
 * @author caiwq
 * @since 2024-04-01
 */
@Slf4j
@RestController
@RequiredArgsConstructor
@RequestMapping("/workOrderHandleTimeLimit")
public class SaasWorkOrderHandleTimeLimitController {

    private final ISaasWorkOrderHandleTimeLimitService baseService;

    /**
     * 添加工单处理时限
     * @param workOrderHandleTimeLimitDto 工单处理时限Dto
     * @return TRUE/FALSE
     */
    @PostMapping("/add")
    @ApiOperationSupport(order = 1)
    @ApiOperation(value = "添加工单处理时限", notes = "添加工单处理时限")
    public R<Boolean> add(@RequestBody @Validated SaasWorkOrderHandleTimeLimitDto workOrderHandleTimeLimitDto) {
        return R.data(baseService.add(workOrderHandleTimeLimitDto));
    }

    /**
     * 工单处理时限详情
     * @return 消息详情Vo
     */
    @GetMapping("/getDetail")
    @ApiOperationSupport(order = 2)
    @ApiOperation(value = "工单处理时限详情", notes = "工单处理时限详情")
    public R<SaasWorkOrderHandleTimeLimitVo> getDetail() {
        return R.data(baseService.getDetail());
    }

}
