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.FireCheckListItemServiceI;
import com.zcloud.fire.check.dto.FireCheckListItemAddCmd;
import com.zcloud.fire.check.dto.FireCheckListItemPageQry;
import com.zcloud.fire.check.dto.FireCheckListItemUpdateCmd;
import com.zcloud.fire.check.dto.clientobject.FireCheckListItemCO;
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-11-28 10:32:28
 */
@ApiIgnore
@Api(tags = "消防点位检查详细表", hidden = true)
@RequestMapping("/${application.gateway}/fireCheckListItem")
@RestController
@AllArgsConstructor
@Deprecated
public class FireCheckListItemController {
    private final FireCheckListItemServiceI fireCheckListItemService;

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

    @ApiOperation("分页")
    @PostMapping("/list")
    public PageResponse<FireCheckListItemCO> page(@RequestBody FireCheckListItemPageQry qry) {
        return fireCheckListItemService.listPage(qry);
    }

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

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

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

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

    @ApiOperation("修改")
    @PutMapping("/edit")
    public SingleResponse edit(@Validated @RequestBody FireCheckListItemUpdateCmd fireCheckListItemUpdateCmd) {
        fireCheckListItemService.edit(fireCheckListItemUpdateCmd);
        return SingleResponse.buildSuccess();
    }
}

