package com.cm.common.plugin.service.dynamic.config;

import com.cm.common.exception.RemoveException;
import com.cm.common.exception.SearchException;
import com.cm.common.exception.UpdateException;
import com.cm.common.plugin.pojo.dtos.dynamic.config.DynamicConfigTableDTO;
import com.cm.common.plugin.pojo.vos.dynamic.config.DynamicConfigTableVO;
import com.cm.common.plugin.pojo.vos.dynamic.config.EmptyProjectVO;
import com.cm.common.pojo.ListPage;
import com.cm.common.result.SuccessResult;
import com.cm.common.result.SuccessResultList;

import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;

/**
 * When you feel like quitting. Think about why you started
 * 当你想要放弃的时候，想想当初你为何开始
 *
 * @ClassName: IDynamicConfigTableService
 * @Description: 动态配置-表
 * @Author: WangGeng
 * @Date: 2019/12/7 6:10 下午
 * @Version: 1.0
 **/
public interface IDynamicConfigTableService {

    /**
     * 表新增
     *
     * @param dynamicConfigTableVO
     * @return
     * @throws Exception
     */
    SuccessResult saveTable(DynamicConfigTableVO dynamicConfigTableVO) throws Exception;

    /**
     * 建动态表
     *
     * @param id
     * @return
     * @throws SearchException
     * @throws UpdateException
     */
    SuccessResult saveDynamicTable(String id) throws SearchException, UpdateException;

    /**
     * 表删除
     *
     * @param ids
     * @return
     * @throws RemoveException
     */
    SuccessResult removeTable(String ids) throws RemoveException;

    /**
     * 表修改
     *
     * @param id
     * @param dynamicConfigTableVO
     * @return
     * @throws Exception
     */
    SuccessResult updateTable(String id, DynamicConfigTableVO dynamicConfigTableVO) throws Exception;

    /**
     * 修改动态表
     *
     * @param id
     * @return
     * @throws SearchException
     * @throws UpdateException
     */
    SuccessResult updateDynamicTable(String id) throws Exception;

    /**
     * 表详情
     *
     * @param id
     * @return
     * @throws SearchException
     */
    DynamicConfigTableDTO getTableById(String id) throws SearchException;

    /**
     * 表全部列表
     *
     * @param params
     * @return
     * @throws SearchException
     */
    List<DynamicConfigTableDTO> listTable(Map<String, Object> params) throws SearchException;

    /**
     * 分页表列表
     *
     * @param page
     * @return
     * @throws SearchException
     */
    SuccessResultList<List<DynamicConfigTableDTO>> listPageTable(ListPage page) throws SearchException;

    /**
     * 下载静态化代码
     *
     * @param id
     * @param basePackage
     * @param context
     * @param response
     * @throws SearchException
     */
    void getStaticCode(String id, String basePackage, String context, HttpServletResponse response) throws Exception;

    /**
     * 下载空项目
     *
     * @param emptyProjectVO
     * @param response
     * @throws Exception
     */
    void getEmptyProject(EmptyProjectVO emptyProjectVO, HttpServletResponse response) throws Exception;

    /**
     * 下载静态资源包
     *
     * @param response
     */
    void getAssetsZip(HttpServletResponse response);
}
