<?php

namespace App\Models;

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

class Device extends Model
{
    use HasUlids;

    protected $fillable = [
        'user_id', 'device_id', 'platform', 'model', 'os_version', 'app_version',
        'fcm_token', 'local_ip', 'storage_used_bytes', 'last_sync_at', 'is_revoked',
    ];

    protected $casts = [
        'storage_used_bytes' => 'integer',
        'is_revoked' => 'boolean',
        'last_sync_at' => 'datetime',
    ];

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