package click.kamil.springstatemachineexporter.analysis.model;

import click.kamil.springstatemachineexporter.analysis.resolver.MachineEnumCanonicalizer;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Builder;
import lombok.Data;
import lombok.extern.jackson.Jacksonized;

import java.util.Map;

@Data
@Builder(toBuilder = true)
@Jacksonized
@JsonIgnoreProperties(ignoreUnknown = true)
public class TriggerPoint {
    private String event;
    private final String className;
    private final String methodName;
    private final String sourceFile;
    private final String sourceModule;
    private final String stateMachineId; // Optional: to link to a specific SM instance
    private final String sourceState;    // Optional: if we can determine the expected current state
    private final int lineNumber;
    @com.fasterxml.jackson.annotation.JsonIgnore
    private final String stateTypeFqn;  // Type of State (e.g. OrderStates FQN)
    @com.fasterxml.jackson.annotation.JsonIgnore
    private final String eventTypeFqn;  // Type of Event (e.g. OrderEvents FQN)
    private final java.util.List<String> polymorphicEvents; // NEW: stores concrete events resolved via deep polymorphism
    private final boolean external;
    private final String constraint;
    private final boolean ambiguous;

    public TriggerPoint(
            String event,
            String className,
            String methodName,
            String sourceFile,
            String sourceModule,
            String stateMachineId,
            String sourceState,
            int lineNumber,
            String stateTypeFqn,
            String eventTypeFqn,
            java.util.List<String> polymorphicEvents,
            boolean external,
            String constraint,
            boolean ambiguous) {
        this.className = className;
        this.methodName = methodName;
        this.sourceFile = sourceFile;
        this.sourceModule = sourceModule;
        this.stateMachineId = stateMachineId;
        this.sourceState = sourceState;
        this.lineNumber = lineNumber;
        this.stateTypeFqn = stateTypeFqn;
        this.eventTypeFqn = eventTypeFqn;
        this.event = event;
        this.polymorphicEvents = polymorphicEvents;
        this.external = external;
        this.constraint = constraint;
        this.ambiguous = ambiguous;
    }
}
