// Path: src/main/java/io/github/zerthick/playershopsrpg/shop/type/ShopType.java
// public class ShopType {
// 
//     private Set<String> allowedItems;
// 
//     public ShopType(Set<String> allowedItems) {
//         this.allowedItems = allowedItems;
//     }
// 
//     public boolean isAllowedItem(ItemStack itemStack) {
//         return allowedItems.contains(itemStack.getType().getId());
//     }
// 
//     public Set<String> getAllowedItems() {
//         return allowedItems;
//     }
// }


import com.google.common.reflect.TypeToken;
import io.github.zerthick.playershopsrpg.shop.type.ShopType;
import ninja.leaping.configurate.ConfigurationNode;
import ninja.leaping.configurate.objectmapping.ObjectMappingException;
import ninja.leaping.configurate.objectmapping.serialize.TypeSerializer;
import ninja.leaping.configurate.objectmapping.serialize.TypeSerializers;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
/*
 * Copyright (C) 2017  Zerthick
 *
 * This file is part of PlayerShopsRPG.
 *
 * PlayerShopsRPG is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 2 of the License, or
 * (at your option) any later version.
 *
 * PlayerShopsRPG is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with PlayerShopsRPG.  If not, see <http://www.gnu.org/licenses/>.
 */

package io.github.zerthick.playershopsrpg.utils.config.serializers.shop.type;



public class ShopTypeSerializer implements TypeSerializer<ShopType> {

    public static void register() {
        TypeSerializers.getDefaultSerializers().registerType(TypeToken.of(ShopType.class), new ShopTypeSerializer());
    }

    @Override
// Path: src/main/java/io/github/zerthick/playershopsrpg/shop/type/ShopType.java
// public class ShopType {
// 
//     private Set<String> allowedItems;
// 
//     public ShopType(Set<String> allowedItems) {
//         this.allowedItems = allowedItems;
//     }
// 
//     public boolean isAllowedItem(ItemStack itemStack) {
//         return allowedItems.contains(itemStack.getType().getId());
//     }
// 
//     public Set<String> getAllowedItems() {
//         return allowedItems;
//     }
// }


// Path: src/main/java/io/github/zerthick/playershopsrpg/utils/config/serializers/shop/type/ShopTypeSerializer.java
import com.google.common.reflect.TypeToken;
import io.github.zerthick.playershopsrpg.shop.type.ShopType;
import ninja.leaping.configurate.ConfigurationNode;
import ninja.leaping.configurate.objectmapping.ObjectMappingException;
import ninja.leaping.configurate.objectmapping.serialize.TypeSerializer;
import ninja.leaping.configurate.objectmapping.serialize.TypeSerializers;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;

/*
 * Copyright (C) 2017  Zerthick
 *
 * This file is part of PlayerShopsRPG.
 *
 * PlayerShopsRPG is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 2 of the License, or
 * (at your option) any later version.
 *
 * PlayerShopsRPG is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with PlayerShopsRPG.  If not, see <http://www.gnu.org/licenses/>.
 */

package io.github.zerthick.playershopsrpg.utils.config.serializers.shop.type;



public class ShopTypeSerializer implements TypeSerializer<ShopType> {

    public static void register() {
        TypeSerializers.getDefaultSerializers().registerType(TypeToken.of(ShopType.class), new ShopTypeSerializer());
    }

    @Override
    public ShopType deserialize(TypeToken<?> type, ConfigurationNode value) throws ObjectMappingException {