package editor.database;

import java.util.AbstractMap.SimpleImmutableEntry;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

public class FormatConstraints
{
    public static final Map<String, FormatConstraints> CONSTRAINTS = Map.ofEntries(
        new SimpleImmutableEntry<>("brawl", new FormatConstraints(60, true, 1, true)),
        new SimpleImmutableEntry<>("commander", new FormatConstraints(100, true, 1, true)),
        new SimpleImmutableEntry<>("duel", new FormatConstraints(100, true, 1, true)),
        new SimpleImmutableEntry<>("future", new FormatConstraints()),
        new SimpleImmutableEntry<>("historic", new FormatConstraints()),
        new SimpleImmutableEntry<>("legacy", new FormatConstraints()),
        new SimpleImmutableEntry<>("modern", new FormatConstraints()),
        new SimpleImmutableEntry<>("oldschool", new FormatConstraints()),
        new SimpleImmutableEntry<>("pauper", new FormatConstraints()),
        new SimpleImmutableEntry<>("penny", new FormatConstraints()),
        new SimpleImmutableEntry<>("pioneer", new FormatConstraints()),
        new SimpleImmutableEntry<>("standard", new FormatConstraints()),
        new SimpleImmutableEntry<>("vintage", new FormatConstraints())
    );

    public static final List<String> FORMAT_NAMES = CONSTRAINTS.keySet().stream().sorted().collect(Collectors.toList());

    public static final List<Class<?>> CLASSES = List.of(
        String.class,
        Integer.class,
        Boolean.class,
        Integer.class,
        Boolean.class
    );

    public static final List<String> DATA_NAMES = List.of(
        "Name",
        "Deck Size",
        "Exact?",
        "Max Card Count",
        "Has Commander?"
    );

    public final int deckSize;
    public final boolean isExact;
    public final int maxCopies;
    public final boolean hasCommander;
    
    private FormatConstraints(int size, boolean exact, int copies, boolean commander)
    {
        deckSize = size;
        isExact = exact;
        maxCopies = copies;
        hasCommander = commander;
    }

    public FormatConstraints()
    {
        this(60, false, 4, false);
    }

    public Object[] toArray(String name)
    {
        return new Object[] { name, deckSize, isExact, maxCopies, hasCommander };
    }
}
@@ -115,16 +115,42 @@
 il.Map;%0A
+import java.util.Objects;%0A
 import j
@@ -2325,10 +2325,566 @@
 %7D;%0A    %7D
+%0A%0A    @Override%0A    public boolean equals(Object other)%0A    %7B%0A        if (other == null)%0A            return false;%0A        if (other == this)%0A            return true;%0A        if (!(other instanceof FormatConstraints))%0A            return false;%0A        FormatConstraints o = (FormatConstraints)other;%0A        return o.deckSize == deckSize && o.isExact == isExact && o.maxCopies == maxCopies && o.hasCommander == hasCommander;%0A    %7D%0A%0A    @Override%0A    public int hashCode()%0A    %7B%0A        return Objects.hash(deckSize, isExact, maxCopies, hasCommander);%0A    %7D
 %0A%7D

Add equals and hash to FormatConstraints