001package net.tnemc.item.platform.serialize;
002
003/*
004 * The New Item Library
005 * Copyright (C) 2022 - 2025 Daniel "creatorfromhell" Vidmar
006 *
007 * This program is free software; you can redistribute it and/or
008 * modify it under the terms of the GNU Lesser General Public
009 * License as published by the Free Software Foundation; either
010 * version 3 of the License, or (at your option) any later version.
011 *
012 * This program is distributed in the hope that it will be useful,
013 * but WITHOUT ANY WARRANTY; without even the implied warranty of
014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
015 * Lesser General Public License for more details.
016 *
017 * You should have received a copy of the GNU Lesser General Public License
018 * along with this program; if not, write to the Free Software Foundation,
019 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
020 */
021
022import net.tnemc.item.AbstractItemStack;
023import net.tnemc.item.platform.Identifiable;
024
025/**
026 * ItemApplier
027 *
028 * @author creatorfromhell
029 * @since 0.2.0.0
030 */
031public interface ItemSerializer<I extends AbstractItemStack<T>, T> extends Identifiable {
032
033  /**
034   * @param version the version being used when this deserializer is called.
035   *
036   * @return true if this deserializer is enabled for the version, otherwise false
037   * @since 0.2.0.0
038   * @since 0.2.0.0
039   */
040  boolean enabled(final String version);
041
042  /**
043   * @param item       the item that we should use to deserialize.
044   * @param serialized the serialized item stack we should use to apply this deserializer to
045   *
046   * @return the updated serialized item.
047   * @since 0.2.0.0
048   * @since 0.2.0.0
049   */
050  I serialize(final T item, I serialized);
051}