package com.fs.his.mapper;

import com.fs.company.domain.CompanyUser;
import com.fs.his.domain.FsAiWorkflow;
import com.fs.his.domain.FsAiWorkflowNode;
import com.fs.his.vo.FsAiWorkflowNodeVoiceVo;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * AI工作流Mapper接口
 *
 * @author fs
 * @date 2026-01-06
 */
public interface FsAiWorkflowMapper {

    FsAiWorkflow selectFsAiWorkflowById(Long workflowId);

    List<FsAiWorkflow> selectFsAiWorkflowList(FsAiWorkflow fsAiWorkflow);

    /**
     * 根据企业用户ID查询工作流列表
     */
    List<FsAiWorkflow> selectFsAiWorkflowByCompanyUserId(Long companyUserId);

    int insertFsAiWorkflow(FsAiWorkflow fsAiWorkflow);

    int updateFsAiWorkflow(FsAiWorkflow fsAiWorkflow);

    int deleteFsAiWorkflowById(Long workflowId);

    int deleteFsAiWorkflowByIds(Long[] workflowIds);

    int selectFsAiWorkflowCountByCompanyUserId(Long companyUserId);

    int updateWorkflowBindCompanyUser(@Param("workflowId") Long workflowId, @Param("companyUserId") Long companyUserId);

    List<CompanyUser> getBindCompanyUserByWorkflowId(Long workflowId);

    int insertFsAiWorkflowCompanyUser(@Param("workflowId")Long workflowId,@Param("companyUserIds") List<Long> companyUserIds);

    int insertAiWorkflowCompanyUserVoice(@Param("workflowId") Long workflowId, @Param("companyUserIds") List<Long> companyUserIds, @Param("fsAiWorkflowNodes") List<FsAiWorkflowNode> fsAiWorkflowNodes);

    List<String> selectFsAiWorkflowNodeByWorkflowId(@Param("workflowId") Long workflowId);

    List<Long> selectWorkflowCompanyUserByWfId(@Param("workflowId") Long workflowId);

    void deleteAiWorkflowCompanyUserVoice(@Param("workflowId") Long workflowId,@Param("nodeKeyDel") List<String> nodeKeyDel);

    void addAiWorkflowCompanyUserVoice(@Param("workflowId") Long workflowId, @Param("companyUserIds") List<Long> companyUserIds, @Param("nodeKeyAdd") List<String> nodeKeyAdd);

    List<FsAiWorkflowNodeVoiceVo> getMyWorkflowNodes(@Param("companyUserId") Long companyUserId);
}
