<?php

namespace Kylin\Logistics\Enums;

/**
 * 运单状态枚举 - GB/T 18354-2021 物流术语
 */
enum WaybillStatus: string
{
    case PENDING = 'pending';
    case ASSIGNED = 'assigned';
    case IN_TRANSIT = 'in_transit';
    case SIGNED = 'signed';
    case EXCEPTION = 'exception';
    case CANCELLED = 'cancelled';

    public function label(): string
    {
        return match ($this) {
            self::PENDING => '待分配',
            self::ASSIGNED => '已分配',
            self::IN_TRANSIT => '运输中',
            self::SIGNED => '已签收',
            self::EXCEPTION => '异常',
            self::CANCELLED => '已取消',
        };
    }

    public function color(): string
    {
        return match ($this) {
            self::PENDING => 'secondary',
            self::ASSIGNED => 'info',
            self::IN_TRANSIT => 'primary',
            self::SIGNED => 'success',
            self::EXCEPTION => 'danger',
            self::CANCELLED => 'dark',
        };
    }
}
