using System;
using System.Configuration;
/**
  $Id: Constants.cs,v 1.33 2009/05/01 19:06:09 nli Exp $
  $Revision: 1.33 $
  $Date: 2009/05/01 19:06:09 $
  */
namespace edu.jhu.Cas.Util {
    public enum CJobsDBState {
        RUNNING,
        SUSPENDING,
        SUSPENDED,
        WAKING
    }
	public struct MENU{
		public const int HOME=0,QUERY=1,LOGIN=2,CREATE=3,FAQ=4,GUIDE=5,
			MYDB=6,JOBS=7,GROUPS=8,PROFILE=9,LOGOUT=10,OUTPUT=11,ADMIN=12,
			CHANGELOG=13,QUEUE=14,IMPORT=15,TOOLS=16;
	}
	public struct SYNC{
		public static string WITH = ConfigurationSettings.AppSettings["SYNC"];//casjobs.sdss.org/casjobs";
		public static int WAIT_MINUTES= 90;//int.Parse(ConfigurationSettings.AppSettings["WAIT_MINUTES"]);//casjobs.sdss.org/casjobs";
	}
	public struct QUERY_STATUS {
		public const int READY =0;	
		public const int STARTED=1;	
		public const int CANCEL_PENDING=2;	
		public const int CANCELED =3;	
		public const int FAILED=4;	
		public const int FINISHED=5;
	}
	public struct TABLE_STATUS{
		public const int PENDING = 0;
		public const int FINISHED = 1;
		public const int FAILED = 2;
	}
	public struct EMAIL {
		public const int ADMIN_ONLY = 0;	
		public const int ON_BATCH_FAILURE=1;	
		public const int ON_BATCH_COMPLETION=2;
		public const int ON_BATCH_FAILURE_OR_COMPLETION=3;
	}
	public struct ID {
		public static long SERVICE_ID = long.Parse(ConfigurationSettings.AppSettings["ServiceID"]!=null?
			ConfigurationSettings.AppSettings["ServiceID"]:"12345678");
		public static int QUERY_MEM_CAP = int.Parse(ConfigurationSettings.AppSettings["QueryMemCap"]!=null?
			ConfigurationSettings.AppSettings["QueryMemCap"]:"1")*1000*1000;
        public const int PUBLIC_GID = -1;		
		public static string SMTP = ConfigurationSettings.AppSettings["SMTP"];
		public static string MAIL_FROM= ConfigurationSettings.AppSettings["MAIL_FROM"];
		public static string MAIL_SUBJECT = ConfigurationSettings.AppSettings["MAIL_SUBJECT"];
	}
	public struct PRIVS{
		public static string SIGHT = "sight";
		public static string ADMIN = "admin";
	}
	public struct SYSTEM {
        public const int MAX_HTML_DATA_CHARS = 2000;
		public const string NULL = "null";
		public const int PREVIEW_ROWS = 0; 
		public const string TASKNAME = "__SYSTEM__";
		public const int VISIBLE= 1;
		public const int QUICK_VISIBLE = 5;
		public const int LONG_VISIBLE = 10;
		public const string DEFAULT_QUERY_NAME = "My Query";
		public const int COMMIT_AFTER = 200;
		public static long QUICK_EXTRACT_ROW_LIMIT = long.Parse(ConfigurationSettings.AppSettings["QUICK_EXTRACT_ROW_LIMIT"]==null?"-1":ConfigurationSettings.AppSettings["QUICK_EXTRACT_ROW_LIMIT"]);
		
		public const string QUERY_PREFIX = "SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED\n";
		public const long TICKWAIT = 100;//sets time between reader executes in short and long jobs
		public const char Q_SEP = '\u03a0';
        public static bool ENABLE_ASTRO = ConfigurationSettings.AppSettings["EnableAstro"] != null ?
            int.Parse(ConfigurationSettings.AppSettings["EnableAstro"]) == 1 : false;
        public static bool ENABLE_ALT_SOURCES = ConfigurationSettings.AppSettings["EnableAltSources"] != null ?
            int.Parse(ConfigurationSettings.AppSettings["EnableAltSources"]) == 1 : false;
		//public const string QUERY_PREFIX = ""; 
        public static string TEMP_DIR = ConfigurationSettings.AppSettings["TempDir"] != null && ConfigurationSettings.AppSettings["TempDir"] != "" ?
            ConfigurationSettings.AppSettings["TempDir"] : ".\\";
	}
	public struct VISIBILITY{
		public const int NOT_USER_VISIBLE = 1;
		public const int USER_VISIBLE = 0;
		public const int USER_HIDE = 2;
	}
	public struct WEB {
		public const string DATAGRID_ATTRIBUTES = "AlternatingItemStyle-BackColor=\"#101010\" ForeColor=\"#eeeeee\"";
		public const string HEADER_STYLE = "<HeaderStyle Font-Bold=\"True\" ForeColor=\"#eeeeee\" BackColor=\"black\"/>";
		public const string GROUP_ADMIN_COLOR = "teal";
		public const string PUBLISHED_TABLE_COLOR = "purple";
		public const string GROUP_TABLE_COLOR = "green";
	}
	public struct PLOT{
		public const int WIDTH = 800;
		public const int HEIGHT = 600;
		public const int ROW_LIMIT= 500;
		public const string APP_PATH = "\\\\skyservice\\skyservice\\CasOutput\\Plot\\";
		public const string WEB_PATH = "http://skyservice.pha.jhu.edu/CasOutput/";
	}
	public struct IMG{
		public const int WIDTH = 512;
		public const int HEIGHT = 512;
		public const double SCALE = .6;
	}
	public struct OUTPUT{
		public const string IMG_COLLECTION = "IMG_COLLECTION";
		public const string QUERY = "QUERY";
		public const string MONITOR= "MONITOR";
	}
	public struct VIEWJOBS{
		public const string TIME_SUBMIT = "TIME_SUBMIT";
		public const string POSITION = "POSITION";
		public const string STATUS = "STATUS";
		public const string TARGET = "TARGET";
		public const string NAME_LIKE = "namelike";
	}
	public struct OUT_LINKS{
		public const string SCHEMA_BROWSER = "http://skyserver.sdss.org/public/en/help/browser/browser.asp";
		public const string SDSS_SQL_TUTORIAL = "http://skyserver.sdss.org/public/en/help/docs/sql_help.asp";
		public const string SDSS_SQL_OPTIMIZE = "http://skyserver.sdss.org/public/en/help/docs/sql_help.asp#optquery";
	}
    public struct STYPE {
        public const int CLASSIC = 0;
        public const int CUBE = 1;
    }
}
