{
	"$schema": "https://json-schema.org/draft/2020-12/schema",
	"version": "2.0.2",
	"$id": "template.json",
	"type": "object",
	"$defs": {
		"monsterTemplateData": {
			"type": "object",
			"properties": {
				"name": {
					"type": "string"
				},
				"alias": {
					"$ref": "../util.json#/$defs/alias"
				},
				"source": {
					"$ref": "../util.json#/$defs/source"
				},
				"page": {
					"$ref": "../util.json#/$defs/page"
				},
				"ref": {
					"type": "string"
				},
				"crMin": {
					"type": "string"
				},
				"crMax": {
					"type": "string"
				},
				"prerequisite": {
					"type": "object",
					"patternProperties": {
						"^.*$": {
							"oneOf": [
								{
									"type": "object",
									"properties": {
										"min": {},
										"max": {}
									},
									"additionalProperties": false
								},
								{
									"type": "object",
									"properties": {
										"oneOf": {
											"type": "array"
										}
									},
									"additionalProperties": false
								}
							]
						}
					}
				},
				"apply": {
					"type": "object",
					"properties": {
						"_root": {
							"$ref": "bestiary.json#/$defs/creatureData"
						},
						"_mod": {
							"$ref": "../util-copy.json#/$defs/_modObject"
						}
					}
				}
			},
			"additionalProperties": false
		},
		"legendaryGroupTemplateData": {
			"type": "object",
			"properties": {
				"name": {
					"type": "string"
				},
				"source": {
					"$ref": "../util.json#/$defs/source"
				},
				"page": {
					"$ref": "../util.json#/$defs/page"
				},
				"ref": {
					"type": "string"
				},
				"apply": {
					"type": "object",
					"properties": {
						"_root": {
							"$ref": "legendarygroups.json#/$defs/legendaryGroupData"
						},
						"_mod": {
							"$ref": "../util-copy.json#/$defs/_modObject"
						}
					}
				}
			},
			"additionalProperties": false
		},
		"monsterTemplate": {
			"anyOf": [
				{
					"type": "object",
					"properties": {
						"name": {
							"type": "string"
						},
						"alias": {
							"$ref": "../util.json#/$defs/alias"
						},
						"source": {
							"$ref": "../util.json#/$defs/source"
						},
						"page": {
							"$ref": "../util.json#/$defs/page"
						},
						"ref": {
							"type": "string"
						},
						"crMin": {
							"type": "string"
						},
						"crMax": {
							"type": "string"
						},
						"prerequisite": {
							"type": "object",
							"patternProperties": {
								"^.*$": {
									"oneOf": [
										{
											"type": "object",
											"properties": {
												"min": {},
												"max": {}
											},
											"additionalProperties": false
										},
										{
											"type": "object",
											"properties": {
												"oneOf": {
													"type": "array"
												}
											},
											"additionalProperties": false
										}
									]
								}
							}
						},
						"apply": {
							"type": "object",
							"properties": {
								"_root": {
									"$ref": "bestiary.json#/$defs/creatureData"
								},
								"_mod": {
									"$ref": "../util-copy.json#/$defs/_modObject"
								}
							}
						}
					},
					"additionalProperties": false,
					"required": [
						"name",
						"source",
						"apply"
					]
				},
				{
					"type": "object",
					"properties": {
						"name": {
							"type": "string"
						},
						"alias": {
							"$ref": "../util.json#/$defs/alias"
						},
						"source": {
							"$ref": "../util.json#/$defs/source"
						},
						"page": {
							"$ref": "../util.json#/$defs/page"
						},
						"ref": {
							"type": "string"
						},
						"crMin": {
							"type": "string"
						},
						"crMax": {
							"type": "string"
						},
						"prerequisite": {
							"type": "object",
							"patternProperties": {
								"^.*$": {
									"oneOf": [
										{
											"type": "object",
											"properties": {
												"min": {},
												"max": {}
											},
											"additionalProperties": false
										},
										{
											"type": "object",
											"properties": {
												"oneOf": {
													"type": "array"
												}
											},
											"additionalProperties": false
										}
									]
								}
							}
						},
						"apply": {
							"type": "object",
							"properties": {
								"_root": {
									"$ref": "bestiary.json#/$defs/creatureData"
								},
								"_mod": {
									"$ref": "../util-copy.json#/$defs/_modObject"
								}
							}
						},
						"_copy": {
							"$ref": "../util-copy.json#/$defs/copyBlock_copy_generic"
						}
					},
					"additionalProperties": false,
					"required": [
						"_copy"
					]
				}
			]
		},
		"legendaryGroupTemplate": {
			"anyOf": [
				{
					"type": "object",
					"properties": {
						"name": {
							"type": "string"
						},
						"source": {
							"$ref": "../util.json#/$defs/source"
						},
						"page": {
							"$ref": "../util.json#/$defs/page"
						},
						"ref": {
							"type": "string"
						},
						"apply": {
							"type": "object",
							"properties": {
								"_root": {
									"$ref": "legendarygroups.json#/$defs/legendaryGroupData"
								},
								"_mod": {
									"$ref": "../util-copy.json#/$defs/_modObject"
								}
							}
						}
					},
					"additionalProperties": false,
					"required": [
						"name",
						"source",
						"apply"
					]
				},
				{
					"type": "object",
					"properties": {
						"name": {
							"type": "string"
						},
						"source": {
							"$ref": "../util.json#/$defs/source"
						},
						"page": {
							"$ref": "../util.json#/$defs/page"
						},
						"ref": {
							"type": "string"
						},
						"apply": {
							"type": "object",
							"properties": {
								"_root": {
									"$ref": "legendarygroups.json#/$defs/legendaryGroupData"
								},
								"_mod": {
									"$ref": "../util-copy.json#/$defs/_modObject"
								}
							}
						},
						"_copy": {
							"$ref": "../util-copy.json#/$defs/copyBlock_copy_generic"
						}
					},
					"additionalProperties": false,
					"required": [
						"_copy"
					]
				}
			]
		}
	},
	"properties": {
		"_meta": {
			"$ref": "../util.json#/$defs/metaBlock"
		},
		"monsterTemplate": {
			"type": "array",
			"minItems": 1,
			"uniqueItems": true,
			"items": {
				"$ref": "#/$defs/monsterTemplate"
			}
		},
		"legendaryGroupTemplate": {
			"type": "array",
			"minItems": 1,
			"uniqueItems": true,
			"items": {
				"$ref": "#/$defs/legendaryGroupTemplate"
			}
		}
	},
	"additionalProperties": false
}