package com.bocloud.ims.interfaces.resource;

import com.bocloud.cmp.model.common.ApplicationParam;
import com.bocloud.cmp.model.common.CancelationParam;
import com.bocloud.cmp.model.common.ExtensionParam;
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.FloatingIp;
import com.bocloud.ims.entity.resource.Port;

import java.util.List;

/**
 * 浮动IP抽象Service层
 *
 * @author weiwei
 */
public interface FloatingIpService {

	/**
	 * 列表展示GridBean
	 * @param pager
	 * @param context
	 * @return
	 */
	public BocloudResult<GridBean<FloatingIp>> list(Pager pager, RequestContext context);

	/**
	 * 根据condition列表展示GridBean
	 * @param condition
	 * @return
	 */
	public BocloudResult condition(String condition);

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

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

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

	/**
	 * 关联端口
	 *
	 * @param id
	 * @param portId
	 * @param userId
	 * @return
	 */
	public BocloudResult associate(Long id, Long portId, Long userId);

	/**
	 * 解绑端口
	 *
	 * @param id
	 * @param userId
	 * @return
	 */
	public BocloudResult disassociate(Long id, RequestContext context);

	/**
	 * 获取可绑定的端口
	 *
	 * @param id
	 * @param user
	 * @return
	 */
	public BocloudResult<List<Port>> ports(Long id, RequestContext context);

	/**
	 * 浮动IP申请
	 *
	 * @param params
	 * @param user
	 * @return
	 */
	public BocloudResult apply(ApplicationParam application);

	/**
	 * 更新浮动IP到期时间
	 *
	 * @param resId
	 * @param months
	 * @param requestUser
	 * @return
	 */
	public BocloudResult updateExpriedTime(Long resId, Integer months, RequestContext context);

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

	/**
	 * 汇总浮动IP数量
	 *
	 * @param userId
	 * @param projectId
	 * @param tenantId
	 * @return
	 */
	public BocloudResult count(Long userId, Long projectId, Long tenantId);

	public BocloudResult associate(String params, RequestContext context);

	public BocloudResult cancelation(CancelationParam param);

	public BocloudResult extension(ExtensionParam parseObject);
}
