<?php

namespace App\Models;

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

class VpnServer extends Model
{
    use HasFactory;

    protected $fillable = [
        'name',
        'city',
        'country',
        'country_code',
        'flag_emoji',
        'ip_address',
        'latency_ms',
        'load_percentage',
        'is_premium',
        'is_active',
    ];

    protected $casts = [
        'is_premium' => 'boolean',
        'is_active' => 'boolean',
        'latency_ms' => 'integer',
        'load_percentage' => 'integer',
    ];

    public function connections()
    {
        return $this->hasMany(VpnConnection::class, 'server_id');
    }
}
