<?php

namespace goals\helpers;

enum goals_criteria_progress_alert_weekday
{
    case MONDAY;
    case TUESDAY;
    case WEDNESDAY;
    case THURSDAY;
    case FRIDAY;
    case SATURDAY;
    case SUNDAY;

    public static function tryFrom(string $param): ?goals_criteria_progress_alert_weekday
    {
        return match (strtoupper($param)) {
            'MON', 'MONDAY' => self::MONDAY,
            'TUE', 'TUES', 'TUESDAY' => self::TUESDAY,
            'WED', 'WEDNESDAY' => self::WEDNESDAY,
            'THU', 'THUR', 'THURS', 'THURSDAY' => self::THURSDAY,
            'FRI', 'FRIDAY' => self::FRIDAY,
            'SAT', 'SATURDAY' => self::SATURDAY,
            'SUN', 'SUNDAY' => self::SUNDAY,
            default => null,
        };
    }

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