<p id="notice"><%= notice %></p>
<div class="panel panel-default">
  <div class="panel-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? %>
        <% factory_record = @entry.factory.find %>
        <% if factory_record.present? && @entry.factory_class %>
          <strong><%= @entry.factory_class.to_s %> Link:</strong>
          <% if @entry.factory_class.to_s == 'Collection' %>
            <%= link_to @entry.factory_class.to_s, hyrax.polymorphic_path(factory_record) %>
          <% else %>
            <%= link_to @entry.factory_class.to_s, 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.class.to_s %> Link:</strong>
          <% if defined?(Collection) && record.is_a?(Collection) %>
            <%= link_to record.class.to_s, hyrax.polymorphic_path(record) %>
          <% else %>
            <%= link_to record.class.to_s, 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>