package cn.hanghui.outapi.platform.tenant.controller;

import cn.hanghui.outapi.platform.common.entity.rest.RestResult;
import cn.hanghui.outapi.platform.tenant.entity.dto.HandleProvePageDto;
import cn.hanghui.outapi.platform.tenant.entity.dto.ProveDeviceDto;
import cn.hanghui.outapi.platform.tenant.entity.dto.ProveDevicePageDto;
import cn.hanghui.outapi.platform.tenant.entity.dto.ProveDeviceVo;
import cn.hanghui.outapi.platform.tenant.entity.po.HandleProve;
import cn.hanghui.outapi.platform.tenant.service.HandleProveService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
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;

import java.util.List;

/**
 * @author shisl
 * @package cn.hanghui.outapi.platform.tenant.controller
 * @class HandleProveController
 * @date 2023/12/5 上午11:24
 * @description
 */
@Slf4j
@Api(tags = "临证须知")
@RestController
@RequestMapping(value = "/api/v1/prove")
@Deprecated
public class HandleProveController {

    @Autowired
    private HandleProveService handleProveService;

    @ApiOperation(value = "查询列表（分页）")
    @PostMapping("/page")
    public RestResult<IPage<HandleProve>> page(@RequestBody HandleProvePageDto dto) {
        return handleProveService.page(dto);
    }

    @ApiOperation(value = "查询列表")
    @PostMapping("/list")
    public RestResult<List<HandleProve>> list() {
        return handleProveService.list();
    }

    @ApiOperation(value = "添加/编辑")
    @PostMapping("/add")
    public RestResult<Boolean> add(@RequestBody HandleProve prove) {
        return handleProveService.add(prove);
    }

    @ApiOperation(value = "删除")
    @PostMapping("/del/{id}")
    public RestResult<Boolean> del(@PathVariable(value = "id") @ApiParam(value = "id", required = true) Long id) {
        return handleProveService.del(id);
    }

    @ApiOperation(value = "查询设备列表（分页）")
    @PostMapping("/device/page")
    public RestResult<IPage<ProveDeviceVo>> pageDevice(@RequestBody ProveDevicePageDto dto) {
        return handleProveService.pageDevice(dto);
    }

    @ApiOperation(value = "添加/编辑设备")
    @PostMapping("/device/add")
    public RestResult addDevice(@RequestBody ProveDeviceDto dto) {
        return handleProveService.addDevice(dto);
    }

    @ApiOperation(value = "删除设备")
    @PostMapping("/device/del/{id}")
    public RestResult<Boolean> delDevice(@PathVariable(value = "id") @ApiParam(value = "id", required = true) Long id) {
        return handleProveService.delDevice(id);
    }


}
