package dev.crucifixbeta.mod.commands;

import dev.crucifixbeta.CrucifixBeta;
import dev.crucifixbeta.api.utils.Wrapper;
import dev.crucifixbeta.core.impl.CommandManager;
import java.util.List;
import java.util.Objects;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;

@Environment(EnvType.CLIENT)
public abstract class Command implements Wrapper {
   protected final String name;
   protected final String syntax;

   public Command(String name, String syntax) {
      this.name = Objects.requireNonNull(name);
      this.syntax = Objects.requireNonNull(syntax);
   }

   public String getName() {
      return this.name;
   }

   public String getSyntax() {
      return this.syntax;
   }

   public abstract void runCommand(String[] strings);

   public abstract String[] getAutocorrect(int i, List<String> list);

   public void sendUsage() {
      this.sendChatMessage("§4Parameter error §r" + CrucifixBeta.getPrefix() + this.getName() + " §7" + this.getSyntax());
   }

   public void sendChatMessage(String message) {
      CommandManager.sendMessage(message);
   }
}
