<?php

namespace App\Models;

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

class PushNotification extends Model
{
    protected $fillable = [
        'user_id',
        'title',
        'body',
        'type',
        'channel',
        'data',
        'status',
        'error_message',
        'response',
        'sent_at',
        'failed_at',
        'read_at',
    ];

    protected $casts = [
        'data' => 'array',
        'response' => 'array',
        'sent_at' => 'datetime',
        'failed_at' => 'datetime',
        'read_at' => 'datetime',
    ];

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