<?php

namespace goals\helpers;

enum goals_criteria_progress_alert_destination
{
    case SLACK; // Send alert to Slack
    case EMAIL;       // Send alert via Email
    case SMS; // Send alert via SMS
    case NONE;    // When there is no specific criteria

    public static function tryFrom(string $param): ?goals_criteria_progress_alert_destination
    {
        return match (strtoupper($param)) {
            'SLACK' => goals_criteria_progress_alert_destination::SLACK,
            'EMAIL' => goals_criteria_progress_alert_destination::EMAIL,
            'SMS' => goals_criteria_progress_alert_destination::SMS,
            'NONE' => goals_criteria_progress_alert_destination::NONE,
            default => null,
        };
    }

    public function equals(goals_criteria_progress_alert_destination $param): bool
    {
        return $this === $param;
    }
}
