{
	"$id": "session.json",
	"$schema": "https://json-schema.org/draft/2020-12/schema",
	"type": "object",
	"required": ["activityType", "athlete", "proposed"],
	"unevaluatedProperties": false,
	"properties": {
		"activityType": {
			"$ref": "#/$defs/activityTypeOrUriReference"
		},
		"athlete": {
			"$ref": "#/$defs/athleteOrUriReference"
		},
		"program": {
			"$ref": "#/$defs/programOrUriReference"
		},
		"description": {
			"type": "string"
		},
		"notes": {
			"type": "string"
		},
		"created": {
			"type": "string",
			"format": "date-time"
		},
		"modified": {
			"type": "string",
			"format": "date-time"
		},
		"proposed": {
			"type": "string",
			"format": "date-time"
		},
		"performed": {
			"type": "string",
			"format": "date-time"
		},
		"rejected": {
			"type": "string",
			"format": "date-time"
		},
		"duration": {
			"type": "string",
			"format": "duration"
		},
		"customizations": {
			"type": "array",
			"items": {
				"$ref": "#/$defs/customization"
			}
		},
		"customValues": {
			"$ref": "https://graph.movelapse.com/1.0/schemas/custom-values.json"
		},
		"tasks": {
			"type": "array",
			"items": {
				"$ref": "#/$defs/task"
			}
		},
		"location": {
			"$ref": "#/$defs/locationOrUriReference"
		},
		"tags": {
			"type": "array",
			"items": {
				"type": "string"
			}
		},
		"meta": {
			"type": "object"
		}
	},
	"anyOf": [
		{
			"properties": {
				"performed": {
					"type": "string"
				},
				"rejected": {
					"type": "null"
				}
			}
		},
		{
			"properties": {
				"rejected": {
					"type": "string"
				},
				"performed": {
					"type": "null"
				}
			}
		}
	],
	"$defs": {
		"activityTypeOrUriReference": {
			"anyOf": [
				{
					"$ref": "https://graph.movelapse.com/1.0/schemas/activity-type.json"
				},
				{
					"$ref": "#/$defs/uriReference"
				}
			]
		},
		"absoluteValue": {
			"type": "number",
			"minimum": 0
		},
		"athleteOrUriReference": {
			"anyOf": [
				{
					"$ref": "https://graph.movelapse.com/1.0/schemas/athlete.json"
				},
				{
					"$ref": "#/$defs/uriReference"
				}
			]
		},
		"customization": {
			"type": "object",
			"required": ["unit", "value"],
			"unevaluatedProperties": false,
			"properties": {
				"unit": {
					"anyOf": [
						{
							"$ref": "#/$defs/relativeIntensityUnitOrUriReference"
						},
						{
							"$ref": "#/$defs/relativeRepeatUnitOrUriReference"
						},
						{
							"$ref": "#/$defs/relativeResistanceUnitOrUriReference"
						}
					]
				},
				"value": {
					"$ref": "#/$defs/absoluteValue"
				}
			}
		},
		"locationOrUriReference": {
			"anyOf": [
				{
					"$ref": "https://graph.movelapse.com/1.0/schemas/location.json"
				},
				{
					"$ref": "#/$defs/uriReference"
				}
			]
		},
		"programOrUriReference": {
			"anyOf": [
				{
					"$ref": "https://graph.movelapse.com/1.0/schemas/program.json"
				},
				{
					"$ref": "#/$defs/uriReference"
				}
			]
		},
		"relativeIntensityUnitOrUriReference": {
			"anyOf": [
				{
					"$ref": "https://graph.movelapse.com/1.0/schemas/relative-intensity-unit.json"
				},
				{
					"$ref": "#/$defs/uriReference"
				}
			]
		},
		"relativeRepeatUnitOrUriReference": {
			"anyOf": [
				{
					"$ref": "https://graph.movelapse.com/1.0/schemas/relative-repeat-unit.json"
				},
				{
					"$ref": "#/$defs/uriReference"
				}
			]
		},
		"relativeResistanceUnitOrUriReference": {
			"anyOf": [
				{
					"$ref": "https://graph.movelapse.com/1.0/schemas/relative-resistance-unit.json"
				},
				{
					"$ref": "#/$defs/uriReference"
				}
			]
		},
		"results": {
			"type": "object",
			"unevaluatedProperties": false,
			"patternProperties": {
				"^[a-z]{1}[a-zA-Z0-9]+$": {
					"type": "array",
					"items": {
						"$ref": "#/$defs/absoluteValue"
					}
				}
			}
		},
		"task": {
			"type": "object",
			"required": ["workout"],
			"unevaluatedProperties": false,
			"properties": {
				"workout": {
					"$ref": "#/$defs/workoutOrUriReference"
				},
				"results": {
					"$ref": "#/$defs/results"
				},
				"tags": {
					"type": "array",
					"items": {
						"type": "string"
					}
				},
				"meta": {
					"type": "object"
				}
			}
		},
		"uriReference": {
			"type": "string",
			"format": "uri-reference"
		},
		"workoutOrUriReference": {
			"anyOf": [
				{
					"$ref": "https://graph.movelapse.com/1.0/schemas/workout.json"
				},
				{
					"$ref": "#/$defs/uriReference"
				}
			]
		}
	}
}