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

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.form.DynamicConfigFormDTO;
import com.cm.common.plugin.pojo.vos.dynamic.config.form.DynamicConfigFormVO;
import com.cm.common.plugin.pojo.vos.dynamic.config.form.FieldShowVO;
import com.cm.common.pojo.ListPage;
import com.cm.common.result.SuccessResult;
import com.cm.common.result.SuccessResultList;

import java.util.List;
import java.util.Map;

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

    /**
     * 表单新增
     *
     * @param dynamicConfigFormVO
     * @return
     * @throws Exception
     */
    SuccessResult saveForm(DynamicConfigFormVO dynamicConfigFormVO) throws Exception;

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

    /**
     * 表单修改
     *
     * @param id
     * @param dynamicConfigFormVO
     * @return
     * @throws Exception
     */
    SuccessResult updateForm(String id, DynamicConfigFormVO dynamicConfigFormVO) throws Exception;

    /**
     * 修改表单中的表名
     *
     * @param newTableName
     * @param oldTableName
     * @throws UpdateException
     */
    void updateFormTableName(String newTableName, String oldTableName) throws UpdateException;

    /**
     * 字段列表显示修改
     *
     * @param id
     * @param fieldShowVO
     * @return
     * @throws UpdateException
     */
    SuccessResult updateFieldListShow(String id, FieldShowVO fieldShowVO) throws UpdateException;

    /**
     * 字段表单显示修改
     *
     * @param id
     * @param fieldShowVO
     * @return
     * @throws UpdateException
     */
    SuccessResult updateFieldFormShow(String id, FieldShowVO fieldShowVO) throws UpdateException;

    /**
     * 表单详情
     *
     * @param id
     * @return
     * @throws SearchException
     */
    DynamicConfigFormDTO getFormById(String id) throws SearchException;

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

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

}
