<?xml version="1.0"?>
<configure xmlns="http://namespaces.zope.org/zope">

  <!-- layers -->

  <class class=".model.LayerContainer">
    <allow interface="zope.container.interfaces.ISimpleReadContainer" />
    <require permission="schooltool.view"
             attributes="keys values items __iter__ __len__" />
    <require permission="schooltool.edit"
             interface="zope.container.interfaces.IWriteContainer" />
  </class>

  <class class=".model.Layer">
    <require permission="schooltool.view"
             interface=".interfaces.ILayer" />
    <require permission="schooltool.edit"
             set_schema=".interfaces.ILayer" />
  </class>

  <adapter
      for=".interfaces.ILayerContainer"
      factory="schooltool.app.app.SimpleNameChooser"
      provides="zope.container.interfaces.INameChooser" />

  <adapter
      for="schooltool.app.interfaces.ISchoolToolApplication"
      factory=".model.LayerAppInit"
      name="schooltool.cando.layer" />

  <adapter
      for="schooltool.app.interfaces.ISchoolToolApplication"
      factory=".model.LayerStartUp"
      name="schooltool.cando.layer" />
  <adapter factory=".model.getLayerContainer" />

  <!-- nodes -->

  <class class=".model.NodeContainer">
    <allow interface="zope.container.interfaces.ISimpleReadContainer" />
    <require permission="schooltool.view"
             attributes="keys values items __iter__ __len__" />
    <require permission="schooltool.edit"
             interface="zope.container.interfaces.IWriteContainer" />
  </class>

  <class class=".model.Node">
    <require permission="schooltool.view"
             interface=".interfaces.INode" />
    <require permission="schooltool.edit"
             set_schema=".interfaces.INode" />
  </class>

  <adapter
      for=".interfaces.INodeContainer"
      factory="schooltool.app.app.SimpleNameChooser"
      provides="zope.container.interfaces.INameChooser" />

  <adapter
      for="schooltool.app.interfaces.ISchoolToolApplication"
      factory=".model.NodeAppInit"
      name="schooltool.cando.node" />

  <adapter
      for="schooltool.app.interfaces.ISchoolToolApplication"
      factory=".model.NodeStartUp"
      name="schooltool.cando.node" />

  <adapter factory=".model.getNodeContainer" />

  <subscriber
      for="schooltool.relationship.interfaces.IBeforeRelationshipEvent"
      handler=".model.preventLayerCycles"
    />

  <!-- documents -->

  <class class=".model.DocumentContainer">
    <allow interface="zope.container.interfaces.ISimpleReadContainer" />
    <require permission="schooltool.view"
             attributes="keys values items __iter__ __len__" />
    <require permission="schooltool.edit"
             interface="zope.container.interfaces.IWriteContainer" />
  </class>

  <class class=".model.Document">
    <require permission="schooltool.view"
             interface=".interfaces.IDocument" />
    <require permission="schooltool.edit"
             set_schema=".interfaces.IDocument" />
  </class>

  <adapter
      for=".interfaces.IDocumentContainer"
      factory="schooltool.app.app.SimpleNameChooser"
      provides="zope.container.interfaces.INameChooser" />

  <adapter
      for="schooltool.app.interfaces.ISchoolToolApplication"
      factory=".model.DocumentAppInit"
      name="schooltool.cando.document" />

  <adapter
      for="schooltool.app.interfaces.ISchoolToolApplication"
      factory=".model.DocumentStartUp"
      name="schooltool.cando.document" />

  <adapter factory=".model.getDocumentContainer" />

</configure>
