<?xml version="1.0" encoding="UTF-8" ?>

<xsd:schema xmlns="http://friendsofsymfony.github.com/schema/rest"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://friendsofsymfony.github.com/schema/rest"
    elementFormDefault="qualified">

  <xsd:element name="routes" type="routes" />

  <xsd:complexType name="routes">
    <xsd:choice maxOccurs="unbounded" minOccurs="0">
      <xsd:element name="import" type="import" />
      <xsd:element name="route" type="route" />
    </xsd:choice>
  </xsd:complexType>

  <!-- configs and route should be kept in sync with symfony schema -->
  <xsd:group name="configs">
    <xsd:choice>
        <xsd:element name="default" nillable="true" type="element" />
        <xsd:element name="requirement" type="element" />
        <xsd:element name="option" type="element" />
    </xsd:choice>
  </xsd:group>

  <xsd:complexType name="route">
    <xsd:group ref="configs" minOccurs="0" maxOccurs="unbounded" />

    <xsd:attribute name="id" type="xsd:string" use="required" />
    <xsd:attribute name="path" type="xsd:string" />
    <xsd:attribute name="pattern" type="xsd:string" />
    <xsd:attribute name="host" type="xsd:string" />
    <xsd:attribute name="schemes" type="xsd:string" />
    <xsd:attribute name="methods" type="xsd:string" />
  </xsd:complexType>

  <xsd:complexType name="import">
    <xsd:attribute name="id" type="xsd:string" />
    <xsd:attribute name="resource" type="xsd:string" />
    <xsd:attribute name="type" type="xsd:string" />
    <xsd:attribute name="prefix" type="xsd:string" />
    <xsd:attribute name="name-prefix" type="xsd:string" />
    <xsd:attribute name="parent" type="xsd:string" />
    <xsd:attribute name="class" type="xsd:string" />
  </xsd:complexType>

  <xsd:complexType name="element" mixed="true">
    <xsd:attribute name="key" type="xsd:string" />
  </xsd:complexType>
</xsd:schema>
