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

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yuchen.saas.park.api.request.FireInspectTackQueryRequest;
import com.yuchen.saas.park.api.request.FireInspectTaskUpdateRequest;
import com.yuchen.saas.park.api.response.FireInspectTaskListResponse;
import com.yuchen.saas.park.api.response.FireInspectTaskPointResponse;
import com.yuchen.saas.park.api.response.FireTaskPartListResponse;
import com.yuchen.saas.park.service.service.FireInspectTaskService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.nest.springwrap.core.mp.support.Query;
import org.nest.springwrap.core.tool.api.R;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * @ClassName FireInspectPointController
 * @Description 消防巡查任务
 * @Author 肖祥
 * @Date 2022/10/18 15:30
 * @Version 1.0。0
 **/
@RestController
@AllArgsConstructor
@RequestMapping("/fire/inspect/task")
@Api(value = "消防巡查任务控制器接口", tags = "消防巡查任务控制器接口")
public class FireInspectTaskController {

    @Resource
    private FireInspectTaskService fireInspectTaskService;


    /**
     * 消防设施巡查任务列表(pc and android)
     */
    @GetMapping("/list/page")
    @ApiOperation(value = "消防设施巡查任务分页", notes = "消防设施巡查任务分页")
    public R<IPage<FireInspectTaskListResponse>> list(@Valid FireInspectTackQueryRequest fireInspectTackQueryRequest, Query query) {
        return fireInspectTaskService.list(fireInspectTackQueryRequest,query);
    }

    /**
     * 消防设施巡查任务更新(android)
     */
    @ApiOperation(value = "消防设施巡查点编辑")
    @PostMapping("/update")
    public R<Boolean> update(@Valid FireInspectTaskUpdateRequest fireInspectTaskUpdateRequest) {
        return fireInspectTaskService.update(fireInspectTaskUpdateRequest);
    }

    /**
     * 消防设施巡查任务详情
     */
    @GetMapping("/taskPartList/page")
    @ApiOperation(value = "消防设施巡查任务详情", notes = "消防设施巡查任务详情")
    public R<IPage<FireTaskPartListResponse>> taskPartList(@RequestParam(value = "taskId",required = false) Long taskId, Query query) {
        return fireInspectTaskService.taskPartList(taskId,query);
    }

    /**
     * 消防巡查任务巡查点list
     */
    @GetMapping("/taskPointList/page")
    @ApiOperation(value = "消防巡查任务巡查点分页", notes = "消防巡查任务巡查点分页")
    public R<IPage<FireInspectTaskPointResponse>> taskPointList(@RequestParam(value = "taskId",required = false) Long taskId, Query query) {
        return fireInspectTaskService.taskPointList(taskId,query);
    }
}
