<configure
    xmlns="http://namespaces.zope.org/zope"
    xmlns:browser="http://namespaces.zope.org/browser"
    xmlns:five="http://namespaces.zope.org/five"
    xmlns:genericsetup="http://namespaces.zope.org/genericsetup"
    xmlns:i18n="http://namespaces.zope.org/i18n"
    xmlns:plone="http://namespaces.plone.org/plone"
    i18n_domain="senaite.impress">

  <five:registerPackage package="." initialize=".initialize" />

  <!-- Include extended Fields -->
  <include package=".extender"/>

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

  <!-- Needed for bika.lims.ManageBika permission -->
  <include package="bika.lims" file="permissions.zcml" />

  <!-- AR specific Reports -->
  <include package=".analysisrequest" />

  <!-- Publish Controller View

       TODO: Rename to `publish` for drop-in replacement as soon as this package
             is ready for production
  -->
  <browser:page
      for="*"
      name="printview"
      class="senaite.impress.publishview.PublishView"
      permission="bika.lims.ManageAnalysisRequests"
      layer="senaite.impress.interfaces.ILayer"
      />

  <!-- Analysis Requests Folder Publish -->
  <browser:page
      for="bika.lims.interfaces.IAnalysisRequestsFolder"
      name="publish"
      class="senaite.impress.publishview.PublishView"
      permission="bika.lims.ManageAnalysisRequests"
      layer="senaite.impress.interfaces.ILayer"
      />

  <!-- Client Publish -->
  <browser:page
      for="bika.lims.interfaces.IClient"
      name="publish"
      class="senaite.impress.publishview.PublishView"
      permission="bika.lims.ManageAnalysisRequests"
      layer="senaite.impress.interfaces.ILayer"
      />

  <!-- Analysis Request Publish -->
  <browser:page
      for="bika.lims.interfaces.IAnalysisRequest"
      name="publish"
      class="senaite.impress.publishview.PublishView"
      permission="bika.lims.ManageAnalysisRequests"
      layer="senaite.impress.interfaces.ILayer"
      />

  <!-- Batch Publish -->
  <browser:page
      for="bika.lims.interfaces.IBatch"
      name="publish"
      class="senaite.impress.publishview.PublishView"
      permission="bika.lims.ManageAnalysisRequests"
      layer="senaite.impress.interfaces.ILayer"
      />

  <!-- Ajax Publish Controller View -->
  <browser:page
      for="*"
      name="ajax_publish"
      class="senaite.impress.ajax.AjaxPublishView"
      permission="zope.Public"
      layer="senaite.impress.interfaces.ILayer"
      />

  <!-- Publisher Controlpanel -->
  <browser:page
      name="impress-controlpanel"
      for="Products.CMFPlone.interfaces.IPloneSiteRoot"
      class=".controlpanel.ImpressControlPanelView"
      permission="bika.lims.ManageBika"
      layer="senaite.impress.interfaces.ILayer"
      />

  <!-- Reports listing view -->
  <browser:page
      for="bika.lims.interfaces.IClient"
      name="reports_listing"
      class=".reports_listing.ReportsListingView"
      permission="bika.lims.ManageAnalysisRequests"
      layer="senaite.impress.interfaces.ILayer"
      />

  <!-- Email View -->
  <browser:page
      for="bika.lims.interfaces.IClient"
      name="email"
      class=".emailview.EmailView"
      permission="bika.lims.ManageAnalysisRequests"
      layer="senaite.impress.interfaces.ILayer"
      />

  <!-- Download View for AR Reports (PDFs) -->
  <browser:page
      for="*"
      name="download_pdf"
      class=".downloadview.DownloadView"
      permission="bika.lims.ManageAnalysisRequests"
      layer="senaite.impress.interfaces.ILayer"
      />

  <!-- Generic Report Model -->
  <adapter
      for="*"
      factory="senaite.impress.reportmodel.ReportModel"
      />

  <!-- HTML/PDF Publisher Utility -->
  <utility
      provides="senaite.impress.interfaces.IPublisher"
      factory="senaite.impress.publisher.Publisher"
      />

  <!-- Template Finder Utility -->
  <utility
      provides="senaite.impress.interfaces.ITemplateFinder"
      factory="senaite.impress.template.TemplateFinder"
      />

  <!-- Template Vocabulary -->
  <utility
      name="senaite.impress.vocabularies.Templates"
      component="senaite.impress.vocabularies.TemplateVocabularyFactory"
      />

  <!-- Paper Format Vocabulary -->
  <utility
      name="senaite.impress.vocabularies.Paperformats"
      component="senaite.impress.vocabularies.PaperformatVocabularyFactory"
      />

  <!-- Orientation Vocabulary -->
  <utility
      name="senaite.impress.vocabularies.Orientations"
      component="senaite.impress.vocabularies.OrientationVocabularyFactory"
      />

  <!-- Report resource directory -->
  <plone:static
      directory="templates/reports"
      type="senaite.impress.reports"
      />

  <!-- Static resource directory -->
  <browser:resourceDirectory
      name="senaite.impress.static"
      directory="static"
      />

  <!-- Generic Setup *INSTALL* Profile -->
  <genericsetup:registerProfile
      name="default"
      title="SENAITE IMPRESS"
      directory="profiles/default"
      description="HTML to PDF report engine for SENAITE"
      post_handler="senaite.impress.setuphandlers.post_install"
      provides="Products.GenericSetup.interfaces.EXTENSION"
      />

  <!-- Generic Setup *UNINSTALL* Profile -->
  <genericsetup:registerProfile
      name="uninstall"
      title="SENAITE IMPRESS"
      directory="profiles/uninstall"
      description="HTML to PDF report engine for SENAITE"
      post_handler="senaite.impress.setuphandlers.post_uninstall"
      provides="Products.GenericSetup.interfaces.EXTENSION"
      />

</configure>
