<?php

namespace App\Enums;

enum ExpenseCategory: string
{
    case Labor = 'labor';
    case Salary = 'salary';
    case Material = 'material';
    case Office = 'office';
    case Rent = 'rent';
    case Utilities = 'utilities';
    case Marketing = 'marketing';
    case Transport = 'transport';
    case Equipment = 'equipment';
    case Maintenance = 'maintenance';
    case Commission = 'commission';
    case Legal = 'legal';
    case Tax = 'tax';
    case Personal = 'personal';
    case Miscellaneous = 'miscellaneous';

    public function label(): string
    {
        return match ($this) {
            self::Labor => 'Labor / Wages',
            self::Salary => 'Staff Salary',
            self::Material => 'Material Purchase',
            self::Office => 'Office Expense',
            self::Rent => 'Rent',
            self::Utilities => 'Utilities (Electricity, Water, Gas)',
            self::Marketing => 'Marketing & Advertising',
            self::Transport => 'Transport / Fuel',
            self::Equipment => 'Equipment / Machinery',
            self::Maintenance => 'Repair & Maintenance',
            self::Commission => 'Commission / Brokerage',
            self::Legal => 'Legal & Documentation',
            self::Tax => 'Tax / Government Fee',
            self::Personal => 'Personal / Owner Drawings',
            self::Miscellaneous => 'Miscellaneous',
        };
    }

    public static function options(): array
    {
        return collect(self::cases())
            ->mapWithKeys(fn (self $case) => [$case->value => $case->label()])
            ->all();
    }
}
