package com.zcloud.primeport.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.primeport.api.VehicleBlackServiceI;
import com.zcloud.primeport.dto.VehicleBlackAddCmd;
import com.zcloud.primeport.dto.VehicleBlackPageQry;
import com.zcloud.primeport.dto.VehicleBlackUpdateCmd;
import com.zcloud.primeport.dto.clientobject.VehicleBlackCO;
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 java.util.ArrayList;

/**
 * web-adapter
 *
 * @Author makejava
 * @Date 2026-03-05 11:33:26
 */
@Api(tags = "车辆黑名单管理")
@RequestMapping("/${application.gateway}/vehicleBlack")
@RestController
@AllArgsConstructor
public class VehicleBlackController {
    private final VehicleBlackServiceI vehicleBlackService;

    @ApiOperation("新增")
    @PostMapping("/save")
    public SingleResponse<VehicleBlackCO> add(@Validated @RequestBody VehicleBlackAddCmd cmd) {
        return vehicleBlackService.add(cmd);
    }

    @ApiOperation("分页")
    @PostMapping("/list")
    public PageResponse<VehicleBlackCO> page(@RequestBody VehicleBlackPageQry qry) {
        return vehicleBlackService.listPage(qry);
    }

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

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

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

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

//    @ApiOperation("修改")
//    @PutMapping("/edit")
//    public SingleResponse edit(@Validated @RequestBody VehicleBlackUpdateCmd vehicleBlackUpdateCmd) {
//        vehicleBlackService.edit(vehicleBlackUpdateCmd);
//        return SingleResponse.buildSuccess();
//    }
}

