<?php

namespace Kylin\Community\Enums;

/**
 * 报修工单状态
 */
enum RepairStatus: string
{
    case PENDING = 'pending';       // 待受理
    case ASSIGNED = 'assigned';     // 已分派
    case PROCESSING = 'processing'; // 处理中
    case COMPLETED = 'completed';   // 已完成
    case CLOSED = 'closed';         // 已关闭
    case RATED = 'rated';           // 已评价

    public function label(): string
    {
        return match ($this) {
            self::PENDING => '待受理',
            self::ASSIGNED => '已分派',
            self::PROCESSING => '处理中',
            self::COMPLETED => '已完成',
            self::CLOSED => '已关闭',
            self::RATED => '已评价',
        };
    }

    public function color(): string
    {
        return match ($this) {
            self::PENDING => 'warning',
            self::ASSIGNED => 'info',
            self::PROCESSING => 'primary',
            self::COMPLETED => 'success',
            self::CLOSED => 'secondary',
            self::RATED => 'success',
        };
    }
}
