{
	// Place your global snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and
	// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope
	// is left empty or omitted, the snippet gets applied to all languages. The prefix is what is
	// used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
	// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders.
	// Placeholders with the same ids are connected.

	//https://code.visualstudio.com/docs/editor/userdefinedsnippets

	"MX Autoscript Header": {
		"scope": "javascript,typescript",
		"prefix": "mx-header",
		"body": [
			"/*********************************************************************************************************"
			"**  YOURCOMPANYNAME (code will display neatly in fixed-width font)"
			"**"
			"**  File Name  : ${TM_FILENAME_BASE/.*/${0:/upcase}/}"
			"**  Language   : javascript"
			"**  Description: $2"
			"**  Modification History:"
			"**  Date            Author            Version    Comment"
			"**  $CURRENT_YEAR-$CURRENT_MONTH-$CURRENT_DATE      YOURNAME           1.00       Creation"
			"*********************************************************************************************************/"
			"load(\"nashorn:mozilla_compat.js\");"
			"importClass(Packages.psdi.mbo.MboConstants);"
			"importClass(Packages.psdi.util.logging.MXLoggerFactory);"
			"importClass(Packages.psdi.server.MXServer);"
			""
			"\/\/Get a Logger"
			"var logger = MXLoggerFactory.getLogger(\"maximo.script\");"
		],
		"description": "MX Autoscript Header"
	},

	"MX Get Transactional Record Set": {
		"scope": "javascript,typescript",
		"prefix": "mx-transactional record set",
		"body": [
			"var ${TM_SELECTED_TEXT:${1:mbo}}Set = ${2:mbo}.getMboSet(\"${TM_SELECTED_TEXT/(.*)/${1:/upcase}/}$4\");"
		],
		"description": "MX Get Transactional Record Set"
	},

	"MX Get Non-Transactional Record Set": {
		"scope": "javascript,typescript",
		"prefix": "mx-nontransactional record set",
		"body": [
			"var $1Set = MXServer.getMXServer().getMboSet(\"$1\", MXServer.getMXServer().getSystemUserInfo());"
			"var whereClause = \"${2:siteid='\" + mbo.getString[\"SITEID\"] + \"' and }\";"
			"$1Set.setWhere(whereClause);"
			"$1Set.reset();"
			"${4:\/\/Do Something}"
			"$1Set.close();"
		],
		"description": "MX Get Non-Transactional Record Set"
	},

	"MX Logging": {
		"scope": "javascript,typescript",
		"prefix": "mx-logging",
		"body": [
			"logger.${1|info,debug,warn,error|}(\"${TM_FILENAME_BASE/(.*)/${0:/upcase}/} - $2\");"
		],
		"description": "MX Logging Line"
	},

	"MX Change Status": {
		"scope": "javascript,typescript",
		"prefix": "mx-status change",
		"body": [
			"${1:mbo}.changeStatus(\"${2|DECOMMISSIONED,IMPORTED,NOT READY,OPERATING,CAN,CLOSE,COMP,INPRG,WAPPR,WMATL,WSCH|}\", MXServer.getMXServer().getDate(), \"${3:description of event}\", ${4:MboConstants.NOACCESSCHECK | MboConstants.NOVALIDATION_AND_NOACTION});"
		],
		"description": "MX Change Status"
	},

	"MX Record While Iteration Loop": {
		"scope": "javascript,typescript",
		"prefix": "mx-loop while",
		"body": [
			"var ${TM_SELECTED_TEXT:${1:mbo}}Record = ${TM_SELECTED_TEXT:${1:mbo}}Set.moveFirst();"
			"while (${TM_SELECTED_TEXT:${1:mbo}}Record) {"
			"	//Do something here"
			"	$2"
			"	${TM_SELECTED_TEXT:${1:mbo}}Record = ${TM_SELECTED_TEXT:${1:mbo}}Set.moveNext();"
			"}"
		],
		"description": "MX Loop a Record Set"
	},

	"MX Get Property": {
		"scope": "javascript,typescript",
		"prefix": "mx-property retrieval",
		"body": [
			"${1:maxProperty} = MXServer.getMXServer().getConfig().getProperty(\"${2:mail.smtp.host}\");"
		],
		"description": "MX Get a system Property"
	},

	"MX Flag": {
		"scope": "javascript,typescript",
		"prefix": "mx-flag values",
		"body": [
			"${1|MboConstants.NOACCESSCHECK,MboConstants.NOVALIDATION,MboConstants.NOACTION,MboConstants.NOVALIDATION_AND_NOACTION|}"
		],
		"description": "MX Get a common MboConstants flag value"
	},

	"MX Previous Values": {
		"scope": "javascript,typescript",
		"prefix": "mx-previous values",
		"body": [
			"var mboValue = mbo.getMboValue(\"DESCRIPTION\");"
			"var initValue = mboValue.getInitialValue().asString();	\/\/Initialized Value"
			"var currValue = mboValue.getCurrentValue().asString();	\/\/Current Value"
			"var prevValue = mboValue.getPreviousValue().asString();	\/\/Previous Value"
		],
		"description": "MX Previous Values for a Field"
	},

	"MX Send Email": {
		"scope": "javascript,typescript",
		"prefix": "mx-email",
		"body": [
			"MXServer.sendEMail(to, cc, bcc, sendfrom, subject, message, \"\", null, null);"
		],
		"description": "Send Email"
	},

	"MX Field is Modified": {
		"scope": "javascript,typescript",
		"prefix": "mx-is Modified",
		"body": [
			"var /*bool*/ is$1Modified = mbo.isModified(\"$1\");"
		],
		"description": "Is a field modified?"
	},

	"MX Throw User Error": {
		"scope": "javascript,typescript",
		"prefix": "mx-error to user",
		"body": [
			"params = [\"param 1\"];"
			"service.error(\"${1:NAME_OF_MSGGROUP}\", \"${2:NAME_OF_MSG}\", params);"
		],
		"description": "Throw Error to User"
	},

	"MX getString": {
		"scope": "javascript,typescript",
		"prefix": "mx-get string",
		"body": [
			"var \/*String*\/ ${1:AttributeName} = mbo.getString(\"${1:AttributeName}\");"
		],
		"description": "getString"
	},

	"MX getInt": {
		"scope": "javascript,typescript",
		"prefix": "mx-get int",
		"body": [
			"var \/*int*\/ ${1:AttributeName} = mbo.getInt(\"${1:AttributeName}\");"
		],
		"description": "getInt"
	},

	"MX getLong": {
		"scope": "javascript,typescript",
		"prefix": "mx-get long",
		"body": [
			"var \/*long*\/ ${1:AttributeName} = mbo.getLong(\"${1:AttributeName}\");"
		],
		"description": "getLong"
	},

	"MX getDouble": {
		"scope": "javascript,typescript",
		"prefix": "mx-get double",
		"body": [
			"var \/*double*\/ ${1:AttributeName} = mbo.getDouble(\"${1:AttributeName}\");"
		],
		"description": "getDouble"
	},

	"MX getDate": {
		"scope": "javascript,typescript",
		"prefix": "mx-get date",
		"body": [
			"var \/*Calendar*\/ ${1:AttributeName} = mbo.getDate(\"${1:AttributeName}\");"
		],
		"description": "getDate"
	},

	"MX getBoolean": {
		"scope": "javascript,typescript",
		"prefix": "mx-get boolean",
		"body": [
			"var \/*bool*\/ ${1:AttributeName} = mbo.getBoolean(\"${1:AttributeName}\");"
		],
		"description": "getBoolean"
	},

	"MX setValue": {
		"scope": "javascript,typescript",
		"prefix": "mx-set value",
		"body": [
			"mbo.setValue(\"${1:AttributeName}\", ${2:VariableName}, MboConstants.NOACCESSCHECK | MboConstants.NOVALIDATION_AND_NOACTION);"
		],
		"description": "setValue"
	},
	
	"MX setNull": {
		"scope": "javascript,typescript",
		"prefix": "mx-set null",
		"body": [
			"mbo.setValueNull(\"${1:AttributeName}\", MboConstants.NOACCESSCHECK | MboConstants.NOVALIDATION_AND_NOACTION);"
		],
		"description": "setValueNull"
	},
	
	"MX Get Server DateTime": {
		"scope": "javascript,typescript",
		"prefix": "mx-server datetime",
		"body": [
			"var /*Calendar*/ serverDateTime = MXServer.getMXServer().getDate();"
		],
		"description": "Get Server DateTime"
	},

	"MX JSON from CRONTASK Args": {
		"scope": "javascript,typescript",
		"prefix": "mx-json from crontask args",
		"body": [
			"var \/*JSON*\/ args = service.tojsonobject(arg);"
			"var \/*String*\/ someValue = args.get(\"someValue\");"
		],
		"description": "Get a JSON object from Crontask Args / Convert a string to JSON."
	},

	////example
	//"Uppercase second tab stop instance only": {
	//	"scope": "javascript,typescript",
	//	"prefix": "mx-up",
	//	"body": [
	//		"${1:title}"
	//		"${1/(.*)/${1:/upcase}/}"
	//		"$0"
	//	]
	//}
}
