<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Expense extends Model
{
    use HasFactory;

    protected $fillable = [
        'category',
        'amount',
        'description',
        'expense_date',
        'user_id',
    ];

    protected function casts(): array
    {
        return [
            'amount' => 'decimal:2',
            'expense_date' => 'date',
        ];
    }

    public function user()
    {
        return $this->belongsTo(User::class);
    }

    public static function categories()
    {
        return [
            'Rent',
            'Utilities',
            'Salaries',
            'Supplies',
            'Maintenance',
            'Transport',
            'Marketing',
            'Insurance',
            'Taxes',
            'Miscellaneous',
        ];
    }
}
