{
    "$schema": "https://json-schema.org/draft/2020-12/schema#",
    "$vocabulary": {
        "https://json-schema.org/draft/2020-12/vocab/core": true,
        "https://json-schema.org/draft/2020-12/vocab/applicator": true,
        "https://json-schema.org/draft/2020-12/vocab/unevaluated": true,
        "https://json-schema.org/draft/2020-12/vocab/validation": true,
        "https://json-schema.org/draft/2020-12/vocab/meta-data": true,
        "https://json-schema.org/draft/2020-12/vocab/format-annotation": true,
        "https://json-schema.org/draft/2020-12/vocab/content": true
    },
    "#id": "https://www.medbiq.org/standards/professional-profile",
    "title": "Address",
    "description": "Schema for MedBiq Address",
    "type": "object",
    "$defs": {
        "NonNullString": {
            "$ref": "http://medbiq.pixelbytellc.com/common.schema.json#/$defs/NonNullStringType"
        },
        "CommonAttributes": {
            "type": "object",
            "properties": {
                "_id": {
                    "type": "string"
                },
                "_source": {
                    "type": "string"
                },
                "_validityDate": {
                    "type": "string",
                    "format": "date"
                },
                "_restrictions": {
                    "$ref": "http://medbiq.pixelbytellc.com/common.schema.json#/$defs/RestrictionsType"
                }
            },
            "required": ["_id", "_source", "_validityDate", "_restrictions"]
        },
        "AddressCategoryType": {
            "type": "string",
            "enum": ["Residential", "Business", "Undeliverable"]
        },
        "RestrictionsType": {
            "type": "string",
            "enum": ["Unrestricted", "Restricted", "Confidential"]
        },
        "CountryType": {
            "type": "object",
            "properties": {
                "_CountryName": {
                    "$ref": "#/$defs/NonNullString"
                },
                "_CountryCode": {
                    "$ref": "#/$defs/NonNullString"
                }
            },
            "required": ["_CountryName"]
        },
        "StreetAddressLineType": {
            "type": "object",
            "properties": {
                "_value": {
                    "$ref": "#/$defs/NonNullString"
                },
                "_restrictions": {
                    "$ref": "#/$defs/RestrictionsType"
                }
            },
            "required": ["_value", "_restrictions"]
        },
        "AddressType": {
            "type": "object",
            "properties": {
                "_ID": {
                    "$ref": "#/$defs/NonNullString"
                },
                "_Organization": {
                    "type": "array",
                    "items": {
                        "$ref": "#/$defs/NonNullString"
                    }
                },
                "_StreetAddressLine": {
                    "type": "array",
                    "items": {
                        "$ref": "#/$defs/StreetAddressLineType"
                    }
                },
                "_City": {
                    "$ref": "#/$defs/NonNullString"
                },
                "_StateOrProvince": {
                    "$ref": "#/$defs/NonNullString"
                },
                "_PostalCode": {
                    "$ref": "#/$defs/NonNullString"
                },
                "_Region": {
                    "$ref": "#/$defs/NonNullString"
                },
                "_District": {
                    "$ref": "#/$defs/NonNullString"
                },
                "_Country": {
                    "$ref": "#/$defs/CountryType"
                }
            }
        },
        "CountryTypeWithAttributes": {
            "type": "object",
            "description": "Complex type using CountryType as its base to allow custom attributes.",
            "properties": {
                "_Country": {
                    "$ref": "#/$defs/CountryType"
                },
                "_CommonAttributes": {
                    "$ref": "#/$defs/CommonAttributes"
                }
            }
        }
    },
    "properties": {
        "Address": {
            "$ref": "#/$defs/AddressType"
        }
    }
}
