package com.bocloud.ims.booter.controller.resource.azure.slb;

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.azure.slb.InboundNatPool;
import com.bocloud.ims.interfaces.resource.azure.slb.InboundNatPoolService;
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.*;

@Api(value = "入站NAT网络池", tags = "入站NAT网络池管理")
@RestController
@RequestMapping("/v1/nats/pools")
public class InboundNatPoolController {

	@Autowired
	private InboundNatPoolService service;

	/**
	 * 列表
	 *
	 * @param pager
	 * @return
	 */
	@ApiOperation(tags = {"CMC", "CSC"}, value = "列表入站NAT网络池", httpMethod = "GET")
	@Log(module = BoCloudService.IMS, target = "入站NAT网络池", operation = "列表入站NAT网络池")
	@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 = "详情入站NAT网络池", httpMethod = "GET")
	@Log(module = BoCloudService.IMS, target = "入站NAT网络池", operation = "详情入站NAT网络池")
	@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 = "创建入站NAT网络池", httpMethod = "POST")
	@Log(module = BoCloudService.IMS, target = "入站NAT网络池", operation = "创建入站NAT网络池")
	@PostMapping
	public BocloudResult create(@RequestBody InboundNatPool entityParams,
								@Value(Common.REQ_CONTEXT) RequestContext context) {
		return service.create(entityParams, context);
	}

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

}
