<?php

namespace App\Models\WillsCase;

use App\Models\User\User;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

class WillsCaseComment extends Model {
    protected $table = 'wills_case_comments';

    protected $fillable = [
        'wills_case_id',
        'comment_created_by',
        'comment_created_at',
        'comment_text',
    ];

    protected $casts = [
        'comment_created_at' => 'datetime',
        'created_at' => 'datetime',
        'updated_at' => 'datetime',
    ];

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

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