{
    "$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/X_VERSIONED_EHR_STATUS.json",
    "definitions": {
        "X_VERSIONED_EHR_STATUS": {
            "type": "object",
            "required": [
                "uid",
                "owner_id",
                "time_created",
                "total_version_count",
                "extract_version_count"
            ],
            "properties": {
                "uid": {
                    "$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"
                },
                "owner_id": {
                    "allOf": [
                        {
                            "properties": {
                                "_type": {
                                    "type": "string",
                                    "enum": [
                                        "LOCATABLE_REF",
                                        "PARTY_REF",
                                        "ACCESS_GROUP_REF",
                                        "OBJECT_REF"
                                    ]
                                }
                            }
                        },
                        {
                            "if": {
                                "properties": {
                                    "_type": {
                                        "const": "LOCATABLE_REF"
                                    }
                                },
                                "required": [
                                    "_type"
                                ]
                            },
                            "then": {
                                "$ref": "https://specifications.openehr.org/releases/ITS-JSON/latest/components/BASE/Release-1.1.0/Base_types/LOCATABLE_REF.json#/definitions/LOCATABLE_REF"
                            }
                        },
                        {
                            "if": {
                                "properties": {
                                    "_type": {
                                        "const": "PARTY_REF"
                                    }
                                },
                                "required": [
                                    "_type"
                                ]
                            },
                            "then": {
                                "$ref": "https://specifications.openehr.org/releases/ITS-JSON/latest/components/BASE/Release-1.1.0/Base_types/PARTY_REF.json#/definitions/PARTY_REF"
                            }
                        },
                        {
                            "if": {
                                "properties": {
                                    "_type": {
                                        "const": "ACCESS_GROUP_REF"
                                    }
                                },
                                "required": [
                                    "_type"
                                ]
                            },
                            "then": {
                                "$ref": "https://specifications.openehr.org/releases/ITS-JSON/latest/components/BASE/Release-1.1.0/Base_types/ACCESS_GROUP_REF.json#/definitions/ACCESS_GROUP_REF"
                            }
                        },
                        {
                            "if": {
                                "properties": {
                                    "_type": {
                                        "const": "OBJECT_REF"
                                    }
                                },
                                "required": [
                                    "_type"
                                ]
                            },
                            "then": {
                                "$ref": "https://specifications.openehr.org/releases/ITS-JSON/latest/components/BASE/Release-1.1.0/Base_types/OBJECT_REF.json#/definitions/OBJECT_REF"
                            }
                        },
                        {
                            "if": {
                                "not": {
                                    "required": [
                                        "_type"
                                    ]
                                }
                            },
                            "then": {
                                "$ref": "https://specifications.openehr.org/releases/ITS-JSON/latest/components/BASE/Release-1.1.0/Base_types/OBJECT_REF.json#/definitions/OBJECT_REF"
                            }
                        }
                    ]
                },
                "time_created": {
                    "$ref": "https://specifications.openehr.org/releases/ITS-JSON/latest/components/RM/Release-1.1.0/Data_types/DV_DATE_TIME.json#/definitions/DV_DATE_TIME"
                },
                "total_version_count": {
                    "type": "integer"
                },
                "extract_version_count": {
                    "type": "integer"
                },
                "revision_history": {
                    "$ref": "https://specifications.openehr.org/releases/ITS-JSON/latest/components/RM/Release-1.1.0/Common/REVISION_HISTORY.json#/definitions/REVISION_HISTORY"
                },
                "versions": {
                    "type": "array",
                    "items": {
                        "$ref": "https://specifications.openehr.org/releases/ITS-JSON/latest/components/RM/Release-1.1.0/Common/ORIGINAL_VERSION.json#/definitions/ORIGINAL_VERSION"
                    }
                },
                "_type": {
                    "type": "string",
                    "const": "X_VERSIONED_EHR_STATUS"
                }
            },
            "additionalProperties": false
        }
    }
}