// 
// Decompiled by Procyon v0.6.0
// 

package com.hypixel.hytale.builtin.adventure.objectives.components;

import com.hypixel.hytale.codec.KeyedCodec;
import java.util.function.Supplier;
import com.hypixel.hytale.codec.Codec;
import com.hypixel.hytale.codec.codecs.map.MapCodec;
import javax.annotation.Nonnull;
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
import com.hypixel.hytale.builtin.adventure.objectives.historydata.ObjectiveLineHistoryData;
import com.hypixel.hytale.builtin.adventure.objectives.historydata.ObjectiveHistoryData;
import java.util.Map;
import com.hypixel.hytale.codec.builder.BuilderCodec;
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
import com.hypixel.hytale.component.Component;

public class ObjectiveHistoryComponent implements Component<EntityStore>
{
    public static final BuilderCodec<ObjectiveHistoryComponent> CODEC;
    private Map<String, ObjectiveHistoryData> objectiveHistoryMap;
    private Map<String, ObjectiveLineHistoryData> objectiveLineHistoryMap;
    
    public ObjectiveHistoryComponent() {
        this.objectiveHistoryMap = new Object2ObjectOpenHashMap<String, ObjectiveHistoryData>();
        this.objectiveLineHistoryMap = new Object2ObjectOpenHashMap<String, ObjectiveLineHistoryData>();
    }
    
    public Map<String, ObjectiveHistoryData> getObjectiveHistoryMap() {
        return this.objectiveHistoryMap;
    }
    
    public Map<String, ObjectiveLineHistoryData> getObjectiveLineHistoryMap() {
        return this.objectiveLineHistoryMap;
    }
    
    @Nonnull
    @Override
    public Component<EntityStore> clone() {
        final ObjectiveHistoryComponent component = new ObjectiveHistoryComponent();
        component.objectiveHistoryMap.putAll(this.objectiveHistoryMap);
        component.objectiveLineHistoryMap.putAll(this.objectiveLineHistoryMap);
        return component;
    }
    
    static {
        CODEC = BuilderCodec.builder(ObjectiveHistoryComponent.class, ObjectiveHistoryComponent::new).append(new KeyedCodec<Map>("ObjectiveHistory", (Codec<Map>)new MapCodec((Codec<Object>)ObjectiveHistoryData.CODEC, (Supplier<Map>)Object2ObjectOpenHashMap::new, false)), (objectiveHistoryComponent, stringObjectiveHistoryDataMap) -> objectiveHistoryComponent.objectiveHistoryMap = stringObjectiveHistoryDataMap, objectiveHistoryComponent -> objectiveHistoryComponent.objectiveHistoryMap).add().append(new KeyedCodec("ObjectiveLineHistory", new MapCodec(ObjectiveLineHistoryData.CODEC, Object2ObjectOpenHashMap::new, false)), (objectiveHistoryComponent, stringObjectiveLineHistoryDataMap) -> objectiveHistoryComponent.objectiveLineHistoryMap = stringObjectiveLineHistoryDataMap, objectiveHistoryComponent -> objectiveHistoryComponent.objectiveLineHistoryMap).add().build();
    }
}
