<?php

namespace App\Console\Commands;

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

use App\Models\Address;
use App\Notifications\NetmailTest as NetmailTestNotification;

class NetmailTest extends Command
{
	/**
	 * The name and signature of the console command.
	 *
	 * @var string
	 */
	protected $signature = '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 mixed
	 * @throws \Exception
	 */
	public function handle()
	{
		$ao = Address::findFTN($this->argument('ftn'));

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