{
	"$schema": "http://json-schema.org/draft-07/schema#",
	"title": "Localization Authority Entries",
	"type": "object",
	"additionalProperties": false,
	"required": ["$schema", "version", "kind", "locale", "updatedAt", "entries"],
	"properties": {
		"$schema": { "type": "string" },
		"version": { "const": 2 },
		"kind": { "enum": ["messages", "terms", "aliases", "overrides"] },
		"locale": { "type": "string", "minLength": 1 },
		"updatedAt": { "type": "string", "format": "date-time" },
		"entries": { "type": "array" }
	},
	"allOf": [
		{
			"if": { "properties": { "kind": { "const": "messages" } } },
			"then": {
				"properties": {
					"entries": {
						"items": { "$ref": "./bilingualMessageRecord.schema.json" }
					}
				}
			}
		},
		{
			"if": { "properties": { "kind": { "const": "terms" } } },
			"then": {
				"properties": {
					"entries": {
						"items": {
							"type": "object",
							"additionalProperties": false,
							"required": ["source", "translation", "updatedAt"],
							"properties": {
								"source": { "type": "string" },
								"translation": { "type": "string" },
								"updatedAt": { "type": "string", "format": "date-time" },
								"note": { "type": "string" }
							}
						}
					}
				}
			}
		},
		{
			"if": { "properties": { "kind": { "const": "aliases" } } },
			"then": {
				"properties": {
					"entries": {
						"items": {
							"type": "object",
							"additionalProperties": false,
							"required": ["aliasId", "canonicalId", "updatedAt"],
							"properties": {
								"aliasId": { "type": "string" },
								"canonicalId": { "type": "string" },
								"updatedAt": { "type": "string", "format": "date-time" },
								"reason": { "type": "string" }
							}
						}
					}
				}
			}
		},
		{
			"if": {
				"properties": {
					"kind": { "const": "overrides" }
				}
			},
			"then": {
				"properties": {
					"entries": {
						"items": {
							"type": "object",
							"additionalProperties": false,
							"required": ["selector", "translationPattern", "updatedAt"],
							"properties": {
								"selector": {
									"anyOf": [
										{
											"type": "object",
											"additionalProperties": false,
											"required": ["kind", "occurrenceId"],
											"properties": {
												"kind": { "const": "occurrence" },
												"occurrenceId": { "type": "string" }
											}
										},
										{
											"type": "object",
											"additionalProperties": false,
											"required": ["kind", "anchor"],
											"properties": {
												"kind": { "const": "anchor" },
												"anchor": { "type": "string" }
											}
										},
										{
											"type": "object",
											"additionalProperties": false,
											"required": ["kind", "scope"],
											"properties": {
												"kind": { "const": "scope" },
												"scope": { "type": "string" }
											}
										},
										{
											"type": "object",
											"additionalProperties": false,
											"required": ["kind", "output"],
											"properties": {
												"kind": { "const": "output" },
												"output": {
													"anyOf": [
														{
															"type": "object",
															"additionalProperties": false,
															"required": ["kind", "key"],
															"properties": {
																"kind": { "const": "manifest-key" },
																"key": { "type": "string" }
															}
														},
														{
															"type": "object",
															"additionalProperties": false,
															"required": ["kind", "bundle", "key"],
															"properties": {
																"kind": { "const": "runtime-key" },
																"bundle": { "type": "string" },
																"key": { "type": "string" }
															}
														}
													]
												}
											}
										}
									]
								},
								"translationPattern": { "$ref": "./messagePattern.schema.json" },
								"updatedAt": { "type": "string", "format": "date-time" },
								"note": { "type": "string" }
							}
						}
					}
				}
			}
		}
	]
}
