<?php

namespace App\Models;

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

/**
 * @property int $id
 * @property string $label
 * @property int $user_id
 * @property PushNotificationTargetEnum $target
 * @property string $category
 * @property \Illuminate\Support\Carbon $sent_at
 * @property \Illuminate\Support\Carbon|null $created_at
 * @property \Illuminate\Support\Carbon|null $updated_at
 * @property-read \App\Models\User $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()
 * @method static \Illuminate\Database\Eloquent\Builder<static>|PushNotificationLog whereCategory($value)
 * @method static \Illuminate\Database\Eloquent\Builder<static>|PushNotificationLog whereCreatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder<static>|PushNotificationLog whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder<static>|PushNotificationLog whereLabel($value)
 * @method static \Illuminate\Database\Eloquent\Builder<static>|PushNotificationLog whereSentAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder<static>|PushNotificationLog whereTarget($value)
 * @method static \Illuminate\Database\Eloquent\Builder<static>|PushNotificationLog whereUpdatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder<static>|PushNotificationLog whereUserId($value)
 * @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);
    }
}
