<?php

namespace App\Models;

use App\Enums\GuestNotificationDeliveryStatus;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

class GuestNotificationReceipt extends Model
{
    /** @use HasFactory<\Database\Factories\GuestNotificationReceiptFactory> */
    use HasFactory;

    protected $fillable = [
        'guest_notification_id',
        'guest_identifier',
        'status',
        'read_at',
        'dismissed_at',
    ];

    protected function casts(): array
    {
        return [
            'status' => GuestNotificationDeliveryStatus::class,
            'read_at' => 'datetime',
            'dismissed_at' => 'datetime',
        ];
    }

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