<?php

namespace goals\helpers;

enum goals_criteria_progress_alert_style
{
    case DEPARTMENT_COMPARE; // Compare progress by department
    case COLLECTIVE;       // Collective progress style (all departments together)
    case SINGLE_DEPARTMENT; // Single department progress style (Only show the departments own progress)
    case NONE;    // When there is no specific criteria

    public static function tryFrom(string $param): ?goals_criteria_progress_alert_style
    {
        return match (strtoupper($param)) {
            'DEPARTMENT_COMPARE' => goals_criteria_progress_alert_style::DEPARTMENT_COMPARE,
            'COLLECTIVE' => goals_criteria_progress_alert_style::COLLECTIVE,
            'SINGLE_DEPARTMENT' => goals_criteria_progress_alert_style::SINGLE_DEPARTMENT,
            'NONE' => goals_criteria_progress_alert_style::NONE,
            default => null,
        };
    }

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