package com.bocloud.ims.interfaces.resource;

import com.alibaba.fastjson.JSONObject;
import com.bocloud.cmp.model.*;
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.*;

import java.util.List;

public interface NetworkService {

	/**
	 *
	 * @param pager
	 * @param context
	 * @return
	 */
	public BocloudResult<GridBean<Network>> list(Pager pager, RequestContext context);

	/**
	 *
	 * @param condition
	 * @param context
	 * @return
	 */
	public BocloudResult condition(String condition, RequestContext context);

	/**
	 * 创建
	 *
	 * @param params
	 * @param context
	 * @param callback
	 * @return
	 */
	public BocloudResult create(NetworkModel networkModel, RequestContext context, String callback);

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

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

	/**
	 * 修改网络
	 *
	 * @param context
	 * @return
	 */
	public BocloudResult modify(NetBean bean, RequestContext context);

	/**
	 * 创建分布式交换机
	 *
	 * @param model
	 * @param context
	 * @return
	 */
	public BocloudResult createDSwitch(SwitchModel model, RequestContext context);

	/**
	 * 虚拟机列表展示
	 * @param pager
	 * @param id
	 * @return
	 */
	public BocloudResult<GridBean<CloudServer>> servers(Pager pager, Long id);

	/**
	 * 宿主机列表展示
	 * @param pager
	 * @param id
	 * @return
	 */
	public BocloudResult<GridBean<Server>> hosts(Pager pager, Long id);

	/**
	 * 根据云平台ID查询网络和下面的子网信息
	 *
	 * @param vendorId
	 * @param tenantUuid
	 * @param context
	 * @return
	 */
	public BocloudResult listNetAndSubNet(Long vendorId, String tenantUuid, RequestContext context);

	public BocloudResult listExternal(Long vendorId, RequestContext context);

	public BocloudResult removeDSwitch(Long id, RequestContext context);

	/**
	 * 删除交换机
	 *
	 * @param id
	 * @param hostId
	 * @param context
	 * @return
	 */
	BocloudResult removeSwitch(Long id, Long hostId, RequestContext context);

	public BocloudResult modifyDSwitch(SwitchBean bean, RequestContext context);

	BocloudResult modifySwitch(SwitchBean bean, RequestContext context);

	/**
	 * 查询宿主机所连接网络(vcenter)
	 *
	 * @param hostId
	 * @return
	 */
	public BocloudResult listNetworkByHostId(Long hostId);

	/**
	 * 移除宿主机绑定的标准交换机
	 *
	 * @param hostId
	 * @param vswitchId
	 * @param context
	 * @return
	 */
	public BocloudResult removeVSwitch(Long hostId, Long vswitchId, RequestContext context);

	/**
	 * 修改标准交换机
	 *
	 * @param bean
	 * @param context
	 * @return
	 */
	public BocloudResult modifyVSwitch(SwitchBean bean, RequestContext context);

	/**
	 * 删除端口组
	 *
	 * @param hostId
	 * @param pgId
	 * @param context
	 * @return
	 */
	public BocloudResult removePortGroup(Long hostId, Long pgId, RequestContext context);

	/**
	 * 创建端口组
	 *
	 * @param pgModel
	 * @param context
	 * @return
	 */
	public BocloudResult createPortGroup(PortGroupModel pgModel, RequestContext context);

	/**
	 * 修改端口组
	 *
	 * @param portGroupBean
	 * @param context
	 * @return
	 */
	public BocloudResult modifyPortGroup(PortGroupBean portGroupBean, RequestContext context);

	/**
	 * 查询端口组详情
	 *
	 * @param pgId
	 * @return
	 */
	public BocloudResult<PortGroup> getPortGroup(Long pgId);

	/**
	 * 查询交换机详情
	 *
	 * @param switcherId
	 * @return
	 */
	public BocloudResult<Switcher> getSwitcher(Long switcherId);

	/**
	 * 查询交换机下的端口组
	 *
	 * @param switcherId
	 * @return
	 */
	public BocloudResult listBySwitcher(Long switcherId);

	/**
	 * 分布式交换机添加主机
	 *
	 * @param bean
	 * @param context
	 * @return
	 */
	public BocloudResult addHost(SwitchBean bean, RequestContext context);

	/**
	 * 查询交换机绑定的物理网卡
	 *
	 * @param switcherId
	 * @return
	 */
	public BocloudResult<List<NetworkCard>> listCardBySwitcher(Long switcherId);

	/**
	 * 查询指定数据中心下可添加分布式交换机网络的主机
	 *
	 * @param vdcId
	 * @return
	 */
	public BocloudResult<List<Server>> listHost(Long vdcId);

	/**
	 * 租户授权网咯
	 *
	 * @param id
	 * @param tenantIds
	 * @return
	 */
	public BocloudResult authNetwork(Long id, List<Long> tenantIds);

	/**
	 * 查询已授权指定网络的租户
	 *
	 * @param id
	 * @return
	 */
	public BocloudResult listAuthTenant(Long id);

	/**
	 * 根据租户ID删除
	 *
	 * @param tenantId
	 * @return
	 */
	public BocloudResult deleteByTenant(Long tenantId);

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

	public BocloudResult listRouterAndSubNet(String params, RequestContext context);

	BocloudResult<?> networkAndSubnets(JSONObject object, RequestContext context);

	public BocloudResult createOsNetwork(JSONObject param, RequestContext context);

}
