<?php

namespace App\Models;

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

class BusinessExpense extends Model
{
    use HasFactory;

    public const CATEGORIES = [
        'staff_salary' => 'Staff Salary',
        'marketing_expense' => 'Marketing Expense',
        'packaging_charge' => 'Packaging Charge',
        'office_expense' => 'Office Expense',
        'internet' => 'Internet',
        'transport_support' => 'Transport / Delivery Support',
        'maintenance' => 'Maintenance',
        'miscellaneous' => 'Miscellaneous / Others',
    ];

    protected $guarded = [];

    protected $casts = [
        'expense_date' => 'date',
        'amount' => 'float',
        'created_at' => 'datetime',
        'updated_at' => 'datetime',
    ];

    public function createdByAdmin()
    {
        return $this->belongsTo(Admin::class, 'created_by_admin_id');
    }

    public static function categoryOptions(): array
    {
        return self::CATEGORIES;
    }
}
