<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="../xslt/schema.xslt"?>

<!-- (C) 2011 OpenStack LLC., All Rights Reserved -->

<xsd:schema elementFormDefault="qualified" attributeFormDefault="unqualified"
           targetNamespace="http://docs.openstack.org/common/api/v1.0"
           xmlns:ext="http://docs.openstack.org/common/api/v1.0"
           xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning"
           xmlns:html="http://www.w3.org/1999/xhtml"
           xmlns:atom="http://www.w3.org/2005/Atom"
           xmlns:xsd="http://www.w3.org/2001/XMLSchema">

    <!-- Import ATOM specific schema definitions -->
    <xsd:import namespace="http://www.w3.org/2005/Atom" schemaLocation="atom/atom.xsd" />

    <xsd:element name="extensions" type="ext:Extensions"/>
    <xsd:element name="extension" type="ext:Extension"/>

    <xsd:complexType name="Extensions">
        <xsd:sequence>
            <xsd:element name="extension" type="ext:Extension" minOccurs="0" maxOccurs="unbounded" />
            <xsd:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" />
        </xsd:sequence>
        <xsd:anyAttribute namespace="##other" processContents="lax"/>
    </xsd:complexType>

    <xsd:complexType name="Extension">
        <xsd:sequence>
            <xsd:element name="description" type="xsd:string" minOccurs="1" />
            <!--<xsd:element vc:minVersion="1.1" ref="atom:link" minOccurs="0" maxOccurs="unbounded" />-->
            <xsd:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" />
        </xsd:sequence>
        <xsd:attribute name="name" type="xsd:string" use="required"/>
        <xsd:attribute name="namespace" type="xsd:anyURI" use="required"/>
        <xsd:attribute name="alias" type="ext:Alias" use="required"/>
        <xsd:attribute name="updated" type="xsd:dateTime" use="optional"/>
        <xsd:anyAttribute namespace="##other" processContents="lax"/>
        <!--TODO(Ziad)resolve asser issue
            <xsd:assert vc:minVersion="1.1" test="atom:link[@rel='describedby']">
            <xsd:annotation>
                <xsd:documentation
                    xml:lang="EN"
                    xmlns="http://www.w3.org/1999/xhtml">
                    <p>
                        There should be at least one atom link
                        with a describedby relation.
                    </p>
                </xsd:documentation>
            </xsd:annotation>
        </xsd:assert>-->
    </xsd:complexType>

    <xsd:simpleType name="Alias">
        <xsd:restriction base="xsd:string">
            <xsd:pattern value="\w+\-\w+" />
        </xsd:restriction>
    </xsd:simpleType>

</xsd:schema>