package com.zcloud.fire.check.web;


import com.alibaba.cola.dto.MultiResponse;
import com.alibaba.cola.dto.PageResponse;
import com.alibaba.cola.dto.Response;
import com.alibaba.cola.dto.SingleResponse;
import com.jjb.saas.framework.auth.model.SSOUser;
import com.jjb.saas.framework.auth.utils.AuthContext;
import com.zcloud.fire.check.api.FireCheckRecordHiddenServiceI;
import com.zcloud.fire.check.dto.FireCheckRecordHiddenAddCmd;
import com.zcloud.fire.check.dto.FireCheckRecordHiddenPageQry;
import com.zcloud.fire.check.dto.FireCheckRecordHiddenUpdateCmd;
import com.zcloud.fire.check.dto.clientobject.FireCheckRecordHiddenCO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;

import java.util.ArrayList;

/**
 * web-adapter
 *
 * @Author zhaokai
 * @Date 2025-12-12 11:11:15
 */
@ApiIgnore
@Api(tags = "消防点位检查记录隐患表",hidden = true)
@RequestMapping("/${application.gateway}/fireCheckRecordHidden")
@RestController
@AllArgsConstructor
@Deprecated
public class FireCheckRecordHiddenController {
    private final FireCheckRecordHiddenServiceI fireCheckRecordHiddenService;

    @ApiOperation("新增")
    @PostMapping("/save")
    public SingleResponse<FireCheckRecordHiddenCO> add(@Validated @RequestBody FireCheckRecordHiddenAddCmd cmd) {
        SSOUser ssoUser = AuthContext.getCurrentUser();
        return fireCheckRecordHiddenService.add(cmd);
    }

    @ApiOperation("分页")
    @PostMapping("/list")
    public PageResponse<FireCheckRecordHiddenCO> page(@RequestBody FireCheckRecordHiddenPageQry qry) {
        return fireCheckRecordHiddenService.listPage(qry);
    }

    @ApiOperation("所有数据")
    @GetMapping("/listAll")
    public MultiResponse<FireCheckRecordHiddenCO> listAll() {
        return MultiResponse.of(new ArrayList<FireCheckRecordHiddenCO>());
    }

    @ApiOperation("详情")
    @GetMapping("/{id}")
    public SingleResponse<FireCheckRecordHiddenCO> getInfoById(@PathVariable("id") Long id) {
        return SingleResponse.of(new FireCheckRecordHiddenCO());
    }

    @ApiOperation("删除")
    @DeleteMapping("/{id}")
    public Response remove(@PathVariable("id") Long id) {
        fireCheckRecordHiddenService.remove(id);
        return SingleResponse.buildSuccess();
    }

    @ApiOperation("删除多个")
    @DeleteMapping("/ids")
    public Response removeBatch(@RequestParam Long[] ids) {
        fireCheckRecordHiddenService.removeBatch(ids);
        return SingleResponse.buildSuccess();
    }

    @ApiOperation("修改")
    @PutMapping("/edit")
    public SingleResponse edit(@Validated @RequestBody FireCheckRecordHiddenUpdateCmd fireCheckRecordHiddenUpdateCmd) {
        fireCheckRecordHiddenService.edit(fireCheckRecordHiddenUpdateCmd);
        return SingleResponse.buildSuccess();
    }
}

