# typed: false
FactoryBot.define do
  factory :domain_post_fa_post, class: "Domain::Post::FaPost" do
    sequence(:fa_id) { |n| n }
    state { "ok" }
    category { "artwork" }
    theme { "general" }
    species { "unspecified" }
    gender { "unspecified" }
    description { "Test description" }
    keywords { %w[test factory] }
    num_favorites { 0 }
    num_comments { 0 }
    num_views { 0 }
    posted_at { Time.now }
    scanned_at { Time.now }

    trait :with_last_user_page do
      association :last_user_page, factory: :http_log_entry
    end

    trait :with_last_submission_page do
      association :last_submission_page, factory: :http_log_entry
    end

    trait :with_first_browse_page do
      association :first_browse_page, factory: :http_log_entry
    end

    trait :with_first_gallery_page do
      association :first_gallery_page, factory: :http_log_entry
    end

    trait :with_first_seen_entry do
      association :first_seen_entry, factory: :http_log_entry
    end

    trait :removed do
      state { "removed" }
    end

    trait :scan_error do
      state { "scan_error" }
      scan_file_error { "Failed to scan file" }
    end

    trait :file_error do
      state { "file_error" }
      scan_file_error { "Failed to process file" }
    end
  end
end
