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

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

import javax.annotation.Resource;

/**
 * <p>
 * 工单大类设置表 前端控制器
 * </p>
 *
 * @author caiwq
 * @since 2024-10-12
 */
@Slf4j
@RestController
@RequiredArgsConstructor
@RequestMapping("/workOrderCategorySetting")
public class SaasWorkOrderCategorySettingController {

    @Resource
    private ISaasWorkOrderCategorySettingService baseService;


    /**
     * 添加工单大类设置
     * @param dto 工单大类设置Dto
     * @return TRUE/FALSE
     */
    @PostMapping("/add")
    @ApiOperationSupport(order = 1)
    @ApiOperation(value = "添加工单大类设置", notes = "添加工单大类设置")
    public R<Boolean> add(@RequestBody @Validated SaasWorkOrderCategorySettingDto dto) {
        return R.data(baseService.add(dto));
    }

    /**
     * 工单大类设置详情
     * @return 工单大类设置详情Vo
     */
    @GetMapping("/getDetail/{customerId}")
    @ApiOperationSupport(order = 2)
    @ApiOperation(value = "工单大类设置详情", notes = "工单大类设置详情")
    public R<SaasWorkOrderCategorySettingVo> getDetail(@ApiParam(name = "customerId", value = "客户ID", required = true) @PathVariable("customerId") Long customerId) {
        return R.data(baseService.getDetail(customerId));
    }

}
