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

import com.gic.haoban.manage.api.dto.ExternalClerkRelatedDTO;
import com.gic.haoban.manage.api.dto.MemberUnionidRelatedDTO;
import com.gic.haoban.manage.service.entity.TabHaobanExternalClerkRelated;
import org.apache.ibatis.annotations.Param;

import java.util.Collection;
import java.util.List;

public interface ExternalClerkRelatedService {

	void insert(TabHaobanExternalClerkRelated related);

	/**
	 * 删除好友
	 * @param dto
	 */
	void delByUserIdAndExternalUserId(MemberUnionidRelatedDTO dto);

	/**
	 * 删除会员与导购的关联关系
	 *
	 * @param wxEnterpriseId
	 * @param wxUserId
	 * @param externalUserids
	 */
	void delByUserIdAndExternalUserIdBatch(String wxEnterpriseId, String staffId, List<String> externalUserids);

    void delByStoreIdAndStaffId(String storeId, String staffId);

	void delByStoreIds(Collection<String> storeIds);

	void cleanStaffRelated(String wxEnterpriseId, List<String> staffIds);

	void update(TabHaobanExternalClerkRelated exsitDTO);

	List<TabHaobanExternalClerkRelated> listByExternalUseridAndWxUserId(String externalUserid, String staffId);

	List<TabHaobanExternalClerkRelated> listByExTernalUseridAndWxUserIdAllStatus(String wxEnterpriseId, String externalUserid, String wxUserId);

	ExternalClerkRelatedDTO getByMemberId(String staffId, String memberId);

	/**
	 * 根据unionid获取外部联系人的绑定导购
	 *
	 * @param enterpriseId
	 * @param unionId
	 * @return
	 */
	List<TabHaobanExternalClerkRelated> listExternalByUnionId(String enterpriseId, String unionId);

	/**
	 * 根据externalUserid获取外部联系人的绑定导购
	 *
	 * @param wxEnterpriseId
	 * @param externalUserid
	 * @return
	 */
	List<TabHaobanExternalClerkRelated> listExternalByExternalUserid(String wxEnterpriseId, String externalUserid);

	/**
	 * 校验会员id与unionid的对应 主要修复会员合并是没有更新会老的情况
	 *
	 * @param memberId
	 * @param unionId
	 * @return
	 */
	String checkAndUpdateMemberByUnonId(String enterpriseId, String memberId, String unionId);

    void repairExternalUserId(String wxEnterpriseId);

	/**
	 * 获取所有的好友会员id
	 *
	 * @param storeId 存储id
	 * @param staffId 员工id
	 * @return {@link List}<{@link String}>
	 */
	List<String> getByStoreIdAndStaffId(String storeId,String staffId);


	int getCountByMemberId(String memberId);
	
	void updateClerkInfo(String staffId, String oldClerkId, String newClerkId);

	/**
	 * 外部联系人
	 * @param staffId
	 * @return
	 */
	List<String> queryExternalRelatedWithStaffId(String staffId);

	/***
	 * 查询会员与导购的关系
	 * @param clerkId
	 * @param memberIds
	 * @return
	 */
	List<TabHaobanExternalClerkRelated> queryClerkMemberRelations(String staffId, List<String> memberIds);

	/**
	 * 查询企业微信下面,所有外部联系人是null的成员
	 * @param wxEnterpriseId
	 * @param enterpriseIdList
	 * @return
	 */
	List<String> listByWxEnterpriseId(String wxEnterpriseId,List<String> enterpriseIdList);

	/**
	 * 删除企业微信下面,所有外部联系人是null的成员
	 * @param wxEnterpriseId
	 * @param enterpriseIdList
	 */
	void deleteByWxEnterpriseId(String wxEnterpriseId,List<String> enterpriseIdList);
	List<TabHaobanExternalClerkRelated> getAddTimeByMemberId(String memberId, String enterpriseId,String flag);

	/**
	 * 根据外部联系人id查询memberId
	 * @param wxEnterpriseId
	 * @param externalUserId
	 * @return
	 */
	String getMemberIdByExternalId(String wxEnterpriseId,String externalUserId);


	/**
	 * 获取好友数据
	 * @param memberId
	 * @param storeId
	 * @param clerkId
	 * @return
	 */
	int getFriendNum(String memberId , String storeId , String clerkId) ;

}
