/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.manager.service;

import org.springblade.core.mp.base.BaseService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.tool.api.R;
import org.springblade.manager.dto.FormElementDTO;
import org.springblade.manager.dto.WbsTreeContractDTO;
import org.springblade.manager.dto.WbsTreeDTO2;
import org.springblade.manager.entity.WbsFormElement;
import org.springblade.manager.entity.WbsTree;
import org.springblade.manager.vo.*;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.util.List;

/**
 * 服务类
 *
 * @author liuyc
 * @since 2022-04-25
 */
public interface IWbsTreeService extends BaseService<WbsTree> {

    /**
     * 自定义分页
     *
     * @param page
     * @param wbsTree
     * @return
     */
    IPage<WbsTreeVO> selectWbsTreePage(IPage<WbsTreeVO> page, WbsTreeVO wbsTree);

    /**
     * 懒加载树形结构
     *
     * @param tenantId
     * @param parentId
     * @return
     */
    List<WbsTreeVO> lazyTree(String wbsId, String tenantId, Long parentId);

    /**
     * 树形结构
     *
     * @param tenantId
     * @return
     */
    List<WbsTreeVO> tree(String wbsId, String tenantId, String type);

    /**
     * 提交
     *
     * @param dept
     * @return
     */
    boolean submit(WbsTree dept);

    /**
     * 表单查询（根据节点ID查询当前表单）
     */
    List<WbsNodeTableVO> selectByNodeTable(String id);

    /**
     * 删除表单
     */
    boolean removeTableById(String id);

    /**
     * 表单元素列表
     */
    List<WbsFormElementVO> selectFormElements(String id);

    String importWbsTree(MultipartFile excelFile, WbsTree wbsTreeFu, WbsTree wbsTree1) throws IOException;

    String submitWbsTreeInProject(WbsTreeContractDTO pawDTO);

    WbsTreeAllListVO findWbsTreeList(Integer type);

    R saveFormElement(FormElementDTO formElementDTO);

    int deleteBatchByProjectNodeId(Long projectNodeId);

    WbsTree selectGenNodeByWbsId(Long id);

    List<WbsTree> findByWbsTreeNode(String ids);

    List<SaveUserInfoByProjectVO2> findProjectAndContractList(Long userId);

    List<WbsTreeDTO2> findWbsTreeSameLevel(String parentId);

    boolean wbsTreeSort(List<WbsTreeDTO2> wbsTreeList);

    int deleteLogicByWbsId(String ids);

    List<WbsTree> selectByWbsId(String id);

    boolean submit2(FormElementDTO formElementDTO);

    boolean importWbsTreeTableAndForm(MultipartFile excelFile, WbsTree wbsTree);

}
