<?php

namespace App\Models;

use App\Enums\PushNotificationTargetEnum;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

/**
 * @property PushNotificationTargetEnum $target
 * @property-read \App\Models\User|null $user
 * @method static \Illuminate\Database\Eloquent\Builder<static>|PushNotificationLog newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder<static>|PushNotificationLog newQuery()
 * @method static \Illuminate\Database\Eloquent\Builder<static>|PushNotificationLog query()
 * @mixin \Eloquent
 */
class PushNotificationLog extends Model
{
    protected $guarded = ['id'];

    protected $casts = [
        'sent_at' => 'datetime',
        'target'  => PushNotificationTargetEnum::class,
    ];

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