{
    "$schema": "http://json-schema.org/draft-07/schema",
    "$id": "https://specifications.openehr.org/releases/ITS-JSON/latest/components/RM/Release-1.1.0/Ehr_extract/EXTRACT_ENTITY_CHAPTER.json",
    "definitions": {
        "EXTRACT_ENTITY_CHAPTER": {
            "type": "object",
            "required": [
                "archetype_node_id",
                "name",
                "extract_id_key"
            ],
            "properties": {
                "uid": {
                    "allOf": [
                        {
                            "required": [
                                "_type"
                            ],
                            "properties": {
                                "_type": {
                                    "type": "string",
                                    "enum": [
                                        "OBJECT_VERSION_ID",
                                        "HIER_OBJECT_ID"
                                    ]
                                }
                            }
                        },
                        {
                            "if": {
                                "properties": {
                                    "_type": {
                                        "const": "OBJECT_VERSION_ID"
                                    }
                                }
                            },
                            "then": {
                                "$ref": "https://specifications.openehr.org/releases/ITS-JSON/latest/components/BASE/Release-1.1.0/Base_types/OBJECT_VERSION_ID.json#/definitions/OBJECT_VERSION_ID"
                            }
                        },
                        {
                            "if": {
                                "properties": {
                                    "_type": {
                                        "const": "HIER_OBJECT_ID"
                                    }
                                }
                            },
                            "then": {
                                "$ref": "https://specifications.openehr.org/releases/ITS-JSON/latest/components/BASE/Release-1.1.0/Base_types/HIER_OBJECT_ID.json#/definitions/HIER_OBJECT_ID"
                            }
                        }
                    ]
                },
                "archetype_node_id": {
                    "type": "string"
                },
                "name": {
                    "allOf": [
                        {
                            "properties": {
                                "_type": {
                                    "type": "string",
                                    "enum": [
                                        "DV_CODED_TEXT",
                                        "DV_TEXT"
                                    ]
                                }
                            }
                        },
                        {
                            "if": {
                                "properties": {
                                    "_type": {
                                        "const": "DV_CODED_TEXT"
                                    }
                                },
                                "required": [
                                    "_type"
                                ]
                            },
                            "then": {
                                "$ref": "https://specifications.openehr.org/releases/ITS-JSON/latest/components/RM/Release-1.1.0/Data_types/DV_CODED_TEXT.json#/definitions/DV_CODED_TEXT"
                            }
                        },
                        {
                            "if": {
                                "properties": {
                                    "_type": {
                                        "const": "DV_TEXT"
                                    }
                                },
                                "required": [
                                    "_type"
                                ]
                            },
                            "then": {
                                "$ref": "https://specifications.openehr.org/releases/ITS-JSON/latest/components/RM/Release-1.1.0/Data_types/DV_TEXT.json#/definitions/DV_TEXT"
                            }
                        },
                        {
                            "if": {
                                "not": {
                                    "required": [
                                        "_type"
                                    ]
                                }
                            },
                            "then": {
                                "$ref": "https://specifications.openehr.org/releases/ITS-JSON/latest/components/RM/Release-1.1.0/Data_types/DV_TEXT.json#/definitions/DV_TEXT"
                            }
                        }
                    ]
                },
                "archetype_details": {
                    "$ref": "https://specifications.openehr.org/releases/ITS-JSON/latest/components/RM/Release-1.1.0/Common/ARCHETYPED.json#/definitions/ARCHETYPED"
                },
                "feeder_audit": {
                    "$ref": "https://specifications.openehr.org/releases/ITS-JSON/latest/components/RM/Release-1.1.0/Common/FEEDER_AUDIT.json#/definitions/FEEDER_AUDIT"
                },
                "links": {
                    "type": "array",
                    "items": {
                        "$ref": "https://specifications.openehr.org/releases/ITS-JSON/latest/components/RM/Release-1.1.0/Common/LINK.json#/definitions/LINK"
                    },
                    "minItems": 1
                },
                "items": {
                    "type": "array",
                    "items": {
                        "allOf": [
                            {
                                "required": [
                                    "_type"
                                ],
                                "properties": {
                                    "_type": {
                                        "type": "string",
                                        "enum": [
                                            "EXTRACT_FOLDER",
                                            "GENERIC_CONTENT_ITEM",
                                            "OPENEHR_CONTENT_ITEM"
                                        ]
                                    }
                                }
                            },
                            {
                                "if": {
                                    "properties": {
                                        "_type": {
                                            "const": "EXTRACT_FOLDER"
                                        }
                                    }
                                },
                                "then": {
                                    "$ref": "https://specifications.openehr.org/releases/ITS-JSON/latest/components/RM/Release-1.1.0/Ehr_extract/EXTRACT_FOLDER.json#/definitions/EXTRACT_FOLDER"
                                }
                            },
                            {
                                "if": {
                                    "properties": {
                                        "_type": {
                                            "const": "GENERIC_CONTENT_ITEM"
                                        }
                                    }
                                },
                                "then": {
                                    "$ref": "https://specifications.openehr.org/releases/ITS-JSON/latest/components/RM/Release-1.1.0/Ehr_extract/GENERIC_CONTENT_ITEM.json#/definitions/GENERIC_CONTENT_ITEM"
                                }
                            },
                            {
                                "if": {
                                    "properties": {
                                        "_type": {
                                            "const": "OPENEHR_CONTENT_ITEM"
                                        }
                                    }
                                },
                                "then": {
                                    "$ref": "https://specifications.openehr.org/releases/ITS-JSON/latest/components/RM/Release-1.1.0/Ehr_extract/OPENEHR_CONTENT_ITEM.json#/definitions/OPENEHR_CONTENT_ITEM"
                                }
                            }
                        ]
                    }
                },
                "extract_id_key": {
                    "type": "string"
                },
                "_type": {
                    "type": "string",
                    "const": "EXTRACT_ENTITY_CHAPTER"
                }
            },
            "additionalProperties": false
        }
    }
}