package me.nallar.mixin.internal;

import lombok.Data;
import lombok.val;
import me.nallar.javatransformer.api.Annotation;
import me.nallar.javatransformer.api.ClassInfo;

import java.nio.file.*;
import java.util.*;
import java.util.stream.*;

@Data
public class MixinApplicator {
	private final Path targetJar;
	private final Path mixinSource;
	private boolean noMixinIsError = false;

	public MixinApplicator(Path targetJar, Path mixinSource) {
		this.targetJar = targetJar;
		this.mixinSource = mixinSource;
	}

	public static void main(String[] args) {

	}

	private void handleAnnotations(ClassInfo info) {
		List<Annotation> mixins = info.getAnnotations().stream()
			.filter((it) -> it.getType().getClassName().equals(Names.MIXIN_FULL))
			.collect(Collectors.toList());

		if (mixins.size() == 0)
			if (noMixinIsError) throw new RuntimeException("Class " + info.getName() + " is not an @Mixin");
			else return;

		if (mixins.size() > 1)
			throw new RuntimeException(info.getName() + " can not use @Mixin multiple times");

		val mixin = mixins.get(0);
		String target = (String) mixin.values.get("target");

		if (target == null || target.isEmpty()) {
			target = info.getSuperType().getClassName();
		}
	}

	public static class Names {
		public static String PACKAGE = "me.nallar.mixin.";
		public static String MIXIN = "Mixin";
		public static String NEW = "New";

		public static String MIXIN_FULL = PACKAGE + MIXIN;
	}
}

@@ -48,16 +48,39 @@
 k.Data;%0A
+import lombok.NonNull;%0A
 import l
@@ -297,16 +297,26 @@
 cator %7B%0A
+%09@NonNull%0A
 %09private
@@ -338,16 +338,26 @@
 getJar;%0A
+%09@NonNull%0A
 %09private

Mark MixinApplicator fields as NonNull