package com.bocloud.ims.interfaces.resource;

import com.bocloud.cmp.model.SnapshotGenericParam;
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.Snapshot;

import java.util.List;

public interface SnapshotService {

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

    BocloudResult<List<Snapshot>> tree(Long parentId, Long vendorId, Long serverId, RequestContext context);

    /**
     * 创建
     *
     * @param snapshot
     * @param context
     * @return
     */
    BocloudResult<String> create(Snapshot snapshot, RequestContext context);

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

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

    /**
     * 恢复
     *
     * @param id
     * @param context
     * @return
     */
    BocloudResult<String> revert(Long id, SnapshotGenericParam snapshotGenericParam, RequestContext context);

    /**
     * 更新快照
     *
     * @param id
     * @param snapshot
     * @param context
     * @return
     */
    BocloudResult<String> modify(Long id, Snapshot snapshot, RequestContext context);

    /**
     * 申请创建快照
     *
     * @param params
     * @param context
     * @return
     */
    BocloudResult<String> apply(String params, RequestContext context);

    /**
     * 更新快照到期时间
     *
     * @param resId
     * @param months
     * @param context
     * @return
     */
    BocloudResult<String> updateExpriedTime(Long resId, Integer months, RequestContext context);

    /**
     * 查询启动卷下的快照
     *
     * @param vendorId
     * @param tenantUuid
     * @param context
     * @return
     */
    BocloudResult<List<Snapshot>> listBootableSnaps(Long vendorId, String tenantUuid, RequestContext context);

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

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

    /**
     * 查询
     *
     * @param condition
     * @param context
     * @return
     */
    BocloudResult snapshots(String condition, RequestContext context);

    /**
     * 快照操作类
     *
     * @param snapshotId
     * @param context
     * @param action
     * @param params
     * @return
     */
    BocloudResult<String> operation(Long snapshotId, RequestContext context, SnapshotGenericParam snapshotGenericParam);

    /**
     * 重建快照
     * @param snapshotId 快照id
     * @param param 重建参数
     * @return
     */
    BocloudResult<String> rebuild(Long snapshotId, SnapshotGenericParam param, RequestContext context);
}
