package com.trunksbomb.minetriad.card;

import java.util.List;

import net.minecraft.network.codec.StreamCodec;
import net.minecraft.resources.ResourceLocation;

public record CardStackData(ResourceLocation cardId) {
    public static final CardStackData EMPTY = new CardStackData(ResourceLocation.withDefaultNamespace("air"));
    public static final com.mojang.serialization.Codec<CardStackData> CODEC = ResourceLocation.CODEC
            .xmap(CardStackData::new, CardStackData::cardId);
    public static final StreamCodec<io.netty.buffer.ByteBuf, CardStackData> STREAM_CODEC =
            ResourceLocation.STREAM_CODEC.map(CardStackData::new, CardStackData::cardId);

    public List<String> validationErrors() {
        return cardId == null ? List.of("cardId must not be null") : List.of();
    }
}
