<?php

namespace App\Console\Commands\Debug;

use Illuminate\Console\Command;
use Illuminate\Support\Facades\Notification;

use App\Models\Address;
use App\Notifications\Netmails\Test as NetmailTestNotification;

class NetmailTest extends Command
{
	/**
	 * The name and signature of the console command.
	 *
	 * @var string
	 */
	protected $signature = 'debug:netmail:test'
		.' {ftn : FTN to send netmail to}';

	/**
	 * The console command description.
	 *
	 * @var string
	 */
	protected $description = 'Send a netmail test message';

	/**
	 * Execute the console command.
	 *
	 * @return int
	 * @throws \Exception
	 */
	public function handle():int
	{
		$ao = Address::findFTN($this->argument('ftn'));

		Notification::route('netmail',$ao)->notify(new NetmailTestNotification());

		return self::SUCCESS;
	}
}