<?php

namespace Kylin\Catering\Enums;

/**
 * 订单状态
 */
enum OrderStatus: string
{
    case Pending = 'pending';           // 待确认
    case Confirmed = 'confirmed';       // 已确认
    case Cooking = 'cooking';           // 制作中
    case Served = 'served';             // 已出餐
    case Paid = 'paid';                 // 已结账
    case Completed = 'completed';       // 已完成
    case Cancelled = 'cancelled';       // 已取消

    public function label(): string
    {
        return match ($this) {
            self::Pending => '待确认',
            self::Confirmed => '已确认',
            self::Cooking => '制作中',
            self::Served => '已出餐',
            self::Paid => '已结账',
            self::Completed => '已完成',
            self::Cancelled => '已取消',
        };
    }

    public function color(): string
    {
        return match ($this) {
            self::Pending => 'secondary',
            self::Confirmed => 'info',
            self::Cooking => 'warning',
            self::Served => 'primary',
            self::Paid => 'success',
            self::Completed => 'success',
            self::Cancelled => 'danger',
        };
    }
}
