<?php

namespace App\Models;

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

class UserNotificationRead extends Model
{
    use HasFactory;

    protected $fillable = [
        'user_notification_id',
        'user_id',
        'read_at',
        'dismissed_popup_at',
    ];

    protected $casts = [
        'read_at' => 'datetime',
        'dismissed_popup_at' => 'datetime',
    ];

    public function notification(): BelongsTo
    {
        return $this->belongsTo(UserNotification::class, 'user_notification_id');
    }

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