<?php

namespace App\Enums;

use App\Traits\WithCommentEnum;
use App\Traits\WithValueEnum;

enum OrderStatus: int
{
    use WithCommentEnum, WithValueEnum;

    case DRAFT = 1;
    case PENDING = 2;
    case PARTIAL = 3;
    case PAID = 4;
    case OVERDUE = 5;
    case CANCELED = 6;

    public function label(): string
    {
        return match ($this) {
            self::DRAFT => 'Draft',
            self::PENDING => 'Menunggu Pembayaran',
            self::PARTIAL => 'Belum Lunas',
            self::PAID => 'Lunas',
            self::OVERDUE => 'Terlambat Bayar',
            self::CANCELED => 'Dibatalkan',
        };
    }

    public function color(): string
    {
        return match ($this) {
            self::DRAFT => 'gray',
            self::PENDING => 'blue',
            self::PARTIAL => 'amber',
            self::PAID => 'emerald',
            self::OVERDUE => 'red',
            self::CANCELED => 'zinc',
        };
    }
}
