<?xml version="1.0" encoding="utf-8"?>
<configure
    xmlns="http://namespaces.zope.org/zope"
    xmlns:i18n="http://namespaces.zope.org/i18n"
    i18n_domain="schooltool.intervention">

  <include file="security.zcml" />

  <!-- The objects -->
  <class class=".intervention.InterventionRoot">
    <implements interface=".interfaces.IInterventionRoot" />
    <implements interface=".interfaces.IInterventionRootMarker" />
    <require
        permission="schooltool.view"
        interface=".interfaces.IInterventionRoot" />
  </class>
  <class class=".intervention.InterventionSchoolYear">
    <implements interface=".interfaces.IInterventionSchoolYear" />
    <implements interface=".interfaces.IInterventionRootMarker" />
    <require
        permission="schooltool.view"
        interface=".interfaces.IInterventionSchoolYear" />
  </class>
  <class class=".intervention.InterventionStudent">
    <implements interface=".interfaces.IInterventionStudent" />
    <implements interface=".interfaces.IInterventionStudentMarker" />
    <require
        permission="schooltool.edit"
        set_schema=".interfaces.IInterventionStudent" />
    <require
        permission="schooltool.view"
        interface=".interfaces.IInterventionStudent" />
  </class>
  <class class=".intervention.InterventionMessages">
    <implements interface=".interfaces.IInterventionMessages" />
    <implements interface=".interfaces.IInterventionStudentMarker" />
    <require
        permission="schooltool.edit"
        set_schema=".interfaces.IInterventionMessages" />
    <require
        permission="schooltool.view"
        interface=".interfaces.IInterventionMessages" />
  </class>
  <class class=".intervention.InterventionMessage">
    <implements interface=".interfaces.IInterventionMessage" />
    <implements interface=".interfaces.IInterventionMarker" />
    <require
        permission="schooltool.edit"
        set_schema=".interfaces.IInterventionMessage" />
    <require
        permission="schooltool.view"
        interface=".interfaces.IInterventionMessage" />
  </class>
  <class class=".intervention.InterventionGoals">
    <implements interface=".interfaces.IInterventionGoals" />
    <implements interface=".interfaces.IInterventionStudentMarker" />
    <require
        permission="schooltool.edit"
        set_schema=".interfaces.IInterventionGoals" />
    <require
        permission="schooltool.view"
        interface=".interfaces.IInterventionGoals" />
  </class>
  <class class=".intervention.InterventionGoal">
    <implements interface=".interfaces.IInterventionGoal" />
    <implements interface=".interfaces.IInterventionMarker" />
    <require
        permission="schooltool.edit"
        set_schema=".interfaces.IInterventionGoal" />
    <require
        permission="schooltool.view"
        interface=".interfaces.IInterventionGoal" />
  </class>

  <!-- The application hook -->
  <adapter
      factory=".intervention.InterventionInit"
      name="schooltool.interventions" />
  <adapter
      factory=".intervention.InterventionStartup"
      name="schooltool.interventions" />

  <!-- Various adapters -->
  <adapter
      factory=".intervention.getSchoolYearInterventionSchoolYear" />
  <adapter
      factory=".intervention.getSchoolToolApplicationInterventionSchoolYear" />
  <adapter
      factory=".intervention.getInterventionSchoolYearSchoolYear" />
  <adapter
      factory=".intervention.getMarkerInterventionStudent" />
  <adapter
      for=".interfaces.IInterventionStudent"
      provides=".interfaces.IInterventionSchoolYear"
      factory=".intervention.getInterventionSchoolYearFromObj" />
  <adapter
      for=".interfaces.IInterventionMessages"
      provides=".interfaces.IInterventionSchoolYear"
      factory=".intervention.getInterventionSchoolYearFromObj" />
  <adapter
      for=".interfaces.IInterventionMessage"
      provides=".interfaces.IInterventionSchoolYear"
      factory=".intervention.getInterventionSchoolYearFromObj" />
  <adapter
      for=".interfaces.IInterventionGoals"
      provides=".interfaces.IInterventionSchoolYear"
      factory=".intervention.getInterventionSchoolYearFromObj" />
  <adapter
      for=".interfaces.IInterventionGoal"
      provides=".interfaces.IInterventionSchoolYear"
      factory=".intervention.getInterventionSchoolYearFromObj" />

  <!-- The name choosers -->
  <adapter
      for=".interfaces.IInterventionMessages"
      factory=".intervention.SequenceNumberNameChooser"
      provides="zope.container.interfaces.INameChooser" />
  <adapter
      for=".interfaces.IInterventionGoals"
      factory=".intervention.SequenceNumberNameChooser"
      provides="zope.container.interfaces.INameChooser" />

  <!-- Vocabularies -->
  <utility
     factory=".vocabularies.advisorVocabularyFactory"
     provides="zope.schema.interfaces.IVocabularyFactory"
     name="schooltool.intervention.advisor_source" />

  <!-- Sending email -->
  <subscriber
      for="schooltool.intervention.interfaces.IInterventionMessage zope.lifecycleevent.interfaces.IObjectAddedEvent"
      handler=".sendmail.sendInterventionMessageEmail"
      />
  <subscriber
      for="schooltool.intervention.interfaces.IInterventionGoal zope.lifecycleevent.interfaces.IObjectAddedEvent"
      handler=".sendmail.sendInterventionGoalAddEmail"
      />

  <!-- generations -->
  <utility
      name="schooltool.intervention"
      provides="zope.app.generations.interfaces.ISchemaManager"
      component=".generations.schemaManager"
      />

  <!-- object event subscribers -->
   <adapter
      factory=".intervention.PersonRemovedSubsciber"
      name="handle_person_removed" />
   <adapter
      factory=".intervention.SchoolYearRemovedSubsciber"
      name="handle_schoolyear_removed" />

  <!-- catalog -->
  <subscriber
      for="schooltool.app.interfaces.ICatalogSetUpEvent"
      handler=".catalog.catalogSetUpSubscriber"
      />
  <adapter
      for=".interfaces.IInterventionRoot"
      provides="zope.catalog.interfaces.ICatalog"
      factory=".catalog.getInterventionCatalog" />
  <adapter
      for=".interfaces.IInterventionMessage"
      provides=".interfaces.IInterventionPersonsResponsible"
      factory=".catalog.getMessagePersonsResponsible" />
  <adapter
      for=".interfaces.IInterventionGoal"
      provides=".interfaces.IInterventionPersonsResponsible"
      factory=".catalog.getGoalPersonsResponsible" />
  <adapter
      for=".interfaces.IInterventionMessage"
      provides=".interfaces.IInterventionType"
      factory=".catalog.getMessageType" />
  <adapter
      for=".interfaces.IInterventionGoal"
      provides=".interfaces.IInterventionType"
      factory=".catalog.getGoalType" />
  <adapter
      for=".interfaces.IInterventionMessage"
      provides=".interfaces.IInterventionGetter"
      factory=".catalog.messageGetter" />
  <adapter
      for=".interfaces.IInterventionGoal"
      provides=".interfaces.IInterventionGetter"
      factory=".catalog.goalGetter" />

  <include file="traversal.zcml" />
  <include package=".browser" />

  <!-- Translations -->
  <i18n:registerTranslations directory="locales" />

</configure>
