package com.cm.plugin.map.service;

import com.cm.common.exception.RemoveException;
import com.cm.common.exception.SearchException;
import com.cm.common.pojo.ListPage;
import com.cm.common.result.SuccessResultList;
import com.cm.plugin.map.pojo.dto.GridDTO;
import com.cm.plugin.map.pojo.dto.GridRelationDTO;
import com.cm.plugin.map.pojo.vo.GridPointVO;
import com.cm.plugin.map.pojo.vo.GridVO;

import java.util.List;

/**
 * When you feel like quitting. Think about why you started
 * 当你想要放弃的时候，想想当初你为何开始
 *
 * @ClassName: IGridService
 * @Description: 网格业务
 * @Author: WangGeng
 * @Date: 2020/10/21 11:14
 * @Version: 1.0
 **/
public interface IGridService {

    /**
     * 保存网格并返回ID
     *
     * @param gridVO
     * @return
     * @throws Exception
     */
    void saveGrid(GridVO gridVO) throws Exception;

    /**
     * 更新网格数组
     *
     * @param gridId     网格ID
     * @param pointArray 点数组
     * @throws Exception
     */
    void updateGridPointArrayByGridId(String gridId, List<GridPointVO> pointArray) throws Exception;

    /**
     * 删除网格
     *
     * @param relationId 关联关系
     * @throws RemoveException
     */
    void deleteGridByRelationId(String relationId) throws RemoveException;

    /**
     * 删除网格
     *
     * @param gridIds 网格ID列表
     * @throws SearchException
     */
    void deleteGridByGridIds(List<String> gridIds) throws RemoveException;

    /**
     * 删除空网格（没有节点的网格）
     *
     * @param deleteGridIds
     */
    void deleteEmptyGrid(List<String> gridIds);

    /**
     * 删除网格
     *
     * @param gridId
     * @param relationId
     * @throws RemoveException
     */
    void deleteGridRelation(String gridId, String relationId) throws RemoveException;

    /**
     * 获取网格关系列表
     *
     * @param relationId 关联ID
     * @return
     * @throws SearchException
     */
    List<GridRelationDTO> listGridRelationByRelationId(String relationId) throws SearchException;

    /**
     * 获取网格关系列表
     *
     * @param relationIds 关联ID列表
     * @return
     * @throws SearchException
     */
    List<GridRelationDTO> listGridRelationByRelationIds(List<String> relationIds) throws SearchException;

    /**
     * 获取网格关系列表
     *
     * @param gridId 网格ID
     * @return
     * @throws SearchException
     */
    List<GridRelationDTO> listGridRelationByGridId(String gridId) throws SearchException;

    /**
     * 获取网格关系列表
     *
     * @param gridIds 网格ID列表
     * @return
     * @throws SearchException
     */
    List<GridRelationDTO> listGridRelationByGridIds(List<String> gridIds) throws SearchException;

    /**
     * 获取网格列表
     *
     * @param relationId 关联ID
     * @return
     * @throws SearchException
     */
    List<GridDTO> listGridByRelationId(String relationId) throws SearchException;

    /**
     * 获取网格列表
     *
     * @param relationIds 关联ID列表
     * @return
     * @throws SearchException
     */
    List<GridDTO> listGridGroupByRelationIds(List<String> relationIds) throws SearchException;

    /**
     * 获取全部网格列表
     *
     * @param relationIds
     * @return
     * @throws SearchException
     */
    List<GridDTO> listGridByRelationIds(List<String> relationIds) throws SearchException;

    /**
     * 获取网格分页列表
     *
     * @param relationIds
     * @return
     */
    SuccessResultList<List<GridDTO>> listPageGridByRelationIds(ListPage page, List<String> relationIds);


}
