# typed: false
FactoryBot.define do
  factory :blob_file do
    transient { contents { "test content #{SecureRandom.alphanumeric(10)}" } }
    content_bytes { contents }
    size_bytes { contents.bytesize }
    content_type { "text/plain" }
    sha256 { Digest::SHA256.digest(contents) }
  end

  trait :image_blob do
    content_type { "image/jpeg" }
    transient do
      contents do
        File.read(
          Rails.root.join(
            "test/fixtures/files/images/thumb-036aaab6-low-quality.jpeg",
          ),
        )
      end
    end
  end

  trait :gif_blob do
    content_type { "image/gif" }
    transient do
      contents do
        File.read(
          Rails.root.join(
            "test/fixtures/files/images/e621-5418755-animated.gif",
          ),
        )
      end
    end
  end

  trait :webm_blob do
    content_type { "video/webm" }
    transient do
      contents do
        File.read(
          Rails.root.join(
            "test/fixtures/files/images/e621-5421402-animated.webm",
          ),
        )
      end
    end
  end

  trait :text_blob do
    content_type { "text/plain" }
    transient { contents { "test content #{SecureRandom.alphanumeric(10)}" } }
  end
end
