<?php

namespace App\Models;

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

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

    protected $casts = [
        'active'   => 'boolean',
        'app_type' => PushNotificationTargetEnum::class,
    ];

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