package com.bocloud.ims.interfaces.resource;

import com.alibaba.fastjson.JSONObject;
import com.bocloud.common.model.BocloudResult;
import com.bocloud.common.model.RequestContext;
import com.bocloud.ims.entity.resource.CloudVendor;
import com.bocloud.ims.entity.resource.PoolGroupZone;
import com.bocloud.ims.entity.resource.Region;
import com.bocloud.ims.entity.resource.Zone;

import java.util.List;

/**
 * 区域Service接口(子区域为zone)
 *
 * @author dongkai
 */
public interface RegionService {

	/**
	 * 根据ID查询
	 *
	 * @param id
	 * @return
	 */
	public BocloudResult<List<Region>> list(Long vendorId);

	/**
	 * 查询子区域
	 *
	 * @param regionId
	 * @param vendorId
	 * @return
	 */
	public BocloudResult<List<Zone>> listZone(Long vendorId, String regionId);

	/**
	 * 根据资源池查询关联区域
	 * 
	 * @param object
	 * @return
	 * @throws Exception
	 */
	public BocloudResult<List<PoolGroupZone>> listRegionByGroup(JSONObject object);

	/**
	 * 自服务端根据业务查询平台下的区域信息
	 *
	 * @param object
	 * @param projectId
	 * @return
	 */
	BocloudResult<List<Region>> listByBusiness(JSONObject object, RequestContext context);

	/**
	 * 查询region列表
	 * 
	 * @param params
	 * @param user
	 * @return
	 */
	public BocloudResult<List<Region>> condition(String condition, RequestContext context);

	public BocloudResult zones(Long id, Long vendorId, String type);

	public BocloudResult dicToMap(String vendorType);

	/**
	 * 删除区域下的资源
	 * @param regionId
	 * @param vendorId
	 * @param userId
	 * @throws Exception
	 */
	public void removeResources(String regionId, Long vendorId, Long userId) throws Exception;

	/**
	 * 同步云平台下的region
	 * @param vendor
	 * @param userId
	 * @param currentRegions
	 * @throws Exception
	 */
	public BocloudResult syncRegion(CloudVendor vendor, Long userId, List<String> currentRegions) throws Exception;
}
