<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class SerenataPayment extends Model
{
    protected $fillable = [
        'organization_id',
        'serenata_id',
        'payment_method_id',
        'registered_by_user_id',
        'paid_at',
        'payment_method_name',
        'transaction_reference',
        'amount',
        'note',
    ];

    protected $casts = [
        'organization_id' => 'integer',
        'serenata_id' => 'integer',
        'payment_method_id' => 'integer',
        'registered_by_user_id' => 'integer',
        'paid_at' => 'datetime',
        'amount' => 'float',
    ];

    public function method()
    {
        return $this->belongsTo(PaymentMethod::class, 'payment_method_id');
    }

    public function serenata()
    {
        return $this->belongsTo(Serenata::class);
    }

    public function registeredBy()
    {
        return $this->belongsTo(User::class, 'registered_by_user_id');
    }
}
