<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:element name="schemaMeta">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="comments" minOccurs="0"/>
                <xs:element ref="tables"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:element name="comments" type="xs:string"/>
        <xs:annotation>
            <xs:documentation>
                Will add comments/remarks to output (html/xsd)
                Will replace comments/remarks that have been retrieved from database.
            </xs:documentation>
        </xs:annotation>
    <xs:element name="tables">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="table" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:element name="table">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="column" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
            <xs:attribute name="name" type="xs:string" use="required"/>
            <xs:attribute name="comments" type="xs:string">
                <xs:annotation>
                    <xs:documentation>
                        Will add comments/remarks to output (html/xsd)
                        Will replace comments/remarks that have been retrieved from database.
                    </xs:documentation>
                </xs:annotation>
            </xs:attribute>
            <xs:attribute name="remarks" type="xs:string">
            <xs:annotation>
                <xs:documentation>Deprecated and will be removed if future version</xs:documentation>
            </xs:annotation>
            </xs:attribute>
            <xs:attribute name="remoteCatalog" type="xs:string">
                <xs:annotation>
                    <xs:documentation>
                        Specifies that this table exists in another catalog.
                    </xs:documentation>
                </xs:annotation>
            </xs:attribute>
            <xs:attribute name="remoteSchema" type="xs:string">
                <xs:annotation>
                    <xs:documentation>
                        Specifies that this table exists in another schema.
                    </xs:documentation>
                </xs:annotation>
            </xs:attribute>
        </xs:complexType>
    </xs:element>
    <xs:element name="column">
        <xs:complexType>
        	<xs:sequence>
        		<xs:element ref="foreignKey" minOccurs="0"
        			maxOccurs="unbounded" />
        	</xs:sequence>
        	<xs:attribute name="name" type="xs:string" use="required" />
        	<xs:attribute name="type" type="xs:string"/>
        	<xs:attribute name="id" type="xs:string"/>
        	<xs:attribute name="size" type="xs:int"/>
        	<xs:attribute name="digits" type="xs:int"/>
        	<xs:attribute name="nullable" type="xs:boolean"/>
        	<xs:attribute name="comments" type="xs:string">
                <xs:annotation>
                    <xs:documentation>
                        Will add comments/remarks to output (html/xsd)
                        Will replace comments/remarks that have been retrieved from database.
                    </xs:documentation>
                </xs:annotation>
            </xs:attribute>
            <xs:attribute name="exclude" type="xs:boolean">
                <xs:annotation>
                    <xs:documentation>
                        Exclude this column from the output.
                    </xs:documentation>
                </xs:annotation>
            </xs:attribute>
        	<xs:attribute name="remarks" type="xs:string">
                <xs:annotation>
                    <xs:documentation>Deprecated and will be removed if future version</xs:documentation>
                </xs:annotation>
            </xs:attribute>
        	<xs:attribute name="primaryKey" type="xs:boolean">
        		<xs:annotation>
        			<xs:documentation>
        				Specifies that this column is a primary key of
        				its table. Defaults to false.
        			</xs:documentation>
        		</xs:annotation>
        	</xs:attribute>
        	<xs:attribute name="autoUpdated" type="xs:boolean"/>
            <xs:attribute name="defaultValue" type="xs:string"/>
            <xs:attribute name="disableImpliedKeys">
        		<xs:annotation>
        			<xs:documentation>
        				Explicitly disables relationships to or from
        				this column that may be implied by the column's
        				name, type and size.

        				Defaults to none.
        			</xs:documentation>
        		</xs:annotation>
        		<xs:simpleType>
        			<xs:restriction base="xs:string">
        				<xs:enumeration value="from" />
        				<xs:enumeration value="to" />
        				<xs:enumeration value="all" />
        				<xs:enumeration value="none" />
        			</xs:restriction>
        		</xs:simpleType>
        	</xs:attribute>
        	<xs:attribute name="disableDiagramAssociations">
        		<xs:annotation>
        			<xs:documentation>
        				Sometimes the associations displayed on a
        				relationships diagram cause the diagram to
        				become much more cluttered than it needs to be.
        				Enable this setting to not show the
        				relationships between this column and other
        				columns.

        				Use exceptDirect to disable associations on all
        				diagrams except for the diagrams of tables
        				directly (within one degree of separation)
        				connected to this column.

        				Defaults to none.
        			</xs:documentation>
        		</xs:annotation>
        		<xs:simpleType>
        			<xs:restriction base="xs:string">
        				<xs:enumeration value="all" />
        				<xs:enumeration value="exceptDirect" />
        				<xs:enumeration value="none" />
        			</xs:restriction>
        		</xs:simpleType>
        	</xs:attribute>
        </xs:complexType>
    </xs:element>
    <xs:element name="foreignKey">
        <xs:annotation>
            <xs:documentation>
                Associates this column with the primary key of another
                table.
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:attribute name="remoteCatalog" type="xs:string">
                <xs:annotation>
                    <xs:documentation>
                        Specifies that the referenced table exists in
                        another catalog.
                    </xs:documentation>
                </xs:annotation>
            </xs:attribute>
            <xs:attribute name="remoteSchema" type="xs:string">
        		<xs:annotation>
        			<xs:documentation>
        				Specifies that the referenced table exists in
        				another schema.
        			</xs:documentation>
        		</xs:annotation>
        	</xs:attribute>
        	<xs:attribute name="table" type="xs:string" use="required" />
        	<xs:attribute name="column" type="xs:string" use="required" />
        </xs:complexType>
    </xs:element>
</xs:schema>
