"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.UNREAL_AGENT_CONFIG = void 0;
const package_manager_detection_1 = require("../../lib/package-manager-detection");
const constants_1 = require("../../lib/constants");
const brand_colors_1 = require("../../lib/brand-colors");
const utils_1 = require("./utils");
exports.UNREAL_AGENT_CONFIG = {
    metadata: {
        name: 'Unreal Engine',
        glyph: '🎬',
        glyphColor: brand_colors_1.BrandColors.gray40,
        integration: constants_1.Integration.unreal,
        beta: true,
        docsUrl: 'https://amplitude.com/docs/sdks/analytics/unreal/unreal-sdk',
        preRunNotice: 'Close the Unreal Editor before running the wizard to avoid file conflicts.',
        gatherContext: async (options) => {
            const pluginAlreadyPresent = await (0, utils_1.isAmplitudePluginPresent)(options);
            return { pluginAlreadyPresent };
        },
    },
    detection: {
        packageName: 'AmplitudeUnreal',
        packageDisplayName: 'Unreal Engine',
        usesPackageJson: false,
        getVersion: () => undefined,
        detect: utils_1.detectUnrealProject,
        detectPackageManager: package_manager_detection_1.unrealPackageManager,
    },
    environment: {
        // API key goes in Config/DefaultEngine.ini — no .env files in Unreal projects
        uploadToHosting: false,
        getEnvVars: () => ({}),
    },
    analytics: {
        getTags: (context) => ({
            pluginAlreadyPresent: context.pluginAlreadyPresent ? 'true' : 'false',
        }),
    },
    prompts: {
        projectTypeDetection: 'This is an Unreal Engine project. Look for a .uproject file at the project root to confirm.',
        packageInstallation: 'There is no package manager for Unreal Engine plugins. Download AmplitudeUnreal.zip from https://github.com/amplitude/Amplitude-Unreal/releases/latest, then extract it into Plugins/AmplitudeUnreal/ inside the project directory. Use Bash to run: mkdir -p Plugins/AmplitudeUnreal && curl -L <release-url> -o /tmp/AmplitudeUnreal.zip && unzip -o /tmp/AmplitudeUnreal.zip -d Plugins/AmplitudeUnreal/',
        getAdditionalContextLines: (context) => {
            const lines = [
                `Framework docs ID: unreal (use amplitude://docs/frameworks/unreal for documentation)`,
                `Plugin: AmplitudeUnreal — manual install into Plugins/AmplitudeUnreal/`,
                `API key storage: Config/DefaultEngine.ini under [Analytics] section`,
                `Required INI settings:`,
                `  [Analytics]`,
                `  ProviderModuleName=Amplitude`,
                `  AmplitudeApiKey=<api_key>`,
                `C++ usage: FAnalytics::Get().GetDefaultConfiguredProvider()->RecordEvent(TEXT("Event Name"));`,
                `IMPORTANT: The Amplitude Unreal plugin only executes on Apple platforms (iOS/macOS/tvOS). On other platforms all calls are no-ops.`,
                `IMPORTANT: No EU data residency, no server zone configuration, and no batch/flush interval settings are available in this SDK.`,
            ];
            if (context.pluginAlreadyPresent) {
                lines.unshift('Amplitude plugin already present at Plugins/AmplitudeUnreal/ — skip download, proceed to INI configuration.');
            }
            return lines;
        },
    },
    ui: {
        successMessage: 'Amplitude integration complete',
        estimatedDurationMinutes: 10,
        getOutroChanges: (context) => [
            context.pluginAlreadyPresent
                ? 'Amplitude plugin was already present — skipped download'
                : 'Downloaded and extracted AmplitudeUnreal plugin into Plugins/AmplitudeUnreal/',
            'Configured AmplitudeApiKey in Config/DefaultEngine.ini',
            'Enabled Amplitude as the analytics provider',
        ],
        getOutroNextSteps: () => [
            'Open the Unreal Editor and enable the plugin: Settings > Plugins > Analytics > AmplitudeUnreal',
            'Rebuild your project from source',
            'Call FAnalytics::Get().GetDefaultConfiguredProvider()->StartSession() on game start',
            'Visit your Amplitude dashboard to see incoming events',
            'Note: events are only sent on iOS, macOS, and tvOS — other platforms are no-ops',
        ],
    },
};
