<?php

namespace App\Actions\Init;

class BuildEnvValues
{
    public function handle(string $slug, string $url, string $dbName, string $dbHost): array
    {
        $basePort = random_int(8001, 8999);

        return [
            'VIRTUAL_HOST' => $url,
            'PORT_WP' => $basePort,
            'PORT_DEV' => $basePort + 1,
            'DB_NAME' => $dbName,
            'DB_HOST' => $dbHost,
            'CDN_URL' => sprintf('http://%s/media', $url),
            'THEME_NAME' => 'theme',
            'PROJECT_SLUG' => $slug,
        ];
    }
}
