<xs:schema 
  xmlns:xs="http://www.w3.org/2001/XMLSchema" 
  xmlns:gen="http://xmlns.redhat.com/core/bebop/generator/1.0"
  xmlns:bebop="http://www.arsdigita.com/bebop/1.0"
  xmlns="http://xmlns.redhat.com/forums/1.0" 
  elementFormDefault="qualified" 
  targetNamespace="http://xmlns.redhat.com/forums/1.0">

  <xs:element name="forum" type="forumComponent">
  
  <xs:complexType name="forumComponent">
    <xs:annotation>
      <xs:appinfo>
        <gen:class>com.arsdigita.forum.ui.ForumComponent</gen:class>
      </xs:appinfo>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="forumMode" minOccurs="0" maxOccurs="unbounded" type="forumMode"/>

      <xs:choice>
        <xs:choice>
          <xs:annotation>
            <xs:appinfo>
              <gen:class>com.arsdigita.forum.ui.ForumUserView</gen:class>
            </xs:appinfo>
          </xs:annotation>

          <xs:sequence>
            <xs:element name="forumOptions" type="forumOptions"/>
            <xs:element name="topicSelector" type="topicSelector"/>
            <xs:element name="threadList" type="threadList"/>
          </xs:sequence>

          <xs:element name="bebop:form" type="bebopForm">
            <xs:annotation>
              <xs:appinfo>
                <gen:class>com.arsdigita.forum.ui.NewPostForm</gen:class>
              </xs:appinfo>
            </xs:annotation>       
          </xs:element>
        </xs:choice>

        <xs:choice>
          <xs:annotation>
            <xs:appinfo>
              <gen:class>com.arsdigita.forum.ui.CategoryView</gen:class>
            </xs:appinfo>
          </xs:annotation>

          <xs:sequence>
            <xs:element name="topicOptions" type="topicOptions"/>
            <xs:element name="topicList" type="topicList"/>
          </xs:sequence>

          <xs:element name="bebop:form" type="bebopForm">
            <xs:annotation>
              <xs:appinfo>
                <gen:class>com.arsdigita.forum.ui.CategoryAddForm</gen:class>
              </xs:appinfo>
            </xs:annotation>       
          </xs:element>
        </xs:choice>

        <xs:sequence>
          <xs:annotation>
            <xs:appinfo>
              <gen:class>com.arsdigita.forum.ui.ForumAlertsView</gen:class>
            </xs:appinfo>
          </xs:annotation>

          <xs:element name="forumAlerts" type="forumAlerts"/>
          <xs:element name="threadAlerts" type="threadAlerts"/>
        </xs:sequence>

        <xs:sequence>
          <xs:annotation>
            <xs:appinfo>
              <gen:class>com.arsdigita.forum.ui.admin.ModerationView</gen:class>
            </xs:appinfo>
          </xs:annotation>

          <xs:element name="bebop:form" type="bebopForm"/>
        </xs:sequence>
      </xs:choice>
    </xs:sequence>
  </xs:complexType>

 
  <xs:complexType name="threadComponent">
    <xs:choice>
      <xs:element name="bebop:form" type="bebopForm">
        <xs:annotation>
          <xs:appinfo>
            <gen:class>com.arsdigita.forum.ui.EditPostForm</gen:class>
          </xs:appinfo>
        </xs:annotation>       
      </xs:element>
      <xs:element name="bebop:form" type="bebopForm">
        <xs:annotation>
          <xs:appinfo>
            <gen:class>com.arsdigita.forum.ui.ReplyToPostForm</gen:class>
          </xs:appinfo>
        </xs:annotation>       
      </xs:element>
      <xs:element name="bebop:form" type="bebopForm">
        <xs:annotation>
          <xs:appinfo>
            <gen:class>com.arsdigita.forum.ui.RejectionForm</gen:class>
          </xs:appinfo>
        </xs:annotation>       
      </xs:element>
      <xs:sequence>
        <xs:element name="threadOptions" type="threadOptions"/>
        <xs:element name="threadDisplay" type="threadDisplay"/>
      </xs:element>
    </xs:choice>
  </xs:complexType>

  <xs:complexType name="forumMode">
    <xs:annotation>
      <xs:documentation xml:lang="en">
        A forum mode refers to one of the alternate
        views onto the forum application. The url
        attributes provides the link for switching
        into the mode.
      </xs:documentation>
    </xs:annotation>

    <xs:attribute name="mode" type="xs:string"/>
    <xs:attribute name="url" type="xs:anyURI"/>
    <xs:attribute name="selected" type="xs:boolean"/>
  </xs:complexType>

  <xs:complexType name="forumOptions">
    <xs:annotation>
      <xs:documentation xml:lang="en">
        A set of links relating to operations 
        in the thread list, such as posting
        a new message.
      </xs:documentation>
    </xs:annotation>

    <xs:sequence>
      <xs:element name="bebop:link" type="bebopLink"/>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="topicSelector">
    <xs:annotation>
      <xs:appinfo>
        <gen:class>com.arsdigita.forum.ui.TopicSelector</gen:class>
      </xs:appinfo>
    </xs:annotation>

    <xs:sequence>
      <xs:element name="topic">
        <xs:sequence>
           XXX DOR
        </xs:sequence>
      </xs:element>
    <xs:sequence>

    <xs:attribute name="baseURL" type="xs:anyURI"/>
    <xs:attribute name="param" type="xs:string"/>
    <xs:attribute name="anyTopicID" type="xs:integer"/>
    <xs:attribute name="noTopicID" type="xs:integer"/>
  </xs:complexType>


  <xs:complexType name="threadList">
    <xs:annotation>
      <xs:appinfo>
        <gen:class>com.arsdigita.forum.ui.ThreadList</gen:class>
      </xs:appinfo>
    </xs:annotation>

    <xs:sequence>
      <xs:element name="paginator" type="paginator"/>
      <xs:element name="thread" minOccurs="0" maxOccurs="unbounded">
        <xs:sequence>
           XXX DOR
        </xs:sequence>
        <xs:attribute name="url" type="xs:anyURI"/>
      </xs:element>
    <xs:sequence>
  </xs:complexType>

  <xs:complexType name="topicOptions">
    <xs:annotation>
      <xs:documentation xml:lang="en">
        A set of links relating to operations 
        in the topic list, such as creating
        a new topic.
      </xs:documentation>
    </xs:annotation>

    <xs:sequence>
      <xs:element name="bebop:link" type="bebopLink"/>
    </xs:sequence>
  </xs:complexType>


  <xs:complexType name="topicList">
    <xs:annotation>
      <xs:appinfo>
        <gen:class>com.arsdigita.forum.ui.TopicList</gen:class>
      </xs:appinfo>
    </xs:annotation>

    <xs:sequence>
      <xs:element name="topicSummary" minOccurs="0" maxOccurs="unbounded">
        <xs:sequence>
          <xs:element name="id"/>
          <xs:element name="name"/>
          <xs:element name="latestPost"/>
          <xs:element name="numThreads"/>
        </xs:sequence>
      </xs:element>
      <xs:element name="noTopicSummary">
        <xs:sequence>
          <xs:element name="latestPost"/>
          <xs:element name="numThreads"/>
        </xs:sequence>
        <xs:attribute name="url" type="xs:anyURI"/>
      </xs:element>
    <xs:sequence>

    <xs:attribute name="param" type="xs:string"/>
    <xs:attribute name="baseURL" type="xs:anyURI"/>
  </xs:complexType>

  <xs:complexType name="threadAlertList">
    <xs:annotation>
      <xs:appinfo>
        <gen:class>com.arsdigita.forum.ui.ThreadAlertList</gen:class>
      </xs:appinfo>
    </xs:annotation>

    <xs:sequence>
      <xs:element name="threadAlert" minOccurs="0" maxOccurs="unbounded">
        <xs:sequence>
           XXX DOR
        </xs:sequence>
        <xs:attribute name="url" type="xs:anyURI"/>
      </xs:element>
    <xs:sequence>    
  </xs:complexType>

  <xs:complexType name="forumAlerts">
    <xs:element name="bebop:form" type="bebopForm"/>
  </xs:complexType>

  <xs:complexType name="threadAlerts">
    <xs:element name="bebop:form" type="bebopForm"/>
  </xs:complexType>

  <xs:complexType name="threadOptions">
    <xs:annotation>
      <xs:documentation xml:lang="en">
        A set of links relating to operations 
        in the thread list, such as alert
        subscribe
      </xs:documentation>
    </xs:annotation>

    <xs:sequence>
      <xs:element name="bebop:link" type="bebopLink"/>
    </xs:sequence>
  </xs:complexType>


  <xs:complexType name="threadDisplay">
    <xs:annotation>
      <xs:appinfo>
        <gen:class>com.arsdigita.forum.ui.ThreadList</gen:class>
      </xs:appinfo>
    </xs:annotation>

    <xs:sequence>
      <xs:element name="paginator" type="paginator"/>
      <xs:element name="message" minOccurs="0" maxOccurs="unbounded">
        <xs:sequence>
           XXX DOR
        </xs:sequence>
        <xs:attribute name="approveURL" type="xs:anyURI" use="optional"/>
        <xs:attribute name="rejectURL" type="xs:anyURI" use="optional"/>
        <xs:attribute name="deleteURL" type="xs:anyURI" use="optional"/>
        <xs:attribute name="editURL" type="xs:anyURI" use="optional"/>
        <xs:attribute name="replyURL" type="xs:anyURI"/>
      </xs:element>
    <xs:sequence>
  </xs:complexType>


  <xs:complexType name="paginator">
    <xs:attribute name="param" type="xs:string"/>
    <xs:attribute name="baseURL" type="xs:anyURI"/>
    <xs:attribute name="pageNumber" type="xs:integer"/>
    <xs:attribute name="pageCount" type="xs:integer"/>
    <xs:attribute name="pageSize" type="xs:integer"/>
    <xs:attribute name="objectBegin" type="xs:long"/>
    <xs:attribute name="objectEnd" type="xs:long"/>
    <xs:attribute name="objectCount" type="xs:long"/>
  </xs:complexType>

  <xs:complexType name="bebopForm">
  </xs:complexType>

  <xs:complexType name="bebopLink">
  </xs:complexType>

</xs:schema>
