package com.goafanti.common.constant;

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

import com.goafanti.common.utils.StringUtils;

public class PageConstants {
	static final Map<String,String> WEB_DEMAND_PAGES = new HashMap<String, String>();
	static final Map<String,String> APP_DEMAND_PAGES = new HashMap<String, String>();
	static final Map<String,String> WEB_ACHIEVEMENT_PAGES = new HashMap<String, String>();
	static final Map<String,String> APP_ACHIEVEMENT_PAGES = new HashMap<String, String>();
	static final Map<String, String>WEB_NEWS_PAGES=new HashMap<String,String>();
	static final Map<String, String>APP_NEWS_PAGES=new HashMap<>();
	static final Map<String, String>WEB_POLICY_PAGES=new HashMap<>();
	static final Map<String, String>APP_POLICY_PAGES=new HashMap<>();
	public static final int WEB_PLATFORM = 0;
	public static final int APP_PLATFORM = 1;
	public static final String DEFAULT_DOMAIN = "jishutao.com";
	public static final int DEFAULT_TOP_NUMBER = 9999999;
	public static final int DEFAULT_SHOW_NUMBER = 9999999;
	static{
		WEB_DEMAND_PAGES.put("web_index", "网站首页");
		WEB_DEMAND_PAGES.put("web_demand_main", "网站需求页主页");
		WEB_DEMAND_PAGES.put("web_demand_list", "网站需求列表页");
		WEB_DEMAND_PAGES.put("web_demand_trading_index", "需求知识产权交易页面");
		APP_DEMAND_PAGES.put("app_demand_trading_index", "app需求交易页面");
		APP_DEMAND_PAGES.put("app_index", "APP首页");
		APP_DEMAND_PAGES.put("app_demand_main", "APP需求页主页");
		APP_DEMAND_PAGES.put("app_demand_list", "APP需求列表页");	
		WEB_ACHIEVEMENT_PAGES.put("web_index", "网站首页");
		WEB_ACHIEVEMENT_PAGES.put("web_achievement_main", "网站成果主页");
		WEB_ACHIEVEMENT_PAGES.put("web_achievement_list", "网站成果列表页");
		WEB_ACHIEVEMENT_PAGES.put("web_achievement_trading_index", "成果知识产权交易页面");
		APP_ACHIEVEMENT_PAGES.put("app_achievement_trading_index", "app成果知识产权交易页面");
		APP_ACHIEVEMENT_PAGES.put("app_index", "网站首页");
		APP_ACHIEVEMENT_PAGES.put("app_achievement_main", "APP成果主页");
		APP_ACHIEVEMENT_PAGES.put("app_achievement_list", "APP成果列表页");
		WEB_NEWS_PAGES.put("web_index", "网站首页");
		WEB_NEWS_PAGES.put("web_tech_service_index", "网站科技服务首页");
		APP_NEWS_PAGES.put("app_policy_index", "APP政策首页");
		APP_NEWS_PAGES.put("app_tech_service_index", "APP科技服务首页");
		WEB_POLICY_PAGES.put("web_index", "网站首页");
		WEB_POLICY_PAGES.put("web_policy_main", "网站政策主页");
		WEB_POLICY_PAGES.put("web_tech_service_index","网站科技服务首页");
		APP_POLICY_PAGES.put("app_index", "APP首页");
		APP_POLICY_PAGES.put("app_policy_main", "APP政策主页");
		APP_POLICY_PAGES.put("app_tech_service_index", "APP科技服务首页");
		APP_POLICY_PAGES.put("web_community", "网站社区首页");
	}

	public static boolean containPage(String page,Map<String,String> matchPages){
		if(StringUtils.isBlank(page)) return false;
		return matchPages.keySet().contains(page);
	}
	
	public static void putDemand(String[] pages,List<String> webPages,List<String> appPages){
		if(pages == null || pages.length <= 0) return;
		for(String page : pages){
			if(containPage(page,WEB_DEMAND_PAGES)){
				webPages.add(page);
			}
			if(containPage(page,APP_DEMAND_PAGES)){
				appPages.add(page);
			}
		}
	}
	
	public static void putAchievement(String[] pages,List<String> webPages,List<String> appPages){
		if(pages == null || pages.length <= 0) return;
		for(String page : pages){
			if(containPage(page,WEB_ACHIEVEMENT_PAGES)){
				webPages.add(page);
			}
			if(containPage(page,APP_ACHIEVEMENT_PAGES)){
				appPages.add(page);
			}
		}
	}
	
	public static void putNews(String[] pages,List<String> webPages,List<String> appPages){
		if(pages == null || pages.length <= 0) return;
		for(String page : pages){
			if(containPage(page,WEB_NEWS_PAGES)){
				webPages.add(page);
			}
			if(containPage(page,APP_NEWS_PAGES)){
				appPages.add(page);
			}
		}
	}
	
	public static void putPolicy(String[] pages,List<String> webPages,List<String> appPages){
		if(pages == null || pages.length <= 0) return;
		for(String page : pages){
			if(containPage(page,WEB_POLICY_PAGES)){
				webPages.add(page);
			}
			if(containPage(page,APP_POLICY_PAGES)){
				appPages.add(page);
			}
		}
	}
}
