<?php

namespace Kylin\Logistics\Enums;

/**
 * 报警类型枚举 - WB/T 1104-2020
 */
enum AlarmType: string
{
    case OVERSPEED = 'overspeed';
    case DEVIATION = 'deviation';
    case OVERTIME = 'overtime';
    case TEMP_ABNORMAL = 'temp_abnormal';
    case FATIGUE_DRIVING = 'fatigue_driving';

    public function label(): string
    {
        return match ($this) {
            self::OVERSPEED => '超速报警',
            self::DEVIATION => '偏航报警',
            self::OVERTIME => '超时报警',
            self::TEMP_ABNORMAL => '超温报警',
            self::FATIGUE_DRIVING => '疲劳驾驶报警',
        };
    }

    public function level(): string
    {
        return match ($this) {
            self::OVERSPEED, self::DEVIATION, self::TEMP_ABNORMAL => 'danger',
            self::OVERTIME, self::FATIGUE_DRIVING => 'warning',
        };
    }
}
