package com.trunksbomb.minetriad.card;

import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;

public record CardDefinition(
        ResourceLocation id,
        Component name,
        int level,
        int top,
        int right,
        int bottom,
        int left,
        Rarity rarity) {

    public CardDefinition {
        if (level < 1 || level > 10) {
            throw new IllegalArgumentException("level must be between 1 and 10");
        }
        validateRank("top", top);
        validateRank("right", right);
        validateRank("bottom", bottom);
        validateRank("left", left);
    }

    private static void validateRank(String side, int rank) {
        if (rank < 1 || rank > 10) {
            throw new IllegalArgumentException(side + " rank must be between 1 and 10");
        }
    }
}
