package com.bocloud.ims.booter.controller.resource.fusionsphere;

import com.bocloud.common.annotations.Log;
import com.bocloud.common.enums.BoCloudService;
import com.bocloud.common.model.BocloudResult;
import com.bocloud.common.model.Pager;
import com.bocloud.common.model.RequestContext;
import com.bocloud.common.utils.Common;
import com.bocloud.ims.entity.resource.PortGroup;
import com.bocloud.ims.interfaces.resource.fusionsphere.FusionSpherePortGroupService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;

/**
 * @Company: 博云 www.bocloud.com
 * @ClassName: FusionSpherePortGroupController
 * @Description:端口组管理
 * @author: zhenpingLi/李振平
 * @date: 2021/10/26 15:06
 */
@Api(value = "FusionSpherePortGroup", tags = "FusionSpherePortGroup管理")
@RestController
@RequestMapping("/v1/fc/port/groups")
public class FusionSpherePortGroupController {
    @Autowired
    private FusionSpherePortGroupService service;

    /**
     * 查询列表
     *
     * @param pager
     * @return
     */
    @ApiOperation(tags = {"CMC", "CSC"}, value = "列表FusionSpherePortGroup", httpMethod = "GET")
    @Log(module = BoCloudService.IMS, target = "FusionSpherePortGroup", operation = "列表FusionSpherePortGroup")
    @GetMapping
    public BocloudResult list(Pager pager,
                              @Value(Common.REQ_CONTEXT) RequestContext context) {
        return service.list(pager, context);
    }


    /**
     * 查询详情
     *
     * @param id
     * @return
     */
    @ApiOperation(tags = {"CMC", "CSC"}, value = "详情FusionSpherePortGroup", httpMethod = "GET")
    @Log(module = BoCloudService.IMS, target = "FusionSpherePortGroup", operation = "详情FusionSpherePortGroup")
    @GetMapping("/{id}")
    public BocloudResult detail(@PathVariable(value = Common.ID) Long id,
                                @Value(Common.REQ_CONTEXT) RequestContext context) {
        return service.detail(id, context);
    }

    /**
     * 创建
     *
     * @param entityParams
     * @param context
     * @return
     */
    @ApiOperation(tags = {"CMC", "CSC"}, value = "创建FusionSpherePortGroup", httpMethod = "POST")
    @Log(module = BoCloudService.IMS, target = "FusionSpherePortGroup", operation = "创建FusionSpherePortGroup")
    @PostMapping
    public BocloudResult create(@RequestBody PortGroup entityParams,
                                @Value(Common.REQ_CONTEXT) RequestContext context) {
        return service.create(entityParams, context);
    }

    /**
     * 更新
     *
     * @param entityParams
     * @param context
     * @return
     */
    @ApiOperation(tags = {"CMC", "CSC"}, value = "更新FusionSpherePortGroup", httpMethod = "PUT")
    @Log(module = BoCloudService.IMS, target = "FusionSpherePortGroup", operation = "更新FusionSpherePortGroup")
    @PutMapping(value = "/{id}")
    public BocloudResult modify(@PathVariable(value = Common.ID) Long id,
                                @RequestBody PortGroup entityParams,
                                @Value(Common.REQ_CONTEXT) RequestContext context) {
        return service.modify(entityParams, context);
    }

    /**
     * 删除
     *
     * @param id
     * @param context
     * @return
     */
    @ApiOperation(tags = {"CMC", "CSC"}, value = "删除FusionSpherePortGroup", httpMethod = "DELETE")
    @Log(module = BoCloudService.IMS, target = "FusionSpherePortGroup", operation = "删除FusionSpherePortGroup")
    @DeleteMapping("/{id}")
    public BocloudResult remove(@PathVariable(value = Common.ID) Long id,
                                @Value(Common.REQ_CONTEXT) RequestContext context) {
        return service.remove(id, context);
    }

}