# typed: strict
module Domain::UserJobEventHelper
  extend T::Sig
  include HelpersInterface

  sig { params(kind: String).returns(String) }
  def add_tracked_object_kind_for_view(kind)
    case kind
    when "favs"
      "Favs"
    else
      kind.titleize
    end
  end

  sig { params(kind: String).returns(String) }
  def add_tracked_object_kind_event_name(kind)
    case kind
    when "favs"
      "favs scan"
    else
      "#{kind} scan"
    end
  end

  sig { params(duration: ActiveSupport::Duration).returns(String) }
  def format_duration_since_last_scan(duration)
    if duration.in_days >= 1
      pluralize(duration.in_days.round(0), "day")
    elsif duration.in_hours >= 1
      pluralize(duration.in_hours.round(0), "hour")
    else
      pluralize(duration.in_minutes.round(0), "min")
    end
  end
end
