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

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.interfaces.resource.AccessControlService;

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.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author lyy
 * @version 1.0
 * @date 2021/1/14 15:43
 */
@Api(value = "访问控制", tags = "访问控制")
@RestController
@RequestMapping("/v1/controls")
public class AccessControlController {
	@Autowired
	private AccessControlService accessControlService;

	/**
	 * 查询访问控制列表
	 *
	 * @param pager
	 * @param context
	 * @return
	 */
	@ApiOperation(value = "查询访问控制列表", response = BocloudResult.class, httpMethod = "GET", produces = MediaType.APPLICATION_JSON_VALUE)
	@Log(module = BoCloudService.IMS, target = "防火墙", operation = "查询访问控制列表")
	@GetMapping
	public BocloudResult list(Pager pager, @Value(Common.REQ_CONTEXT) RequestContext context) {
		return accessControlService.list(pager.getPage(), pager.getRows(), pager.getParams(), pager.getSorter(),
				pager.getSimple(), context);
	}

}
