<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class UserSetting extends Model
{
    use HasFactory;

    protected $fillable = [
        'user_id',
        'auto_connect',
        'kill_switch',
        'protocol',
        'device_name',
        'dns_protection',
        'dns_resolver',
        'ipv6_protection',
        'webrtc_protection',
        'block_trackers',
        'block_ads',
        'block_malicious',
        'block_phishing',
        'wifi_auto_connect',
        'wifi_untrusted_only',
        'hide_device_name',
        'device_alias',
        'anonymous_device_id',
        'rotate_device_id',
        'blocked_trackers_count',
        'blocked_ads_count',
        'blocked_malicious_count',
        'notifications_enabled',
    ];

    protected $casts = [
        'auto_connect' => 'boolean',
        'kill_switch' => 'boolean',
        'dns_protection' => 'boolean',
        'ipv6_protection' => 'boolean',
        'webrtc_protection' => 'boolean',
        'block_trackers' => 'boolean',
        'block_ads' => 'boolean',
        'block_malicious' => 'boolean',
        'block_phishing' => 'boolean',
        'wifi_auto_connect' => 'boolean',
        'wifi_untrusted_only' => 'boolean',
        'hide_device_name' => 'boolean',
        'rotate_device_id' => 'boolean',
        'notifications_enabled' => 'boolean',
        'blocked_trackers_count' => 'integer',
        'blocked_ads_count' => 'integer',
        'blocked_malicious_count' => 'integer',
    ];

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