<?php

namespace App\Models;

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

class SacramentRecord extends Model
{
    protected $fillable = [
        'member_id',
        'church_service_id',
        'sacrament_type_id',
        'sacrament_date',
        'status',
        'recorded_by',
        'remarks',
    ];

    protected $casts = [
        'sacrament_date' => 'date',
    ];

    public function member(): BelongsTo
    {
        return $this->belongsTo(Member::class);
    }

    public function churchService(): BelongsTo
    {
        return $this->belongsTo(ChurchService::class);
    }

    public function sacramentType(): BelongsTo
    {
        return $this->belongsTo(SacramentType::class);
    }

    public function recordedBy(): BelongsTo
    {
        return $this->belongsTo(User::class, 'recorded_by');
    }
}
