package com.artfess.rescue.cloud.controller;


import com.artfess.base.annotation.ApiGroup;
import com.artfess.base.constants.ApiGroupConsts;
import com.artfess.base.controller.BaseController;
import com.artfess.base.model.CommonResult;
import com.artfess.rescue.cloud.dto.CloudApplyDetailSaveDTO;
import com.artfess.rescue.cloud.manager.BizCloudApplyDetailManager;
import com.artfess.rescue.cloud.model.BizCloudApplyDetail;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;

import java.util.List;


/**
 * 私有云资源申请明细表 前端控制器
 *
 * @author 管理员
 * @company 阿特菲斯信息技术有限公司
 * @since 2024-08-07
 */
@RestController
@RequestMapping("/bizCloudApplyDetail/v1/")
@Api(tags = "私有云资源申请明细")
@ApiGroup(group = {ApiGroupConsts.GROUP_BIZ_RESCUE})
public class BizCloudApplyDetailController extends BaseController<BizCloudApplyDetailManager, BizCloudApplyDetail> {

    @PostMapping("save/list")
    @ApiOperation("批量保存/更新")
    public CommonResult<String> saveList(@ApiParam(name = "cloudApplyDetailList", value = "私有云资源申请明细") @RequestBody List<BizCloudApplyDetail> cloudApplyDetailList) {
        return baseService.saveList(cloudApplyDetailList);
    }

    @PostMapping("/save")
    @ApiOperation("私有云申请明细及端口映射新增/修改")
    public CommonResult<String> save(@ApiParam(name = "CloudApplyDetailSaveDTO", value = "私有云申请明细及端口映射") @RequestBody CloudApplyDetailSaveDTO dto) {
        return baseService.saveInfo(dto);
    }

    @PutMapping("/update")
    @ApiOperation("私有云申请明细及端口映射修改")
    public CommonResult<String> update(@ApiParam(name = "CloudApplyDetailSaveDTO", value = "私有云申请明细及端口映射") @RequestBody CloudApplyDetailSaveDTO dto) {
        return baseService.updateInfo(dto);
    }

    @GetMapping("/list/{privateCloudApplyId}")
    @ApiOperation("获取私有云申请明细及端口映射列表")
    public CommonResult<List<CloudApplyDetailSaveDTO>> getListByPrivateCloudApplyId(@ApiParam(name = "privateCloudApplyId", value = "私有云申请ID") @PathVariable String privateCloudApplyId) {
        return baseService.getListByPrivateCloudApplyId(privateCloudApplyId);
    }


}
