<commit_before># frozen_string_literal: true

require_dependency 'folio/concerns/thumbnails'

class Folio::Image < Folio::File
  include Folio::Thumbnails

  paginates_per 36

  VALID_FORMATS = %w{jpeg png bmp gif}

  # Validations
  validates_property :format, of: :file, in: VALID_FORMATS

  # Callbacks
  before_destroy do
    DeleteThumbnailsJob.perform_later(self.thumbnail_sizes)
  end
end

# == Schema Information
#
# Table name: folio_files
#
#  id              :integer          not null, primary key
#  file_uid        :string
#  file_name       :string
#  type            :string
#  thumbnail_sizes :text             default({})
#  created_at      :datetime         not null
#  updated_at      :datetime         not null
#  file_width      :integer
#  file_height     :integer
#  file_size       :integer
#  mime_type       :string(255)
#
# Indexes
#
#  index_folio_files_on_type  (type)
#<commit_msg>F image<commit_after># frozen_string_literal: true

require_dependency 'folio/concerns/thumbnails'

class Folio::Image < Folio::File
  include Folio::Thumbnails

  paginates_per 36

  VALID_FORMATS = %w{jpeg png bmp gif}

  # Validations
  validates_property :format, of: :file, in: VALID_FORMATS

  # Callbacks
  before_destroy do
    Folio::DeleteThumbnailsJob.perform_later(self.thumbnail_sizes)
  end
end

# == Schema Information
#
# Table name: folio_files
#
#  id              :integer          not null, primary key
#  file_uid        :string
#  file_name       :string
#  type            :string
#  thumbnail_sizes :text             default({})
#  created_at      :datetime         not null
#  updated_at      :datetime         not null
#  file_width      :integer
#  file_height     :integer
#  file_size       :integer
#  mime_type       :string(255)
#
# Indexes
#
#  index_folio_files_on_type  (type)
#
{'fraction_non_alphanumeric': 0.08328767123287671, 'fraction_numerical': 0.005479452054794521, 'mean_word_length': 2.757201646090535, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '483385', 'n_tokens_mistral': 635, 'n_tokens_neox': 607, 'n_words': 139}