package com.palmnest.service.estateserve;

import com.palmnest.application.bean.Page;
import com.palmnest.application.bean.Pagenation;
import com.palmnest.application.dto.output.WxPublicnoDto;
import com.palmnest.model.estateserve.WxPublicno;
import com.palmnest.model.estateserve.WxPublicnoOrgRelation;
import com.palmnest.service.GenericManager;
import org.hibernate.criterion.Criterion;

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

/**
 * 微信公众号信息维护
 *
 * @author yubing
 * @since 2017-1-13
 */
public interface PublicNoManager extends GenericManager<Object, Integer> {

	/**
	 * 默认分页
	 *
	 * @param pageNo     页码
	 * @param filterList 过滤集合
	 * @return
	 */
	public Pagenation<WxPublicno> queryPublicNo(int pageNo, List<Criterion> filterList);

	/**
	 * 分页查询公众号信息
	 *
	 * @param pageNo
	 * @param whereSQL
	 * @return
	 */
	public Page queryPublicNoPage(int pageNo, String whereSQL);

	/**
	 * 查询微信公众号信息
	 *
	 * @param id
	 * @return
	 */
	public WxPublicno getWxPublicnoById(int id);

	/**
	 * 查询微信公众号
	 *
	 * @param developId 公众号原始ID
	 * @return
	 */
	public WxPublicno getByDevelopId(String developId);

	/**
	 * 保存或者更新微信公众号
	 *
	 * @param publicno
	 * @return
	 */
	public String saveOrUpdatePublicno(WxPublicno publicno, String[] organizationIds);

	/**
	 * 查询所有公众号，不分权限
	 *
	 * @return
	 */
	public List<WxPublicno> getAllWxPublicno();

	/**
	 * 查询对应项目权限的微信公众号
	 *
	 * @param organizationIdsStr
	 * @return List<Map < String, Object>> publicNoId,developId,name
	 */
	public List<Map<String, Object>> getAllWxPublicno(String organizationIdsStr);

	/**
	 * 查询微信公众号-项目组织关联
	 *
	 * @param publicnoId
	 * @return
	 */
	public List<WxPublicnoOrgRelation> getWxPublicnoOrgRelations(int publicnoId);

	/**
	 * 查询微信公众号-项目组织关联
	 *
	 * @param publicnoId
	 * @return
	 */
	public List<Map<String, Object>> getWxPubOrgRelations(int publicnoId);

	/**
	 * 查询微信公众号-项目组织关联
	 *
	 * @param developId
	 * @return ID, organizationName
	 */
	public List<Map<String, Object>> getWxPublicnoOrgRelations(String developId);

	/**
	 * 查询项目分组信息（根据城市名称）
	 *
	 * @param relationOrgs
	 * @return TODO 后续根据定位，自动推荐最近的地点项目add by yubing
	 */
	public Map<String, List<Map<String, Object>>> getWxPublicnoOrgRelationsGroupByCity(List<Map<String, Object>> relationOrgs);

	public WxPublicno getByApp(String appId, String appSecret);

	public List<WxPublicno> getAllWxPublicnoWithOuterUrl();

	public WxPublicno getByOrgClientCode(String clientCode);

	public WxPublicnoDto convertToDto(WxPublicno wxPublicno);
}
