<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xs:schema version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">

    <xs:element name="data-governance-model">
        <xs:complexType>
            <xs:all>
                <xs:element name="assetTypes" minOccurs="0">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element name="assetType" type="assetType" maxOccurs="unbounded" minOccurs="0"/>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
                <xs:element name="relationTypes" minOccurs="0">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element name="relationType" type="relationType" maxOccurs="unbounded" minOccurs="0"/>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
                <xs:element name="relations" minOccurs="0">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element name="relation" type="relation" maxOccurs="unbounded" minOccurs="0"/>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
            </xs:all>
            <xs:attribute name="description" type="xs:string"/>
            <xs:attribute name="displayName" type="xs:string"/>
            <xs:attribute name="name" type="xs:string"/>
        </xs:complexType>
    </xs:element>

    <xs:complexType name="assetType">
        <xs:sequence>
            <xs:element name="simpleAttribute" type="simpleAttribute" minOccurs="0" maxOccurs="unbounded"/>
            <xs:element name="arrayAttribute" type="arrayAttribute" minOccurs="0" maxOccurs="unbounded"/>
            <xs:element name="complexAttribute" type="complexAttribute" minOccurs="0" maxOccurs="unbounded"/>
            <xs:element name="inheritedSimpleAttributeObjects" type="inheritedAttribute" minOccurs="0" maxOccurs="unbounded"/>
            <xs:element name="inheritedArrayAttributeObjects" type="inheritedAttribute" minOccurs="0" maxOccurs="unbounded"/>
            <xs:element name="inheritedComplexAttributeObjects" type="inheritedAttribute" minOccurs="0" maxOccurs="unbounded"/>
            <xs:element name="tags" type="tag" minOccurs="0" maxOccurs="unbounded"/>
            <xs:element name="customProperties" type="customProperty" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
        <xs:attribute name="description" type="xs:string"/>
        <xs:attribute name="displayName" type="xs:string"/>
        <xs:attribute name="name" type="xs:string"/>
        <xs:attribute name="parentAssetType" type="xs:string"/>
        <xs:attribute name="icon" type="xs:string"/>
        <xs:attribute name="color" type="xs:string"/>
        <xs:attribute name="crawlerClassName" type="xs:string"/>
        <xs:attribute name="libraryVersion" type="xs:string"/>
        <xs:attribute name="libraryName" type="xs:string"/>
        <xs:attribute name="version" type="xs:int"/>
    </xs:complexType>

    <xs:complexType name="arrayAttribute">
        <xs:complexContent>
            <xs:extension base="abstractSearchableAttribute">
                <xs:sequence>
                    <xs:element name="dictionaryDataType" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
                    <xs:element name="defaultValue" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
                    <xs:element name="lookupEntitySearchAttributes" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
                    <xs:element name="lookupEntityDisplayAttributes" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
                    <xs:element name="tags" type="tag" minOccurs="0" maxOccurs="unbounded"/>
                </xs:sequence>
                <xs:attribute name="base" type="xs:boolean"/>
                <xs:attribute name="arrayValueType" type="arrayValueType"/>
                <xs:attribute name="exchangeSeparator" type="xs:string"/>
                <xs:attribute name="searchCaseInsensitive" type="xs:boolean"/>
                <xs:attribute name="searchMorphologically" type="xs:boolean"/>
                <xs:attribute name="searchWithTransliteration" type="xs:boolean"/>
                <xs:attribute name="searchWithSynonyms" type="xs:boolean"/>
                <xs:attribute name="searchCustomSort" type="searchSort"/>
                <xs:attribute name="uniqueValues" type="xs:boolean"/>
                <xs:attribute name="lookupEntityType" type="xs:string"/>
                <xs:attribute name="lookupEntityCodeAttributeType" type="simpleDataType"/>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>

    <xs:complexType name="complexAttribute">
        <xs:complexContent>
            <xs:extension base="abstractAttribute">
                <xs:sequence>
                    <xs:element name="tags" type="tag" minOccurs="0" maxOccurs="unbounded"/>
                </xs:sequence>
                <xs:attribute name="base" type="xs:boolean"/>
                <xs:attribute name="maxCount" type="xs:int"/>
                <xs:attribute name="minCount" type="xs:int"/>
                <xs:attribute name="nestedEntityName" type="xs:string"/>
                <xs:attribute name="nestedEntityKeyAttribute" type="xs:string"/>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>

    <xs:complexType name="simpleAttribute">
        <xs:complexContent>
            <xs:extension base="abstractSearchableAttribute">
                <xs:sequence>
                    <xs:element name="measureSettings" type="measurementSettings" minOccurs="0" maxOccurs="1"/>
                    <xs:element name="dictionaryDataType" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
                    <xs:element name="lookupEntitySearchAttributes" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
                    <xs:element name="lookupEntityDisplayAttributes" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
                    <xs:element name="tags" type="tag" minOccurs="0" maxOccurs="unbounded"/>
                </xs:sequence>
                <xs:attribute name="base" type="xs:boolean"/>
                <xs:attribute name="linkDataType" type="xs:string"/>
                <xs:attribute name="enumDataType" type="xs:string"/>
                <xs:attribute name="simpleDataType" type="simpleDataType"/>
                <xs:attribute name="searchCaseInsensitive" type="xs:boolean"/>
                <xs:attribute name="searchMorphologically" type="xs:boolean"/>
                <xs:attribute name="searchWithTransliteration" type="xs:boolean"/>
                <xs:attribute name="searchWithSynonyms" type="xs:boolean"/>
                <xs:attribute name="searchCustomSort" type="searchSort"/>
                <xs:attribute name="unique" type="xs:boolean"/>
                <xs:attribute name="defaultValue" type="xs:string"/>
                <xs:attribute name="lookupEntityType" type="xs:string"/>
                <xs:attribute name="lookupEntityCodeAttributeType" type="simpleDataType"/>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>

    <xs:complexType name="tag">
        <xs:attribute name="name" type="xs:string"/>
        <xs:attribute name="value" type="xs:string"/>
    </xs:complexType>

    <xs:complexType name="customProperty">
        <xs:attribute name="name" type="xs:string"/>
        <xs:attribute name="value" type="xs:string"/>
    </xs:complexType>

    <xs:complexType name="inheritedAttribute">
        <xs:attribute name="name" type="xs:string"/>
        <xs:attribute name="order" type="xs:int"/>
    </xs:complexType>

    <xs:complexType name="abstractSearchableAttribute" abstract="true">
        <xs:complexContent>
            <xs:extension base="abstractAttribute">
                <xs:attribute name="displayable" type="xs:boolean"/>
                <xs:attribute name="mainDisplayable" type="xs:boolean"/>
                <xs:attribute name="searchable" type="xs:boolean"/>
                <xs:attribute name="useAttributeNameForDisplay" type="xs:boolean"/>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>

    <xs:complexType name="abstractAttribute" abstract="true">
        <xs:sequence>
            <xs:element name="customProperties" type="customProperty" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
        <xs:attribute name="description" type="xs:string"/>
        <xs:attribute name="displayName" type="xs:string"/>
        <xs:attribute name="hidden" type="xs:boolean"/>
        <xs:attribute name="name" type="xs:string"/>
        <xs:attribute name="nullable" type="xs:boolean"/>
        <xs:attribute name="order" type="xs:int"/>
        <xs:attribute name="readOnly" type="xs:boolean"/>
    </xs:complexType>

    <xs:complexType name="nestedEntity">
        <xs:sequence>
            <xs:element name="simpleAttribute" type="simpleAttribute" minOccurs="0" maxOccurs="unbounded"/>
            <xs:element name="arrayAttribute" type="arrayAttribute" minOccurs="0" maxOccurs="unbounded"/>
            <xs:element name="customProperties" type="customProperty" minOccurs="0" maxOccurs="unbounded"/>
            <xs:element name="tags" type="tag" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
        <xs:attribute name="description" type="xs:string"/>
        <xs:attribute name="displayName" type="xs:string"/>
        <xs:attribute name="name" type="xs:string"/>
        <xs:attribute name="crawlerClassName" type="xs:string"/>
        <xs:attribute name="libraryVersion" type="xs:string"/>
        <xs:attribute name="libraryName" type="xs:string"/>
        <xs:attribute name="version" type="xs:int"/>
    </xs:complexType>

    <xs:complexType name="relationType">
        <xs:sequence>
            <xs:element name="customProperties" type="customProperty" minOccurs="0" maxOccurs="unbounded"/>
            <xs:element name="tags" type="tag" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
        <xs:attribute name="color" type="xs:string"/>
        <xs:attribute name="direction" type="relationDirection"/>
        <xs:attribute name="inner" type="xs:boolean"/>
        <xs:attribute name="inwardDisplayName" type="xs:string"/>
        <xs:attribute name="name" type="xs:string"/>
        <xs:attribute name="outwardDisplayName" type="xs:string"/>
        <xs:attribute name="crawlerClassName" type="xs:string"/>
        <xs:attribute name="libraryVersion" type="xs:string"/>
        <xs:attribute name="libraryName" type="xs:string"/>
        <xs:attribute name="version" type="xs:int"/>
    </xs:complexType>

    <xs:complexType name="relation">
        <xs:sequence>
            <xs:element name="customProperties" type="customProperty" minOccurs="0" maxOccurs="unbounded"/>
            <xs:element name="simpleAttribute" type="simpleAttribute" minOccurs="0" maxOccurs="unbounded"/>
            <xs:element name="tags" type="tag" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
        <xs:attribute name="fromAssetType" type="xs:string"/>
        <xs:attribute name="fromCardinality" type="xs:int"/>
        <xs:attribute name="relationType" type="xs:string"/>
        <xs:attribute name="required" type="xs:boolean"/>
        <xs:attribute name="toAssetType" type="xs:string"/>
        <xs:attribute name="toCardinality" type="xs:int"/>
        <xs:attribute name="crawlerClassName" type="xs:string"/>
        <xs:attribute name="libraryVersion" type="xs:string"/>
        <xs:attribute name="libraryName" type="xs:string"/>
        <xs:attribute name="version" type="xs:int"/>
    </xs:complexType>

    <xs:complexType name="measurementSettings">
        <xs:attribute name="categoryId" type="xs:string"/>
        <xs:attribute name="defaultUnitId" type="xs:string"/>
    </xs:complexType>

    <xs:simpleType name="arrayValueType">
        <xs:restriction base="xs:string">
            <xs:enumeration value="Date"/>
            <xs:enumeration value="Time"/>
            <xs:enumeration value="Timestamp"/>
            <xs:enumeration value="String"/>
            <xs:enumeration value="Integer"/>
            <xs:enumeration value="Number"/>
            <xs:enumeration value="Blob"/>
            <xs:enumeration value="Clob"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="simpleDataType">
        <xs:restriction base="xs:string">
            <xs:enumeration value="Date"/>
            <xs:enumeration value="Time"/>
            <xs:enumeration value="Timestamp"/>
            <xs:enumeration value="String"/>
            <xs:enumeration value="Integer"/>
            <xs:enumeration value="Number"/>
            <xs:enumeration value="Boolean"/>
            <xs:enumeration value="Blob"/>
            <xs:enumeration value="Clob"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="relationDirection">
        <xs:restriction base="xs:string">
            <xs:enumeration value="ONE_DIRECTIONAL"/>
            <xs:enumeration value="BIDIRECTIONAL"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="searchSort">
        <xs:restriction base="xs:string">
            <xs:enumeration value="DEFAULT"/>
            <xs:enumeration value="TRANSLIT"/>
        </xs:restriction>
    </xs:simpleType>
</xs:schema>