// Path: OrionAPI/src/main/java/eu/mikroskeem/orion/api/configuration/DummyConfiguration.java
// @ConfigSerializable
// public class DummyConfiguration {}
// 
// Path: OrionAPI/src/main/java/eu/mikroskeem/orion/api/mod/ModInfo.java
// public interface ModInfo {
//     /**
//      * Gets mod id
//      *
//      * @return Mod id
//      */
//     @NotNull
//     String getId();
// 
//     /**
//      * Gets mod main class name
//      *
//      * @return Mod main class name
//      */
//     @NotNull
//     String getClassName();
// 
//     /**
//      * Gets mod dependencies
//      *
//      * @return Mod dependency list
//      */
//     @NotNull
//     List<String> getDependencies();
// 
//     /**
//      * Gets mod configuration class
//      *
//      * @return Mod configuration class
//      */
//     @NotNull
//     Class<?> getConfigClass();
// }


import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.Type;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import eu.mikroskeem.orion.api.annotations.OrionMod;
import eu.mikroskeem.orion.api.configuration.DummyConfiguration;
import eu.mikroskeem.orion.api.mod.ModInfo;
import org.jetbrains.annotations.Nullable;
import org.objectweb.asm.AnnotationVisitor;
    public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) {
        this.className = name;
    }

    @Override
    public AnnotationVisitor visitAnnotation(String desc, boolean visible) {
        return (visible && desc.equals(ORIONMOD_ANNOTATION.getDescriptor())) ?
                modAnnotationVisitor = new ModAnnotationVisitor(className) : super.visitAnnotation(desc, visible);
    }

    static class ModAnnotationVisitor extends AnnotationVisitor {
        private final List<String> dependencies = new ArrayList<>();
        private State currentState = State.DEFAULT;
        private OrionModInfo modInfo;
        private boolean gotId = false;

        private enum State {
            DEFAULT, DEPENDENCIES
        }

        ModAnnotationVisitor(String className) {
            super(Opcodes.ASM5);
            modInfo = new OrionModInfo();
            modInfo.setDependencies(dependencies);
            modInfo.setConfigClass(DummyConfiguration.class.getName());
            modInfo.setClassName(className.replace('/', '.'));
        }

        private void check(State state) {
            if(currentState != state)
// Path: OrionAPI/src/main/java/eu/mikroskeem/orion/api/configuration/DummyConfiguration.java
// @ConfigSerializable
// public class DummyConfiguration {}
// 
// Path: OrionAPI/src/main/java/eu/mikroskeem/orion/api/mod/ModInfo.java
// public interface ModInfo {
//     /**
//      * Gets mod id
//      *
//      * @return Mod id
//      */
//     @NotNull
//     String getId();
// 
//     /**
//      * Gets mod main class name
//      *
//      * @return Mod main class name
//      */
//     @NotNull
//     String getClassName();
// 
//     /**
//      * Gets mod dependencies
//      *
//      * @return Mod dependency list
//      */
//     @NotNull
//     List<String> getDependencies();
// 
//     /**
//      * Gets mod configuration class
//      *
//      * @return Mod configuration class
//      */
//     @NotNull
//     Class<?> getConfigClass();
// }


// Path: OrionCore/src/main/java/eu/mikroskeem/orion/core/mod/ModClassVisitor.java
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.Type;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import eu.mikroskeem.orion.api.annotations.OrionMod;
import eu.mikroskeem.orion.api.configuration.DummyConfiguration;
import eu.mikroskeem.orion.api.mod.ModInfo;
import org.jetbrains.annotations.Nullable;
import org.objectweb.asm.AnnotationVisitor;

    public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) {
        this.className = name;
    }

    @Override
    public AnnotationVisitor visitAnnotation(String desc, boolean visible) {
        return (visible && desc.equals(ORIONMOD_ANNOTATION.getDescriptor())) ?
                modAnnotationVisitor = new ModAnnotationVisitor(className) : super.visitAnnotation(desc, visible);
    }

    static class ModAnnotationVisitor extends AnnotationVisitor {
        private final List<String> dependencies = new ArrayList<>();
        private State currentState = State.DEFAULT;
        private OrionModInfo modInfo;
        private boolean gotId = false;

        private enum State {
            DEFAULT, DEPENDENCIES
        }

        ModAnnotationVisitor(String className) {
            super(Opcodes.ASM5);
            modInfo = new OrionModInfo();
            modInfo.setDependencies(dependencies);
            modInfo.setConfigClass(DummyConfiguration.class.getName());
            modInfo.setClassName(className.replace('/', '.'));
        }

        private void check(State state) {
            if(currentState != state)
                    throw new IllegalStateException("Expected state " + state + ", but is " + currentState);