/**
 * 
 */
package com.tcl.factory.utils;

import android.content.Context;
import android.util.Log;

import com.tcl.tvmanager.TvManager;

/**
 * function:
 * @author wangst
 * @Date 
 */
public class ConfigItem {
	
	private static final String TAG = "ConfigItem";
	
	public static final String CONFIG_CN_PROJECT = "ro.sita.model.Factory.isCnPrj";                     // �Ƿ�Ϊ�й�
	public static final String CONFIG_WARMUP_ABLE = "ro.sita.model.Factory.isWarmUpAble";               // �ϻ�ѡ���Ƿ��ѡ
	public static final String CONFIG_WARMUP_QUIT = "ro.sita.model.Factory.isWarmupQuitApp";            // �ϻ����Ƿ��˳�����Ӧ��
	public static final String CONFIG_DID_TEST_AREA = "ro.sita.model.Factory.DeviceIDTestArea";         // device id test server area
	public static final String CONFIG_SOURCE_LIST = "ro.sita.model.Factory.InputSourceList";
	public static final String CONFIG_PICTURE_PRESET_LIST = "ro.sita.model.Factory.PictureModePreset";
	public static final String CONFIG_SOUND_MODE_LIST = "ro.sita.model.Factory.SoundModePreset";	

	public static final String CONFIG_WHITEBALANCE = "ro.sita.model.Factory.isWhiteBalanceChangeAble";  // ��ƽ��
	public static final String CONFIG_GAMMA = "ro.sita.model.Factory.Gamma";                              // ��ƽ�����Ƿ���ʾGAMA��
	public static final String CONFIG_POWERMODE = "ro.sita.model.Factory.isPowerModeSelectAble";         // �ϵ�ģʽ�Ƿ��ѡ
	
	public static final String CONFIG_YN_CHANNEL = "ro.sita.model.Factory.hasYNPresetChannel";           // Ƶ��Ԥ���Ƿ����Խ��
	public static final String CONFIG_TH_CHANNEL = "ro.sita.model.Factory.hasTHPresetChannel";           // Ƶ��Ԥ���Ƿ����̩��
	public static final String CONFIG_PH_CHANNEL = "ro.sita.model.Factory.hasPHPresetChannel";           // Ƶ��Ԥ���Ƿ�������ɱ�
	public static final String CONFIG_IN_CHANNEL = "ro.sita.model.Factory.hasINPresetChannel";           // Ƶ��Ԥ���Ƿ����ӡ��������
	public static final String CONFIG_RU_CHANNEL = "ro.sita.model.Factory.hasRUPresetChannel";           // Ƶ��Ԥ���Ƿ��������˹
	public static final String CONFIG_CVT_CHANNEL = "ro.sita.model.Factory.hasCVTPresetChannel";           // Ƶ��Ԥ���Ƿ����CVT
	public static final String CONFIG_TNS_CHANNEL = "ro.sita.model.Factory.hasTNSPresetChannel";           // Ƶ��Ԥ���Ƿ����TNS����Ƶ��
	public static final String CONFIG_EG_CHANNEL = "ro.sita.model.Factory.hasEGPresetChannel";           // Ƶ��Ԥ���Ƿ������������Ƶ��
	public static final String CONFIG_IND_CHANNEL = "ro.sita.model.Factory.hasINDPresetChannel";           // Ƶ��Ԥ���Ƿ����ӡ�ȹ���Ƶ��
	public static final String CONFIG_COL_CHANNEL = "ro.sita.model.Factory.hasCOLPresetChannel";   
	public static final String CONFIG_CFG_VER = "ro.sita.cfg.ver";// Ƶ��Ԥ���Ƿ�������ױ��ǹ���Ƶ��


	/**
	 * ��ȡ���������Ĭ��Ϊ�棬��������Ϊfalse
	 * @param context
	 * @param key  �������ֵ
	 * @return true/false
	 * @author 
	 * @Date
	 */
	public static boolean isShowItem(Context context, String key) {
		TvManager tvManager = TvManager.getInstance(context);
		Log.i(TAG, "!!!!!!!!!isShowItem key:" + key);
		String propertyValue = tvManager.getProperty().get(key, "null");
		Log.i(TAG, "propertyValue:" + propertyValue);
		if(null != propertyValue){
			if (propertyValue.equalsIgnoreCase("true")) {
				Log.i(TAG, "propertyValue value:" + propertyValue);
				return true;
			} else if (propertyValue.equalsIgnoreCase("false")) {
				Log.i(TAG, "propertyValue value:" + propertyValue);
				return false;
			}
		}
		return true;
	}
	
	/**
	 * ��ȡ���������Ĭ��Ϊfalse����������Ϊtrue
	 * @param tvManager
	 * @param key
	 * @return
	 * @author 
	 * @Date
	 */
	public static boolean showDefaultFalse(Context context, String key) {
		TvManager tvManager = TvManager.getInstance(context);
		Log.i(TAG, "!!!!!!!!!isShowItem key:" + key);
		String propertyValue = tvManager.getProperty().get(key, "null");
		Log.i(TAG, "propertyValue:" + propertyValue);
		if(null != propertyValue){
			if (propertyValue.equalsIgnoreCase("true")) {
				Log.i(TAG, "propertyValue value:" + propertyValue);
				return true;
			}
		}
		return false;
	}

	/**
	 * ��ȡ���������Ĭ��Ϊnull
	 * @param tvManager
	 * @param key
	 * @return
	 * @author 
	 * @Date
	 */
	public static String GetConfigItem(Context context, String key) {
		TvManager tvManager = TvManager.getInstance(context);
		Log.i(TAG, "!!!!!!!!!GetConfigItem key:" + key);
		String propertyValue = tvManager.getProperty().get(key, "null");
		Log.i(TAG, "propertyValue:" + propertyValue);
		return propertyValue;
	}
	
	public static boolean isConfigV2(Context context) {
        TvManager tvManager = TvManager.getInstance(context);
        String propertyValue = tvManager.getProperty().get(ConfigItem.CONFIG_CFG_VER, "null");
        Log.d(TAG, "propertyValue:" + propertyValue);
        if (null != propertyValue) {
            if (propertyValue.equalsIgnoreCase("2")) {
                Log.d(TAG, "isConfigV2 true");
                return true;
            }
        }
        Log.d(TAG, "isConfigV2 false");
        return false;
    }
	
}
