<?php

namespace App\Classes\FTN;

use App\Models\{Echoarea,Echomail,Netmail};

/**
 * Abstract class to hold the common functions for automatic responding to echomail/netmail messages
 */
abstract class Process
{
	public static function canProcess(string $echoarea): bool
	{
		$eao = Echoarea::where('name',$echoarea)->single();

		return $eao && $eao->automsgs;
	}

	/**
	 * Return TRUE if the process class handled the message.
	 *
	 * @param Echomail|Netmail $mo
	 * @return bool
	 */
	abstract public static function handle(Echomail|Netmail $mo): bool;
}