<?php

declare(strict_types=1);

namespace Database\Seeders;

use App\Models\Plan;
use Illuminate\Database\Seeder;

class UpdateVirtFusionPackageIds extends Seeder
{
    public function run(): void
    {
        // Map Laravel plans to VirtFusion package IDs
        $mapping = [
            'Nano' => 43,        // Base Package (will use custom specs)
            'Micro' => 19,       // Micro
            'Mini' => 20,        // Mini
            'Standard' => 22,    // Standard
            'Plus' => 23,        // Advanced
            'Pro' => 24,         // Pro
            'Storage-500' => 41, // Storage Box
            'Storage-1TB' => 41, // Storage Box
        ];

        foreach ($mapping as $planName => $packageId) {
            $plan = Plan::where('name', $planName)->where('service_type', 'vps')->first();

            if ($plan) {
                $features = $plan->features ?? [];
                $features['virtfusion_package_id'] = $packageId;

                $plan->update(['features' => $features]);

                $this->command->info("Updated {$planName} with VirtFusion package ID {$packageId}");
            }
        }
    }
}
