package com.gic.haoban.manage.service.service;

import com.gic.api.base.commons.Page;
import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.manage.api.dto.StaffClerkRelationDTO;
import com.gic.haoban.manage.service.entity.MemberClerkChatConfig;

import java.util.List;
import java.util.Set;

public interface StaffClerkRelationService {

    List<StaffClerkRelationDTO> listBindCode(String wxEnterpriseId,String enterpriseId, Set<String> clerkCodeList);

    List<StaffClerkRelationDTO> listBindCodeByStaffId(List<String> enterpriseIdList, String staffId);
  
    boolean delBind(String clerkId, String optStaffId, int channelCode , String newClerkId , String wxEnterpriseId);

    /**
     * 解绑-删除绑定（门店级别）
     *
     * @param wxEnterpriseId 可以不传
     * @param storeIds
     * @return
     */
    boolean delBindByStoreIds(String wxEnterpriseId, Set<String> storeIds, String optStaffId, int channelCode);

    /**
     * 绑定
     *
     * @param dto
     * @return
     */
    String bind(StaffClerkRelationDTO dto, String optStaffId, int channelCode);

    /**
     * 查询绑定根据clerkId
     *
     * @param clerkId
     * @param wxEnterpriseId
     * @return
     */
    StaffClerkRelationDTO getBindByClerkId(String clerkId, String wxEnterpriseId);

    StaffClerkRelationDTO getByCodeAndEnterpriseId(String clerkCode, String enterpriseId);
    StaffClerkRelationDTO getStaffClerkRelationDTO(String clerkCode, String enterpriseId);

    String insert(StaffClerkRelationDTO staffClerkRelation);

    int cleanStaffClerk(String wxEnterpriseId, List<String> staffIds);

    StaffClerkRelationDTO getOneBindByStoreId(String staffId, String storeId);

    StaffClerkRelationDTO getByClerkId(String clerkId);

    StaffClerkRelationDTO getByClerkId(String clerkId,String wxEnterpriseId);

    List<StaffClerkRelationDTO> listByClerkIds(List<String> clerkList);

    List<StaffClerkRelationDTO> listByStaffId(String wxEnterpriseId, String staffId);

    List<StaffClerkRelationDTO> listByStaffId(String wxEnterpriseId, String staffId, List<String> storeIdList);

    /**
     * 保存
     *
     * @param memberClerkChatConfig
     */
    void saveChatConfig(MemberClerkChatConfig memberClerkChatConfig);

    /**
     * @param staffId
     * @param memberId
     * @return
     */
    MemberClerkChatConfig getChatConfig(String staffId, String memberId);

    /**
     * 根据企业查询
     *
     * @param wxEnterpriseId
     * @return
     */
    List<String> listByWxEnterpriseId(String wxEnterpriseId);

    Page<StaffClerkRelationDTO> pageByWxEnterpriseId(String wxEnterpriseId, BasePageInfo pageInfo);

    /**
     * 根据门店获取门店的绑定列表
     *
     * @param wxEnterpriseId
     * @param storeId
     * @return
     */
    List<StaffClerkRelationDTO> listBindByStoreId(String wxEnterpriseId, String storeId);

    /**
     * 查询门店列表
     *
     * @param enterpriseId
     * @return
     */
    List<StaffClerkRelationDTO> listBindStoreIdByEnterpriseId(String enterpriseId);

    /**
     * 查询有关联的员工id列表
     *
     * @param staffIdList 员工id列表
     * @return {@link Set<String>}
     * @author: YongEn
     */
    List<String> listRelationsStaffId(Set<String> staffIdList);


    /**
     * 根据导购查询wxuserid
     *
     * @param clerkList      职员名单
     * @param wxEnterpriseId wx企业标识
     * @return {@link List }<{@link String }>
     * @author mozhu
     * @date 2022-07-07 15:25:55
     */
    List<String> listWxUserIdByClerkIds(List<String> clerkList, String wxEnterpriseId);

    /**
     * 通过userid 查询id
     *
     * @param wxUserIds      wx开放用户id
     * @param wxEnterpriseId wx企业标识
     * @param enterpriseId   企业标识
     * @return {@link List }<{@link StaffClerkRelationDTO }>
     * @author mozhu
     * @date 2022-08-08 22:01:59
     */
    List<StaffClerkRelationDTO> listIdsByWxUserIds(List<String> wxUserIds, String wxEnterpriseId, String enterpriseId);


    /**
     * 通过userid 不在范围内 查询id
     *
     * @param wxUserIds      wx开放用户id
     * @param wxEnterpriseId wx企业标识
     * @param enterpriseId   企业标识
     * @return {@link List }<{@link StaffClerkRelationDTO }>
     * @author mozhu
     * @date 2022-08-08 21:51:52
     */
    List<StaffClerkRelationDTO> listIdsByNotInWxUserIds(List<String> wxUserIds, String wxEnterpriseId, String enterpriseId);


    /**
     * 更新联系我状态
     *
     * @param openConcatFlag       打开concat国旗
     * @param staffClerkRelationId 员工职员关系id
     * @return int
     * @author mozhu
     * @date 2022-07-07 15:34:27
     */
    int updateOpenConcatFlagById(Integer openConcatFlag, String staffClerkRelationId);

    /**
     * 是否绑定过
     *
     * @param enterpriseId 企业标识
     * @param staffId      员工id
     * @return boolean
     */
    boolean getBindByStaffIdAndEnterpriseId(String enterpriseId, String staffId);

    List<StaffClerkRelationDTO> listManageBindByStaffId(String staffId);

    /**
     * 获取企业下所有关联关系
     * @param enterpriseId
     * @return
     */
    List<StaffClerkRelationDTO> listAllRelationDtosByEnterpriseId(String enterpriseId);
}
