// Path: services-inventoryitem-api/src/main/java/io/plumery/inventoryitem/api/denormalizer/hazelcast/HazelcastManaged.java
// public class HazelcastManaged implements Managed {
//     private static HazelcastInstance hazelcastInstance;
// 
//     public static HazelcastInstance getInstance() {
//         if (hazelcastInstance == null) {
//             Config config = new XmlConfigBuilder().build();
//             config.setInstanceName(Thread.currentThread().getName());
// 
//             hazelcastInstance = Hazelcast.getOrCreateHazelcastInstance(config);
//         }
// 
//         return hazelcastInstance;
//     }
// 
//     @Override
//     public void start() throws Exception {
//     }
// 
//     @Override
//     public void stop() throws Exception {
//         Hazelcast.shutdownAll();
//     }
// }
// 
// Path: services-inventoryitem-api/src/main/java/io/plumery/inventoryitem/api/core/InventoryItemDetails.java
// public class InventoryItemDetails {
//     public final String id;
//     public final String name;
//     public final int currentCount;
//     public final int version;
// 
//     public InventoryItemDetails(String id, String name, int currentCount, int version) {
//         this.id = id;
//         this.name = name;
//         this.currentCount = currentCount;
//         this.version = version;
//     }
// }
// 
// Path: services-inventoryitem-api/src/main/java/io/plumery/inventoryitem/api/core/InventoryItemListItem.java
// @ApiModel
// public class InventoryItemListItem implements Serializable {
//     @ApiModelProperty("The id of the inventory item")
//     public String id;
//     @ApiModelProperty("The name of the inventory item")
//     public String name;
//     @ApiModelProperty("The current version of the inventory item")
//     public int version;
// }


import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.core.IMap;
import com.hazelcast.query.*;
import io.plumery.inventoryitem.api.denormalizer.hazelcast.HazelcastManaged;
import io.plumery.inventoryitem.api.core.InventoryItemDetails;
import io.plumery.inventoryitem.api.core.InventoryItemListItem;
import java.util.Collection;
package io.plumery.inventoryitem.api.query;



public class InventoryItemsQuery {
    private static final String INVENTORY_ITEMS_MAP = "inventoryItems";
    private static final String INVENTORY_ITEMS_DETAILS_MAP = "inventoryItemDetails";

    public final HazelcastInstance hazelcastInstance;

    public InventoryItemsQuery() {
        this.hazelcastInstance = HazelcastManaged.getInstance();
    }

    public Iterable<InventoryItemListItem> getInventoryItems() {
        IMap<String, InventoryItemListItem> map = hazelcastInstance.getMap(INVENTORY_ITEMS_MAP);

        return map.values();
    }

    public InventoryItemDetails getInventoryItemDetails(String id) {
        IMap<String, InventoryItemDetails> map = hazelcastInstance.getMap(INVENTORY_ITEMS_DETAILS_MAP);

        return map.get(id);
    }

// Path: services-inventoryitem-api/src/main/java/io/plumery/inventoryitem/api/denormalizer/hazelcast/HazelcastManaged.java
// public class HazelcastManaged implements Managed {
//     private static HazelcastInstance hazelcastInstance;
// 
//     public static HazelcastInstance getInstance() {
//         if (hazelcastInstance == null) {
//             Config config = new XmlConfigBuilder().build();
//             config.setInstanceName(Thread.currentThread().getName());
// 
//             hazelcastInstance = Hazelcast.getOrCreateHazelcastInstance(config);
//         }
// 
//         return hazelcastInstance;
//     }
// 
//     @Override
//     public void start() throws Exception {
//     }
// 
//     @Override
//     public void stop() throws Exception {
//         Hazelcast.shutdownAll();
//     }
// }
// 
// Path: services-inventoryitem-api/src/main/java/io/plumery/inventoryitem/api/core/InventoryItemDetails.java
// public class InventoryItemDetails {
//     public final String id;
//     public final String name;
//     public final int currentCount;
//     public final int version;
// 
//     public InventoryItemDetails(String id, String name, int currentCount, int version) {
//         this.id = id;
//         this.name = name;
//         this.currentCount = currentCount;
//         this.version = version;
//     }
// }
// 
// Path: services-inventoryitem-api/src/main/java/io/plumery/inventoryitem/api/core/InventoryItemListItem.java
// @ApiModel
// public class InventoryItemListItem implements Serializable {
//     @ApiModelProperty("The id of the inventory item")
//     public String id;
//     @ApiModelProperty("The name of the inventory item")
//     public String name;
//     @ApiModelProperty("The current version of the inventory item")
//     public int version;
// }


// Path: services-inventoryitem-api/src/main/java/io/plumery/inventoryitem/api/query/InventoryItemsQuery.java
import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.core.IMap;
import com.hazelcast.query.*;
import io.plumery.inventoryitem.api.denormalizer.hazelcast.HazelcastManaged;
import io.plumery.inventoryitem.api.core.InventoryItemDetails;
import io.plumery.inventoryitem.api.core.InventoryItemListItem;
import java.util.Collection;

package io.plumery.inventoryitem.api.query;



public class InventoryItemsQuery {
    private static final String INVENTORY_ITEMS_MAP = "inventoryItems";
    private static final String INVENTORY_ITEMS_DETAILS_MAP = "inventoryItemDetails";

    public final HazelcastInstance hazelcastInstance;

    public InventoryItemsQuery() {
        this.hazelcastInstance = HazelcastManaged.getInstance();
    }

    public Iterable<InventoryItemListItem> getInventoryItems() {
        IMap<String, InventoryItemListItem> map = hazelcastInstance.getMap(INVENTORY_ITEMS_MAP);

        return map.values();
    }

    public InventoryItemDetails getInventoryItemDetails(String id) {
        IMap<String, InventoryItemDetails> map = hazelcastInstance.getMap(INVENTORY_ITEMS_DETAILS_MAP);

        return map.get(id);
    }

    public Collection<InventoryItemListItem> findInventoryItemsByName(String name) {