package com.yuchen.saas.park.service.controller.fire.fight;

import com.thinkunion.park.service.common.constant.GroupAction;
import com.yuchen.saas.park.api.dto.fire.fight.FireFightDutyStaffReqDTO;
import com.yuchen.saas.park.api.dto.fire.fight.FireFightDutyStaffSubmitReqDTO;
import com.yuchen.saas.park.api.vo.fire.fight.FireFightDutyStaffVO;
import com.yuchen.saas.park.service.service.fire.fight.ISaasParkFireFightDutyStaffService;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nest.springwrap.core.mp.support.NestPage;
import org.nest.springwrap.core.tool.api.R;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * 消防值班人员信息-相关接口
 *
 * @author zhouhanwei
 * @since 2024-04-30
 */
@Slf4j
@RestController
@RequiredArgsConstructor
@RequestMapping("/fireFightDutyStaff")
public class SaasParkFireFightDutyStaffController {

    private final ISaasParkFireFightDutyStaffService baseService;

    /**
     * 值班人员分页列表
     */
    @PostMapping("/findFireFightDutyStaffPage")
    @ApiOperation(value = "值班人员分页列表", notes = "值班人员分页列表")
    public R<NestPage<FireFightDutyStaffVO>> findFireFightDutyStaffPage(@RequestBody FireFightDutyStaffReqDTO reqDTO) {
        return R.data(baseService.findFireInspectTypePage(reqDTO));
    }

    /**
     * 值班人员详情
     */
    @GetMapping("/getFireFightDutyStaffById/{staffId}")
    @ApiOperation(value = "值班人员详情", notes = "值班人员详情")
    public R<FireFightDutyStaffVO> getFireFightDutyStaffById(@PathVariable Long staffId) {
        return R.data(baseService.getFireFightDutyStaffById(staffId));
    }

    /**
     * 添加值班人员
     */
    @PostMapping("/addFireFightDutyStaff")
    @ApiOperation(value = "添加值班人员", notes = "添加值班人员")
    public R addFireFightDutyStaff(@Validated(GroupAction.InsertAction.class) @RequestBody FireFightDutyStaffSubmitReqDTO reqDTO) {
        return R.status(baseService.addFireFightDutyStaff(reqDTO));
    }

    /**
     * 编辑值班人员
     */
    @PostMapping("/editFireFightDutyStaff")
    @ApiOperation(value = "编辑值班人员", notes = "编辑值班人员")
    public R editFireFightDutyStaff(@Validated(GroupAction.UpdateAction.class) @RequestBody FireFightDutyStaffSubmitReqDTO reqDTO) {
        return R.status(baseService.editFireFightDutyStaff(reqDTO));
    }

    /**
     * 删除值班人员
     */
    @PostMapping("/removeFireFightDutyStaff/{staffId}")
    @ApiOperation(value = "删除值班人员", notes = "删除值班人员")
    public R removeFireFightDutyStaff(@PathVariable Long staffId) {
        return R.status(baseService.removeFireFightDutyStaff(staffId));
    }
}
