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.FirewallPolicy;
import com.bocloud.ims.entity.resource.FirewallRule;

import java.util.List;

/**
 * 防火墙策略service接口
 *
 * @author wangyu
 * @version 1.0
 * @since 2017年8月31日
 */
public interface FirewallPolicyService {

    /**
     * 查询防火墙策略列表
     *
     * @param pager
     * @param context
     * @return
     */
    BocloudResult<GridBean<FirewallPolicy>> list(Pager pager, RequestContext context);

    /**
     * 创建防火墙策略
     *
     * @param policy
     * @param context
     * @return
     */
    BocloudResult<FirewallPolicy> create(FirewallPolicy policy, RequestContext context);

    /**
     * 修改防火墙策略
     *
     * @param bean
     * @param userId
     * @return
     */
    BocloudResult<FirewallPolicy> modify(FirewallPolicy bean, Long userId);

    /**
     * 查询防火墙策略信息
     *
     * @param id
     * @return
     */
    BocloudResult<FirewallPolicy> detail(Long id);

    /**
     * 删除防火墙策略
     *
     * @param id
     * @param context
     * @return
     */
    BocloudResult remove(Long id, RequestContext context);

    /**
     * 防火墙策略插入规则时指定在某条规则之前插入，或指定在某条规则之后插入，如果二者均被指定，前者优先级更高
     *
     * @param bean
     * @param userId
     * @return
     */
    BocloudResult insertRule(FirewallPolicy bean, Long userId);

    /**
     * 从策略中批量移除规则
     *
     * @param policy
     * @param userId
     * @return
     */
    BocloudResult removeRule(FirewallPolicy policy, Long userId);

    /**
     * 查询云平台未绑定策略的规则
     *
     * @param vendorId
     * @param tenantUuid
     * @param context
     * @return
     */
    BocloudResult<List<FirewallRule>> listRule(Long vendorId, String tenantUuid, RequestContext context);

    /**
     * 查询策略绑定的规则
     *
     * @param policyId
     * @return
     */
    BocloudResult<List<FirewallRule>> listRuleByPolicyId(Long policyId);

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

    BocloudResult condition(String condition, RequestContext context);

}
