<?php

namespace App\Models;

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

class BudgetCategory extends Model
{
  use HasFactory;

  protected $fillable = [
    'budget_id',
    'category_id',
    'price_amount_total',
  ];

  public function budget()
  {
    return $this->belongsTo(Budget::class);
  }

  public function category()
  {
    return $this->belongsTo(Category::class);
  }

  public function budgetDetails()
  {
    return $this->hasMany(BudgetDetail::class);
  }

  // Alias for 'budgetDetails' if needed
  public function items()
  {
    return $this->hasMany(BudgetDetail::class);
  }
}
