package click.kamil.springstatemachineexporter.exporter;

import click.kamil.springstatemachineexporter.analysis.model.AnalysisResult;
import click.kamil.springstatemachineexporter.model.Transition;

import java.util.List;
import java.util.Set;

public interface StateMachineExporter {
    default String export(AnalysisResult result, ExportOptions options) {
        return export(result.getName(), result.getTransitions(), result.getStartStates(), result.getEndStates(), options);
    }

    String export(String name,
                  List<Transition> transitions,
                  Set<String> startStates,
                  Set<String> endStates,
                  ExportOptions options);

    // Helper: extract last enum part
    default String simplify(String full) {
        if (full == null)
            return "";
        int dot = full.lastIndexOf('.');
        return dot >= 0 ? full.substring(dot + 1) : full;
    }

    String getFileExtension();  // e.g. ".dot", ".plantuml.dot", ".scxml.xml"
}
