# frozen_string_literal: true

namespace :fcm do
  desc "Show whether FCM credentials are loaded (does not print secrets)"
  task status: :environment do
    puts FcmSender.status_summary
  end

  desc "Send a test inbox row + FCM push to USER_ID (default 19)"
  task test: :environment do
    user = User.find(ENV.fetch("USER_ID", 19))
    puts FcmSender.status_summary
    actor = User.where.not(id: user.id).first || user
    notification = NotificationRecorder.create!(
      recipient: user,
      kind: "profile_view",
      actor: actor
    )
    puts "Inbox n_#{notification.id} written; devices=#{user.devices.count}"
  end
end
