package public

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

var Env_userprofile						string = GetEnv("USERPROFILE")
var Env_username						string = GetEnv("USERNAME")
var Env_computername					string = GetEnv("COMPUTERNAME")
var Env_homeshare						string = GetEnv("HOMESHARE")
var Env_userdomain						string = GetEnv("USERDOMAIN")
var Env_fqdn_cn							string = GetEnvFqdn("CN")
var Env_dept							string = GetEnvFqdn("OU")



// 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_ADMainDeptShare				string = Env_ADMain + `\` + Env_dept + `\` + "部门共享"
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_ADApplication + "reboot.bat"
const Env_ADSoftTool_Update				string = Env_ADApplication + "update.bat"


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

const Debug								bool   = true
const DaemonPort						string = "16823"
const DaemonListen						string = ":" + DaemonPort
const ADServerDaemon					string = Env_MainADHostname + DaemonListen
var   LocalDaemon						string = Env_computername + DaemonListen
const DocuBase							string = `C:\Users\Public\Documents\AD-Control\`
const RandMax							int	   = 60
const Version							string = "0.5.1"


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

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



// 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 "	
//
//
//
//  msg msG mSg mSG Msg MsG MSg MSG 
//
//


// msg env ////////////////////////////////////////////////////////////////

const EndSign							byte    = 125
const msgerror							string = "error"


// msg type ////////////////////////////////////////////////////////////////

const Msg_Report						string = "report"
const Msg_Exec							string = "exec"
const Msg_Backup						string = "backup"



// msg report type ///////////////////////////////////////////////////////////

const Msg_Report_Offwork				string = "offwork"
const Msg_Report_OverBak				string = "overbak"


// msg backup status //////////////////////////////////////////////////////////////

const Msg_Backup_Status_Start			string = "start"
const Msg_Backup_Status_RFile			string = "rfile"
const Msg_Backup_Status_If				string = "if"
const Msg_Backup_Status_RunBak			string = "runbak"
//const Msg_Backup_Status_Over			string = "over"
const Msg_Backup_Status_Error			string = msgerror		

// msg exec status ////////////////////////////////////////////////////////////////

const Msg_Exec_State_Request			string = "request"
const Msg_Exec_State_Ack				string = "ack"
const Msg_Exec_CloseWindows				string = "closewindow"
const Msg_Exec_CloseWindows_cmd			string = "shutdown -s -t 15"
const Msg_Exec_CancelCloseWindows		string = "cancelclosewindows"
const Msg_Exec_CancelCloseWindows_cmd	string = "shutdown -a"
const Msg_Exec_LogOffUser				string = "logoffuser"
const Msg_Exec_LogOffUser_cmd			string = "shutdown -l"
const Msg_Exec_UserExec					string = "userexec"
const Msg_Exec_RebootWindows			string = "rebootWindows"
const Msg_Exec_RebootWindows_cmd		string = "shutdown -r -t 15"
const Msg_Exec_Update					string = "update"
const Msg_Exec_Update_cmd				string = Env_ADSoftTool_Update



// Basic Json Fromat ///////////////////////////////////////////////////////
type MJbase struct{
	MsgType								string `json:"msgtype"`
	//MsgStatus							string `json:"msgstatus"`
	Username 							string `json:"username"`
	Computername 						string `json:"computername"`
	Status								string `json:"status"`
	Explain								string `json:"explain"`

}
// report Json Format //////////////////////////////////////////////////////
type MJreport struct {
	MJbase
	Report								string `json:"report"`
}

// Exec Json Fromat ///////////////////////////////////////////////////////
type MJexec struct {
	MJbase
	Instruction							string `json:"instruction"`
	Command								string `json:"command"`
	//ExtData							string `json:"extdata"`
	IfDelay								bool   `josn:"ifDelay"`
	Delay								string `json:"delay"`
}
// backup Json Format /////////////////////////////////////////////////////
type MJbackup struct{
	MJbase
	Version								string `json:"version"`
	DiskFree							string `json:"diskfree"`
	Error								bool   `json:"error"`
	BatchFileExist						bool   `json:"batchfileexist"`
	BatchFileData						[]byte `json:"batchfiledata"`
	BatchFileName						string `json:"batchfilename"`
}
