<p id="notice"><%= notice %></p>
<div class="panel card panel-default">
  <div class="panel-body card-body">
    <p class='bulkrax-p-align'>
      <strong><%= t('bulkrax.importer.labels.identifier') %>:</strong>
      <%= @entry.identifier %>
    </p>

    <p class='bulkrax-p-align'>
      <strong><%= t('bulkrax.importer.labels.entry_id') %>:</strong>
      <%= @entry.id %>
    </p>

    <p class='bulkrax-p-align'>
      <strong><%= t('bulkrax.importer.labels.type') %>:</strong>
      <%= @entry.factory_class || 'Unknown' %>
    </p>
    <%= render partial: 'raw_metadata'%>

    <%= render partial: 'parsed_metadata'%>

    <%= render partial: 'bulkrax/shared/bulkrax_errors', locals: {item: @entry} %>

    <p class="bulkrax-p-align">
      <% if @importer.present? %>
        <strong><%= t('bulkrax.importer.labels.importer') %>:</strong>
        <%= link_to @importer.name, importer_path(@importer) %>
      <% elsif @exporter.present? %>
        <strong><%= t('bulkrax.importer.labels.exporter') %>:</strong>
        <%= link_to @exporter.name, exporter_path(@exporter) %>
      <% end %>
    </p>

    <p class='bulkrax-p-align'>
      <% if @importer.present? %>
	<%# TODO Consider how to account for Bulkrax.collection_model_class %>
        <% factory_record = @entry.factory.find %>
        <% if factory_record.present? && @entry.factory_class %>
          <strong><%= @entry.factory_class.model_name.human %> Link:</strong>
          <% if defined?(Hyrax) && @entry.factory_class.model_name.human == 'Collection' %>
            <%= link_to @entry.factory_class.model_name.human, hyrax.polymorphic_path(factory_record) %>
          <% else %>
            <%= link_to @entry.factory_class.model_name.human, main_app.polymorphic_path(factory_record) %>
          <% end %>
        <% else %>
          <strong>Item Link:</strong> Item has not yet been imported successfully
        <% end %>
      <% else %>
        <% record = @entry&.hyrax_record %>
        <% if record.present? && @entry.factory_class %>
          <strong><%= record.model_name.human %> Link:</strong>
          <% if defined?(Hyrax) && record.model_name.human == "Collection" %>
            <%= link_to record.model_name.human, hyrax.polymorphic_path(record) %>
          <% else %>
            <%= link_to record.model_name.human, main_app.polymorphic_path(record) %>
          <% end %>
        <% else %>
          <strong>Item Link:</strong> No item associated with this entry or class unknown
        <% end %>
      <% end %>
    </p>

  </div>
</div>