module DropzoneHelper
  def dropzone_placeholder_message_for(releasable)
    case releasable.model_name.param_key
    when "acquired_media_release"
      "To Add Photos & Videos to the release:<br>Drag & Drop Files<br>or<br>Click or Tap here to browse photos and connect to Camera"
    when "material_release"
      t 'material_releases.form.photos.dropzone_label'
    when "music_release"
      "To Add Audio Files to the release:<br>Drag & Drop Files<br>or<br>Click or Tap here to browse files"
    when "location_release"
      t 'location_releases.form.photos.dropzone_label'
    when "directory"
      "To Add Files to the Folder:<br>Drag & Drop Files<br>or<br>Click or Tap here to browse files"
    else
      "To Add Photos to the release:<br>Drag & Drop Files<br>or<br>Click or Tap here to browse photos and connect to Camera"
    end
  end

  def dropzone_accepted_files_for(releasable)
    case releasable.model_name.param_key
    when "appearance_release", "talent_release", "location_release", "material_release"
      "image/*"
    when "music_release"
      "audio/*"
    else
      nil
    end
  end

  def mock_photos_json(photos)
    photos.map do |photo|
      { name: photo.filename, size: photo.blob.byte_size, type: photo.content_type, dataURL: rails_blob_path(photo) }
    end.to_json
  end

  def mock_file_infos_json(file_infos)
    file_infos.map do |file_info|
      { name: file_info.filename, size: file_info.byte_size, type: file_info.content_type }
    end.to_json
  end
end
