package com.bocloud.ims.interfaces.resource;

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.Resource;

import java.util.List;

public interface ResourceService {

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

	public BocloudResult create(Resource resource, RequestContext context);

	public Resource getByHost(String host);

	public Resource query(Long id);

	public BocloudResult detail(Long id);

	/**
	 * 通过targetId查询云主机账户信息
	 *
	 * @param targetId
	 * @return
	 */
	public BocloudResult queryAccount(Long targetId);

	/**
	 * 修改
	 *
	 * @param params
	 * @param context
	 * @return
	 */
	public BocloudResult modify(String params, RequestContext context);

	/**
	 * 修改账户和密码
	 *
	 * @param params
	 * @param context
	 * @return
	 */
	public BocloudResult<String> modifyAccount(String params, RequestContext context);

	public BocloudResult allot(String ids, Long userId);

	public BocloudResult recycle(Long id, Long userId);

	/**
	 * 迁入到某个资源池
	 *
	 * @param resourceId
	 * @param groupId
	 * @param groupIds
	 * @param context
	 * @return
	 */
	public BocloudResult migrate(Long resourceId, Long groupId, String groupIds, RequestContext context);

	/**
	 * 根据target和catalog查询id
	 *
	 * @param target
	 * @param catalog
	 * @return
	 */
	public BocloudResult queryId(Long target, String catalog);

	/**
	 * 资源列表查询
	 *
	 * @param pager
	 * @param simple
	 * @param condition
	 * @param context
	 * @return
	 */
	public BocloudResult<Long> resources(String condition);

	BocloudResult patch(String action, String params, RequestContext context);

	/**
	 * 操作资源对象
	 *
	 * @param id
	 * @param action
	 * @param params
	 * @param agent
	 * @param context
	 * @return
	 */
	BocloudResult patch(Long id, String action, String params, String agent, RequestContext context);

	BocloudResult delete(Long id, String params, RequestContext context);

	/**
	 * 获取堡垒机accessClient下载链接
	 *
	 * @param params
	 * @param context
	 * @return
	 */
	BocloudResult accessClient(String params, RequestContext context);

	/**
	 * 根据类型获取资产详情
	 *
	 * @param id
	 * @param params
	 * @param type
	 * @return
	 */
	BocloudResult detail(Long id, String params, String type);
}
