<%= s_('Notify|Here are the results for your CSV import for %{project_name} (%{project_link}).') % { project_name: @project.full_name, project_link: project_url(@project) } %>

<% success_lines = @results[:success] %>
<% if success_lines > 0 %>
  <% work_items = n_('%d work item', '%d work items', success_lines) % success_lines %>
  <%= s_('Notify|%{work_items} successfully imported.') % { work_items: work_items } %>
<% else %>
  <%= s_('Notify|No work items have been imported.') %>

  <% if @results[:parse_error] %>
    <%= s_('Notify|Error parsing CSV file. Please make sure it has the correct format: a delimited text file that uses a comma to separate values.') %>
  <% end %>
<% end %>

<% type_errors = @results[:type_errors] %>
<%
  if type_errors
    blank_lines = type_errors[:blank]
    missing_lines = type_errors[:missing]
    disallowed_lines = type_errors[:disallowed]
%>
  <%= s_('Notify|Some values in the "type" column could not be matched with supported work item types:') %>

  <% if blank_lines.present? %>
    <%= s_('Notify|%{singular_or_plural_line} %{error_lines}: Work item type is empty.') % { singular_or_plural_line: n_('Line', 'Lines', blank_lines.size), error_lines: blank_lines.join(', ') } %>
  <% end %>

  <% if missing_lines.present? %>
    <%= s_('Notify|%{singular_or_plural_line} %{error_lines}: Work item type cannot be found or is not supported.') % { singular_or_plural_line: n_('Line', 'Lines', missing_lines.size), error_lines: missing_lines.join(', ') } %>
  <% end %>

  <% if disallowed_lines.present? %>
    <%= s_('Notify|%{singular_or_plural_line} %{error_lines}: Work item type is not available. Please check your license and permissions.') % { singular_or_plural_line: n_('Line', 'Lines', disallowed_lines.size), error_lines: disallowed_lines.join(', ') } %>
  <% end %>
<% end %>

<%
  error_lines = @results[:error_lines]
  if error_lines.present?
%>
  <%= s_('Notify|Errors found on %{singular_or_plural_line}: %{error_lines}. Please check that these lines have the following fields: %{required_headers}.') % { singular_or_plural_line: n_('line', 'lines', error_lines.size), required_headers: WorkItems::ImportCsvService.required_headers.join(', '),
  error_lines: error_lines.join(', ') } %>
<% end %>

<% if error_lines.present? || type_errors %>
  <%= s_('Notify|Please fix the lines with errors and try the CSV import again.') %>
<% end %>

