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

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

<schema
        elementFormDefault="qualified"
        attributeFormDefault="unqualified"
        xmlns="http://www.w3.org/2001/XMLSchema"
        xmlns:identity="http://docs.openstack.org/identity/api/v2.0"
        xmlns:OS-KSADM="http://docs.openstack.org/identity/api/ext/OS-KSADM/v1.0"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning"
        xmlns:xsdxt="http://docs.rackspacecloud.com/xsd-ext/v1.0"
        xmlns:atom="http://www.w3.org/2005/Atom"
        targetNamespace="http://docs.openstack.org/identity/api/ext/OS-KSADM/v1.0"
    >
    
    <!-- Import ATOM specific schema definitions -->
    <import vc:minVersion="1.1" namespace="http://www.w3.org/2005/Atom"
            schemaLocation="atom/atom.xsd" />

    <import namespace="http://docs.openstack.org/identity/api/v2.0"
            schemaLocation="api.xsd" />

    <!-- Elements -->
    <element name="services" type="OS-KSADM:ServiceList">
        <annotation>
            <xsd:documentation
                    xml:lang="EN"
                    xmlns="http://www.w3.org/1999/xhtml">
                <p>
                    A list of services.
                </p>
            </xsd:documentation>
        </annotation>
    </element>
    
    <element name="service" type="OS-KSADM:Service"  >
        <annotation>
            <xsd:documentation
                    xml:lang="EN"
                    xmlns="http://www.w3.org/1999/xhtml">
                <p>
                    A service.
                </p>
            </xsd:documentation>
        </annotation>
    </element>
    
    <element name="extensibleCredentialsType" type="OS-KSADM:ExtensibleCredentialsType">
        <annotation>
            <xsd:documentation
                xml:lang="EN"
                xmlns="http://www.w3.org/1999/xhtml">
                <p>
                    An extensible credentials type.
                </p>
            </xsd:documentation>
        </annotation>
     </element>

    <!-- Complex Types -->
    <complexType name="Service">
        <attribute name="id" type="xsd:string" use="required"/>
        <attribute name="type" type="identity:ExtensibleServiceType" use="required"/>
        <attribute name="description" type="xsd:string"  use="optional"/>
        <anyAttribute namespace="##other" processContents="lax"/>
    </complexType>
    
    <complexType name="ServiceList">
        <sequence>
            <element name="service" type="OS-KSADM:Service" minOccurs="0" maxOccurs="unbounded"/>
            <element vc:minVersion="1.1" ref="atom:link" minOccurs="0" maxOccurs="unbounded" />
            <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" />
        </sequence>
        <anyAttribute namespace="##other" processContents="lax"/>
    </complexType>
    
    <simpleType name="PasswordCredentialsType">
        <restriction base="xsd:string">
            <enumeration value="password"/>
        </restriction>
    </simpleType>
    
    <simpleType name="ExtensionCredentialsType">
        <restriction base="xsd:string">
            <pattern value="(\w|-)+-\w+"/>
        </restriction>
    </simpleType>
    
    <simpleType name="ExtensibleCredentialsType">
        <union memberTypes="OS-KSADM:PasswordCredentialsType OS-KSADM:ExtensionCredentialsType"/>
    </simpleType>

    <!-- Complex Types -->
    <complexType name="UserWithOnlyEnabled">
        <complexContent>
            <restriction base="identity:User">
                <attribute name="id" type="xsd:ID" use="prohibited"/>
                <attribute name="email" type="xsd:string" use="prohibited"/>
                <attribute name="username" type="xsd:ID" use="prohibited"/>
                <attribute name="enabled" type="xsd:boolean" use="required"/>
            </restriction>
        </complexContent>
    </complexType>
</schema>