<configure
    xmlns="http://namespaces.zope.org/zope"
    xmlns:browser="http://namespaces.zope.org/browser"
    xmlns:i18n="http://namespaces.zope.org/i18n"
    i18n_domain="senaite.core">
  
  <subscriber
      for="bika.lims.events.remarks.IRemarksAddedEvent"
      handler=".remarks.RemarksAddedEventHandler"
      />

  <!-- ID Server: Object Added -->
  <subscriber
      for="bika.lims.interfaces.IAutoGenerateID
           zope.lifecycleevent.interfaces.IObjectAddedEvent"
      handler=".objectadded.auto_generate_id"
      />

  <!-- Audit Log: AT Object Created -->
  <subscriber
      for="Products.Archetypes.interfaces.IBaseObject
           Products.Archetypes.interfaces.IObjectInitializedEvent"
      handler=".auditlog.ObjectInitializedEventHandler"
      />

  <!-- Audit Log: Dexterity Object Created -->
  <subscriber
      for="plone.dexterity.interfaces.IDexterityContent
           zope.lifecycleevent.interfaces.IObjectAddedEvent"
      handler=".auditlog.ObjectInitializedEventHandler"
      />

  <!-- Audit Log: AT Object Modified -->
  <subscriber
      for="Products.Archetypes.interfaces.IBaseObject
           Products.Archetypes.interfaces.IObjectEditedEvent"
      handler=".auditlog.ObjectModifiedEventHandler"
      />

  <!-- Audit Log: Dexterity Object Modified -->
  <subscriber
      for="plone.dexterity.interfaces.IDexterityContent
           zope.lifecycleevent.interfaces.IObjectModifiedEvent"
      handler=".auditlog.ObjectModifiedEventHandler"
      />

  <!-- Audit Log: After Transition Event -->
  <subscriber
      for="*
           Products.CMFCore.interfaces.IActionSucceededEvent"
      handler=".auditlog.ObjectTransitionedEventHandler"
      />

  <!-- Audit Log: Object removed Event -->
  <subscriber
      for="*
           zope.lifecycleevent.interfaces.IObjectRemovedEvent"
      handler=".auditlog.ObjectRemovedEventHandler"
      />

  <!-- Newly created analyses -->
  <subscriber
      for="*
           zope.lifecycleevent.interfaces.IObjectModifiedEvent"
      handler="bika.lims.subscribers.objectmodified.ObjectModifiedEventHandler"
      />

  <!-- Newly created analyses (applies to routine analyses only) -->
  <subscriber
      for="bika.lims.interfaces.IRoutineAnalysis
           Products.Archetypes.interfaces.IObjectInitializedEvent"
      handler="bika.lims.subscribers.analysis.ObjectInitializedEventHandler"
      />

  <!-- Deleted analyses (applies to routine analyses only) -->
  <subscriber
      for="bika.lims.interfaces.IRoutineAnalysis
           zope.lifecycleevent.interfaces.IObjectRemovedEvent"
      handler="bika.lims.subscribers.analysis.ObjectRemovedEventHandler"
      />

  <!-- Pricelists -->
  <subscriber
      for="bika.lims.interfaces.IPricelist
           zope.lifecycleevent.interfaces.IObjectModifiedEvent"
      handler="bika.lims.subscribers.pricelist.ObjectModifiedEventHandler"
      />

  <!-- Setup: Object modified event -->
  <subscriber
    for="bika.lims.interfaces.IBikaSetup
         zope.lifecycleevent.interfaces.IObjectModifiedEvent"
    handler="bika.lims.subscribers.setup.ObjectModifiedEventHandler" />

  <!-- AnalysisRequest modified
  Apply permissions to object in accordance with the value for InternalUse -->
  <subscriber
    for="bika.lims.interfaces.IAnalysisRequest
         zope.lifecycleevent.interfaces.IObjectModifiedEvent"
    handler="bika.lims.subscribers.analysisrequest.ObjectModifiedEventHandler"
  />

  <!-- AnalysisRequest After Transition
  This subscriber does not override the generic subscriber in charge of handling
  transitions, but is used to update the permissions of the AnalysisRequest in
  accordance with the value for setting InternalUse -->
  <subscriber
    for="bika.lims.interfaces.IAnalysisRequest
         Products.DCWorkflow.interfaces.IAfterTransitionEvent"
    handler="bika.lims.subscribers.analysisrequest.AfterTransitionEventHandler"
  />

  <!-- Batch modified event
  This subscriber moves a Batch to its corresponding client folder when the
  the batch is being created in batches folder and a client is set. This only
  happens when the Batch is created by lab personnel, cause batches created by
  client contacts are directly created inside their own folder.
  Therefore, this behaviour allows client contacts to access to batches that
  were created by lab personnel and were assigned to their client.
  -->
  <subscriber
    for="bika.lims.interfaces.IBatch
         zope.lifecycleevent.interfaces.IObjectModifiedEvent"
    handler="bika.lims.subscribers.batch.ObjectModifiedEventHandler" />

</configure>
