<?php

namespace App\Enums;

enum InvoiceStatus: string
{
    case Draft = 'draft';
    case Issued = 'issued';
    case PartiallyPaid = 'partially_paid';
    case Paid = 'paid';
    case Void = 'void';

    public function isOpen(): bool
    {
        return in_array($this, [self::Issued, self::PartiallyPaid], true);
    }

    public function label(): string
    {
        return __(match ($this) {
            self::Draft => 'Draft',
            self::Issued => 'Issued',
            self::PartiallyPaid => 'Partially paid',
            self::Paid => 'Paid',
            self::Void => 'Void',
        });
    }

    public function color(): string
    {
        return match ($this) {
            self::Draft => '#94A3B8',
            self::Issued => '#0EA5E9',
            self::PartiallyPaid => '#F5A524',
            self::Paid => '#22C55E',
            self::Void => '#EF4444',
        };
    }
}
