// Generated by delombok at Sun Oct 26 00:51:11 UTC 2025
package net.md_5.bungee.api.chat;

import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonParseException;
import com.google.gson.JsonSerializationContext;
import com.google.gson.JsonSerializer;
import java.lang.reflect.Type;

/**
 * Metadata for use in conjunction with {@link HoverEvent.Action#SHOW_ITEM}
 */
public final class ItemTag {
    private final String nbt;

    /*
    TODO
    private BaseComponent name;
    @Singular("ench")
    private List<Enchantment> enchantments;
    @Singular("lore")
    private List<BaseComponent[]> lore;
    private Boolean unbreakable;

    @RequiredArgsConstructor
    public static class Enchantment
    {

        private final int level;
        private final int id;
    }
     */
    private ItemTag(String nbt) {
        this.nbt = nbt;
    }

    public static ItemTag ofNbt(String nbt) {
        return new ItemTag(nbt);
    }


    public static class Serializer implements JsonSerializer<ItemTag>, JsonDeserializer<ItemTag> {
        @Override
        public ItemTag deserialize(JsonElement element, Type type, JsonDeserializationContext context) throws JsonParseException {
            return ItemTag.ofNbt(element.getAsJsonPrimitive().getAsString());
        }

        @Override
        public JsonElement serialize(ItemTag itemTag, Type type, JsonSerializationContext context) {
            return context.serialize(itemTag.getNbt());
        }
    }


    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    private static class Builder {
        @java.lang.SuppressWarnings("all")
        @lombok.Generated
        private String nbt;

        @java.lang.SuppressWarnings("all")
        @lombok.Generated
        Builder() {
        }

        /**
         * @return {@code this}.
         */
        @java.lang.SuppressWarnings("all")
        @lombok.Generated
        private ItemTag.Builder nbt(final String nbt) {
            this.nbt = nbt;
            return this;
        }

        @java.lang.SuppressWarnings("all")
        @lombok.Generated
        private ItemTag build() {
            return new ItemTag(this.nbt);
        }

        @java.lang.Override
        @java.lang.SuppressWarnings("all")
        @lombok.Generated
        public java.lang.String toString() {
            return "ItemTag.Builder(nbt=" + this.nbt + ")";
        }
    }

    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    private static ItemTag.Builder builder() {
        return new ItemTag.Builder();
    }

    @java.lang.Override
    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public java.lang.String toString() {
        return "ItemTag(nbt=" + this.getNbt() + ")";
    }

    @java.lang.Override
    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public boolean equals(final java.lang.Object o) {
        if (o == this) return true;
        if (!(o instanceof ItemTag)) return false;
        final ItemTag other = (ItemTag) o;
        final java.lang.Object this$nbt = this.getNbt();
        final java.lang.Object other$nbt = other.getNbt();
        if (this$nbt == null ? other$nbt != null : !this$nbt.equals(other$nbt)) return false;
        return true;
    }

    @java.lang.Override
    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public int hashCode() {
        final int PRIME = 59;
        int result = 1;
        final java.lang.Object $nbt = this.getNbt();
        result = result * PRIME + ($nbt == null ? 43 : $nbt.hashCode());
        return result;
    }

    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public String getNbt() {
        return this.nbt;
    }
}
