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

<grammar ns="http://buildservice.org/api" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">

  <start>
    <ref name="person-element"/>
  </start>

  <define ns="" name="person-element">
    <element name="person">
      <interleave>
        <element name="login"><text/></element>
        <optional>
          <element name="email"><text/></element>
        </optional>
        <optional>
          <element name="realname"><text/></element>
        </optional>
        <optional>
          <element name="owner">
            <attribute name="userid">
              <data type="string" />
            </attribute>
            <empty/>
          </element>
        </optional>
        <optional>
          <element name="state"><text/></element>
        </optional>
        <zeroOrMore>
          <element name="globalrole"><text/></element>
        </zeroOrMore>
        <optional>
          <element name="watchlist">
            <interleave>
              <zeroOrMore>
                <element name="project">
                  <attribute name="name">
                    <data type="string" />
                  </attribute>
                  <empty/>
                </element>
              </zeroOrMore>
              <zeroOrMore>
                <element name="package">
                  <attribute name="name">
                    <data type="string"/>
                  </attribute>
                  <attribute name="project">
                    <data type="string"/>
                  </attribute>
                  <empty/>
                </element>
              </zeroOrMore>
              <zeroOrMore>
                <element name="request">
                  <attribute name="number">
                    <data type="string" />
                  </attribute>
                  <empty/>
                </element>
              </zeroOrMore>
            </interleave>
          </element>
        </optional>
      </interleave>
      <empty/>
    </element>
  </define>

</grammar>

