{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Schema for Hexillion authentication JSON output, version 2",
"description": "MIME type: application/vnd.hexillion.auth-v2+json",
"type": "object",
"properties":
	{
	"AuthResult":
		{
		"$ref": "#/definitions/AuthResult"
		}
	},
"required": [ "AuthResult" ],
"definitions":
	{
	"AuthResult":
		{
		"type": "object",
		"properties":
			{
			"ErrorCode":
				{
				"$ref": "#/definitions/AuthErrorCode"
				},
			"Message":
				{
				"type": "string"
				},
			"SessionKey":
				{
				"type": "string"
				},
			"Accounting":
				{
				"$ref": "#/definitions/Accounting"
				}
			},
		"required": [ "ErrorCode", "Message" ]
		},
	"AuthErrorCode":
		{
		"type": "string",
		"enum":
			[
			"Success",
			"AuthenticationFailed",
			"InvalidSessionKey",
			"Unexpected"
			]
		},
	"DateTime":
		{
		"type": "string",
		"format": "date-time"
		},
	"Accounting":
		{
		"type": "object",
		"properties":
			{
			"QueryDate":
				{
				"$ref": "#/definitions/DateTime"
				},
			"QueryCost":
				{
				"$ref": "#/definitions/ServiceUnitQuantity"
				},
			"QueryCostDetails":
				{
				"$ref": "#/definitions/QueryCostDetails"
				},
			"Username":
				{
				"type": "string"
				},
			"UserIPAddress":
				{
				"$ref": "#/definitions/IPAddress"
				},
			"CurrentBalance":
				{
				"$ref": "#/definitions/ServiceUnitQuantity"
				},
			"AvailableBalance":
				{
				"$ref": "#/definitions/ServiceUnitQuantity"
				},
			"BalanceAfterLastRefill":
				{
				"$ref": "#/definitions/ServiceUnitQuantity"
				},
			"LastRefillDate":
				{
				"$ref": "#/definitions/DateTime"
				},
			"EstimatedDepletionDate":
				{
				"$ref": "#/definitions/DateTime"
				},
			"UsageRateSinceLastRefill":
				{
				"$ref": "#/definitions/ServiceUnitQuantity"
				},
			"NextRefillDate":
				{
				"$ref": "#/definitions/DateTime"
				}
			},
		"required":
			[
			"QueryCost"
			]
		},
	"IPAddress":
		{
		"oneOf":
			[
				{ "$ref": "#/definitions/IPv4Address" },
				{ "$ref": "#/definitions/IPv6Address" }
			]
		},
	"IPv4Address":
		{
		"description": "IPv4 address in dotted-quad notation with no leading zeros (except in the case of a zero octet). Example: 192.168.0.1",
		"type": "string",
		"pattern": "^(([1-9]?[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([1-9]?[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$"
		},
	"IPv6Address":
		{
		"type": "string",
		"format": "ipv6"
		},
	"ServiceUnitQuantity":
		{
		"type": "number"
		},
	"QueryCostDetails":
		{
		"type": "array",
		"items":
			{
			"$ref": "#/definitions/QueryCostLine"
			}
		},
	"QueryCostLine":
		{
		"type": "object",
		"properties":
			{
			"ItemCode":
				{
				"type": "string"
				},
			"Description":
				{
				"type": "string"
				},
			"Amount":
				{
				"$ref": "#/definitions/ServiceUnitQuantity"
				}
			}
		}
	}
}