<?php

declare(strict_types=1);

namespace Kylin\Hr\Enums;

/**
 * 考勤状态枚举
 */
enum AttendanceStatus: int
{
    case Normal = 1;       // 正常
    case Late = 2;         // 迟到
    case Early = 3;        // 早退
    case Absent = 4;       // 缺勤
    case Leave = 5;        // 请假
    case BusinessTrip = 6; // 出差
    case Overtime = 7;     // 加班
    case DayOff = 8;       // 休息

    /**
     * 获取标签
     */
    public function label(): string
    {
        return match ($this) {
            self::Normal      => '正常',
            self::Late        => '迟到',
            self::Early       => '早退',
            self::Absent      => '缺勤',
            self::Leave       => '请假',
            self::BusinessTrip => '出差',
            self::Overtime    => '加班',
            self::DayOff      => '休息',
        };
    }

    /**
     * 获取颜色
     */
    public function color(): string
    {
        return match ($this) {
            self::Normal      => 'success',
            self::Late        => 'warning',
            self::Early       => 'warning',
            self::Absent      => 'danger',
            self::Leave       => 'info',
            self::BusinessTrip => 'primary',
            self::Overtime    => 'secondary',
            self::DayOff      => 'light',
        };
    }
}
