package public

// app env ////////////////////////////////////////////////////////////////

//const Debug								bool
const DaemonPort						string = "16823"
const DaemonListen						string = ":" + DaemonPort
const ADServerDaemon					string = Env_MainADHostname + DaemonListen
var   LocalDaemon						string = User_computername + DaemonListen
const DocuBase							string = `C:\Users\Public\Documents\AD-Control\`
const RandMax							int	   = 60
const Version							string = "0.6"
const Application						string = "AD-Control-Log"


// user env ///////////////////////////////////////////////////////////////

var User_profile						string = GetEnv("USERPROFILE")
var User_name							string = GetEnv("USERNAME")
var User_computername					string = GetEnv("COMPUTERNAME")
var User_homeshare						string = GetEnv("HOMESHARE")
var User_userdomain						string = GetEnv("USERDOMAIN")
var User_fqdn_cn						string = GetEnvFqdn("CN")
var User_dept_str						string = GetEnvFqdn("OU")
var User_dept							string = GetEnv("DEPT")
var User_appdata						string = GetEnv("appdata")

var User_sid							string = Reg_query_key_one(HKCU,`Software\Microsoft\Windows\CurrentVersion\FileAssociations`,"UserSid")
var User_sessionID						string = Reg_query_item_one(HKU,User_sid+`\Volatile Environment`)
var User_Dir_WeDrive					string = User_appdata + `\Tencent\WXWork\Data`
// win-computer env /////////////////////////////////////////////////////

const Env_FreeFileSyncExe				string = `C:\Progra~2\zhiwei\FreeFileSync_10.22\FreeFileSync.exe`



// AD env ///////////////////////////////////////////////////////////

const Env_MainADHostname				string = "ADSERVER"
const Env_SMBAdserver 					string = `\\` +  Env_MainADHostname + `\`
const Env_ADSoft						string = Env_SMBAdserver + "software"
const Env_ADMain						string = Env_SMBAdserver + "ADMAIN"
var   Env_ADMainDept					string = Env_ADMain + `\` + User_dept_str
var   Env_ADMainDeptShare				string = Env_ADMain + `\` + User_dept_str + `\` + "部门共享"
const Env_ADSoftlike					string = Env_ADSoft + `\` + "softlike"
const Env_ADApplication					string = Env_ADSoft	+ `\` + "application" + `\`	
const Env_ADSoftTool					string = Env_ADSoft + `\` + "tools" + `\`
const Env_ADSoftTool_RebootUser			string = Env_ADSoftTool + "upusers.bat"
const Env_ADsoftware_local				string = `F:\software\softlike\`

// AD User env ////////////////////////////////////////////////////////////////

const AD_User_main_admin				string = "zhiweiadserver"
const AD_User_tengfei					string = "tengfei"
const AD_User_taotengfei				string = "taotengfei"
const AD_User_huyibo					string = "huyibo"	


const Zhiwei_Dept_HB					string = "HB"
const Zhiwei_Dept_LP					string = "LP"
const Zhiwei_Dept_MT					string = "MT"
const Zhiwei_Dept_JR					string = "JR"
const Zhiwei_Dept_JD					string = "JD"
const Zhiwei_Dept_TXHD					string = "TXHD"
const Zhiwei_Dept_TXWJ					string = "TXWJ"
const Zhiwei_Dept_BGYJZX				string = "BGYJZX"
const Zhiwei_Dept_TECH					string = "TECH"

const Zhiwei_Dept_Count					= 9


// backup env //////////////////////////////////////////////////////////////

var BackupVersion						string = "0428"
var BackupExtFile						string = ".ffs_batch"
var BackupReplaceKey					=[]byte("-tengfei-")


// reg ////////////////////////////////////////////////////////////////////

const (
	HKCU								= iota
	HKLM
	HKU
)
const Reg_Root_achome					int = HKLM
const Reg_Path_achome					string = `SOFTWARE\ADControl`
const Reg_Path_achome_dc				string = Reg_Path_achome + `\DomainComputer\`		// use for adserver,not for dc
const Reg_Name_achome_dc_lastlogin		string = "LastLogin"
const Reg_Name_achome_dc_lastclose		string = "CloseWindows"
const Reg_Name_achome_dc_WeDriveDir		string = "WeDriveDir"

// reg value /////////////////////////////////////////////////////////////////
var Reg_Value_WeDriveDir				string = Reg_query_key_one(HKCU,Reg_Path_achome,Reg_Name_achome_dc_WeDriveDir)


// other env ///////////////////////////////////////////////////////////////

const Link_WxworkBot					string = `https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=59107f72-5b72-4a20-a33c-fdb1cd46f2c6`
const Link_MultiSplit					string = Env_ADApplication + "win_MultiSplit.exe"	
const Cmdk								string = "cmd /k "	
const Startk							string = "cmd /k start "
var   Dir_Windows						string = GetEnv("windir") + `\`
const Zhiwei_WxDrive_Folder				string = "办公室部门内部共享"
var   Zhiwei_WxDrive_Full_Folder		string = Reg_Value_WeDriveDir + `\`+Zhiwei_WxDrive_Folder
var	  CopyStatusWeDrive					map [string]bool
