# frozen_string_literal: true

FactoryBot.define do
  factory :user do
    sequence(:email) { |n| "user_#{n}@example.com" }
    sequence(:username) { |n| "user_#{n}" }
    password { 'password' }
    password_confirmation { 'password' }

    confirmed # default trait

    trait :admin do
      sequence(:email) { |n| "admin_#{n}@example.com" }
      sequence(:username) { |n| "admin_#{n}" }
      admin { true }
    end

    trait :confirmed do
      confirmed_at { Time.current }
    end

    trait :unconfirmed do
      confirmed_at { nil }
    end
  end
end
