<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;

class MonthlyCharge extends Model
{
    protected $fillable = [
        'building_id',
        'unit_id',
        'occupancy_id',
        'jalali_year',
        'jalali_month',
        'amount',
        'type',
        'status',
        'description',
    ];

    public function paymentItems(): HasMany
    {
        return $this->hasMany(PaymentItem::class);
    }

    public function occupancy(): BelongsTo
    {
        return $this->belongsTo(UnitOccupancy::class, 'occupancy_id');
    }
}
