<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class GuestLedger extends Model
{
    use \App\Traits\HotelScopeTrait;
    protected $table = 'guest_ledger';
    
    protected $fillable = [
        'hotel_id',
        'reservation_id',
        'guest_id',
        'transaction_date',
        'description',
        'reference_type',
        'reference_id',
        'debit',
        'credit',
        'balance',
        'invoice_id',
        'accounting_synced',
        'created_by'
    ];
    
    protected $casts = [
        'transaction_date' => 'datetime',
        'debit' => 'decimal:2',
        'credit' => 'decimal:2',
        'balance' => 'decimal:2',
    ];
    
    public function reservation()
    {
        return $this->belongsTo(Reservation::class);
    }
    
    public function guest()
    {
        return $this->belongsTo(Guest::class);
    }
    
    public function invoice()
    {
        return $this->belongsTo(Invoice::class);
    }
}