package com.bocloud.ims.interfaces.resource;

import com.bocloud.cmp.model.RouterBean;
import com.bocloud.common.model.BocloudResult;
import com.bocloud.common.model.GridBean;
import com.bocloud.common.model.Pager;
import com.bocloud.common.model.RequestContext;
import com.bocloud.ims.entity.resource.Router;
import com.bocloud.ims.entity.resource.Subnet;

import java.util.List;

public interface RouterService {

	/**
	 * 列表展示
	 *
	 * @param page
	 * @param rows
	 * @param params
	 * @param sorter
	 * @param simple
	 * @return
	 */
	public BocloudResult<GridBean<Router>> list(Pager pager, RequestContext context);

	/**
	 * 创建
	 *
	 * @param router
	 * @param user
	 * @return
	 */
	public BocloudResult<Router> create(Router router, RequestContext context);

	/**
	 * 删除
	 *
	 * @param id
	 * @param userId
	 * @return
	 */
	public BocloudResult<String> remove(Long id, RequestContext context);

	/**
	 * 编辑
	 *
	 * @param bean
	 * @return
	 */
	public BocloudResult<Router> modify(RouterBean bean, RequestContext context);

	/**
	 * 详情
	 *
	 * @param id
	 * @return
	 */
	public BocloudResult<Router> detail(Long id);

	/**
	 * 连接子网
	 *
	 * @param id
	 * @param subnetId
	 * @param address
	 * @param portId
	 * @param user
	 * @return
	 */
	public BocloudResult<String> attach(Long id, Long subnetId, String address, Long portId, RequestContext context);

	/**
	 * 断开子网
	 *
	 * @param id
	 * @param subnetId
	 * @param context
	 * @return
	 */
	public BocloudResult<String> detach(Long id, Long subnetId, RequestContext context);

	/**
	 * 设置网关
	 *
	 * @param id
	 * @param networkId
	 * @param context
	 * @return
	 */
	public BocloudResult<String> config(Long id, Long networkId, RequestContext context, String params);

	/**
	 * 清楚网关
	 *
	 * @param id
	 * @param context
	 * @return
	 */
	public BocloudResult<String> clear(Long id, RequestContext context);

	/**
	 * 批量删除
	 *
	 * @param params
	 * @param user
	 * @return
	 */
	public BocloudResult<String> batchRemove(List<Long> ids, RequestContext context);

	/**
	 * 汇总路由数量
	 *
	 * @param userId
	 * @param projectId
	 * @param tenantId
	 * @return
	 */
	public BocloudResult<Integer> count(Long userId, Long projectId, Long tenantId);

	public BocloudResult<List<Router>> listNetAndSubNet(String params, RequestContext context);

	/**
	 * 列表查询
	 * 
	 * @param pager
	 * @param simple
	 * @param condition
	 * @param user
	 * @return
	 */
	public BocloudResult routers(String condition, RequestContext context);

	/**
	 * 路由操作类
	 * 
	 * @param id
	 * @param networkId
	 * @param action
	 * @param params
	 * @param user
	 * @return
	 */
	public BocloudResult<String> operation(Long id, Long networkId, String action, String params, RequestContext context);

	public BocloudResult<List<Subnet>> listSubnets(Pager pager, String condition, RequestContext context);
}
