package click.kamil.springstatemachineexporter;

import click.kamil.springstatemachineexporter.analysis.service.EnrichmentService;
import click.kamil.springstatemachineexporter.exporter.Dot;
import click.kamil.springstatemachineexporter.exporter.JsonExporter;
import click.kamil.springstatemachineexporter.exporter.PlantUml;
import click.kamil.springstatemachineexporter.exporter.Scxml;
import click.kamil.springstatemachineexporter.command.ExporterCommand;
import click.kamil.springstatemachineexporter.service.ExportService;
import picocli.CommandLine;

import java.util.Collections;
import java.util.List;

public class Main {
    public static void main(String[] args) {
        // Enable diagnostic mode early before SLF4J initializes
        for (String arg : args) {
            if ("--debug".equals(arg)) {
                System.setProperty("org.slf4j.simpleLogger.defaultLogLevel", "debug");
                break;
            }
        }

        // Manual DI / Wiring
        var exporters = List.of(new PlantUml(), new Dot(), new Scxml(), new JsonExporter());
        var exportService = new ExportService(exporters);
        var command = new ExporterCommand(exportService);

        int exitCode = new CommandLine(command).execute(args);
        System.exit(exitCode);
    }
}
