<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<configuration>
  <source>
    <!-- Define different entity types -->
    <entity id="e1" name="login" label="Login" type="string" required="true">
      <rule expr="len($login) ge 2" msg="Login must have a length of greater or equal than 2"></rule>
    </entity>
    <entity id="e1o" name="login" label="Login" type="string">
      <renderer type="hidden"/>
    </entity>
    <entity id="e2o" name="oldpassword" label="Old Password">
      <renderer type="password"/>
    </entity>
    <entity id="e2" name="password" label="Password">
      <renderer type="password"/>
      <rule expr="$password == $retype_password" msg="Passwords must be equal"></rule>
    </entity>
    <entity id="e3" name="retype_password" label="Retype Password">
      <renderer type="password"/>
    </entity>
    <entity id="e4" name="roles" label="Roles"/>
    <entity id="e5" name="groups" label="Usergroups"/>
    <entity id="e6" name="default_group" label="Default group"/>
    <entity id="e7" name="activated" label="Activated">
      <renderer type="radio">
        <label align="left"/>
      </renderer>
      <options>
        <option value="True">Yes</option>
        <option value="False">No</option>
      </options>
    </entity>
    <entity id="e8" name="activation_token" label="Activation Token">
      <help>The activation token can be used to (re)activate a deactivated or new registered user. Please call /auth/activate_user/$token to active the user.</help>
    </entity>
    <entity id="e9" name="profile" label="Profile" readonly="true">
      <renderer type="dropdown"/>
    </entity>
  </source>
  <form id="create" autocomplete="off" method="POST" action="" enctype="multipart/form-data">
    <snippet ref="create_snippet"/>
  </form>
  <form id="update" autocomplete="off" >
    <snippet ref="update_snippet"/>
  </form>
  <form id="read" readonly="true">
    <snippet ref="update_snippet"/>
  </form>
  <form id="changepassword"  autocomplete="off" method="POST" action="" enctype="multipart/form-data">
    <field ref="e1o"></field>
    <row>
      <col><field ref="e2o"></field></col>
    </row>
    <row>
      <col><field ref="e2"></field></col>
    </row>
    <row>
      <col><field ref="e3"></field></col>
    </row>
  </form>

  <!-- Create-->
  <snippet id="create_snippet">
    <snippet ref="s1c"/>
    <snippet ref="s2"/>
    <snippet ref="s3"/>
  </snippet>
  <!-- Create-->
  <snippet id="update_snippet">
    <snippet ref="s1e"/>
    <snippet ref="s3"/>
  </snippet>

  <!-- Login -->
  <snippet id="s1c">
    <row>
      <col><field ref="e1"/></col>
    </row>
  </snippet>
  <snippet id="s1e">
    <row>
      <col><field ref="e1"/></col>
      <col><field ref="e9"/></col>
    </row>
  </snippet>
  <!-- Password -->
  <snippet id="s2">
    <row>
      <col><field ref="e2"/></col>
      <col><field ref="e3"/></col>
    </row>
  </snippet>
  <!-- Roles and Groups etc. -->
  <snippet id="s3">
    <row>
      <col><field ref="e4"/></col>
    </row>
    <row>
      <col><field ref="e5"/></col>
      <col><field ref="e6"/></col>
    </row>
    <row>
      <col><field ref="e7"/></col>
      <col><field ref="e8"/></col>
    </row>
  </snippet>
</configuration>
