FactoryBot.define do
  factory :video do
    association :project

    file do
      path = Rails.root.join("spec", "fixtures", "files", "video_file.mp4")
      Rack::Test::UploadedFile.new(path, "video/mp4")
    end

    edl_file do
      path = Rails.root.join("spec", "fixtures", "files", "sample-edl.edl")
      Rack::Test::UploadedFile.new(path, "application/octet-stream")
    end

    trait :with_graphics_only_edl_file do
      graphics_only_edl_file do
        path = Rails.root.join("spec", "fixtures", "files", "sample-edl.edl")
        Rack::Test::UploadedFile.new(path, "application/octet-stream")
      end
    end

    trait :with_audio_only_edl_file do
      audio_only_edl_file do
        path = Rails.root.join("spec", "fixtures", "files", "sample-edl.edl")
        Rack::Test::UploadedFile.new(path, "application/octet-stream")
      end
    end

    trait :published do
      report_published_at 1.day.ago
    end
  end
end
