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

package com.hypixel.hytale.assetstore;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;

public class DecodedAsset<K, T extends JsonAsset<K>> implements AssetHolder<K>
{
    private final K key;
    private final T asset;
    
    public DecodedAsset(final K key, final T asset) {
        this.key = key;
        this.asset = asset;
    }
    
    public K getKey() {
        return this.key;
    }
    
    public T getAsset() {
        return this.asset;
    }
    
    @Override
    public boolean equals(@Nullable final Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || this.getClass() != o.getClass()) {
            return false;
        }
        final DecodedAsset<?, ?> that = (DecodedAsset<?, ?>)o;
        if (this.key != null) {
            if (this.key.equals(that.key)) {
                return (this.asset != null) ? this.asset.equals(that.asset) : (that.asset == null);
            }
        }
        else if (that.key == null) {
            return (this.asset != null) ? this.asset.equals(that.asset) : (that.asset == null);
        }
        return false;
    }
    
    @Override
    public int hashCode() {
        int result = (this.key != null) ? this.key.hashCode() : 0;
        result = 31 * result + ((this.asset != null) ? this.asset.hashCode() : 0);
        return result;
    }
    
    @Nonnull
    @Override
    public String toString() {
        return "DecodedAsset{key=" + String.valueOf(this.key) + ", asset=" + String.valueOf(this.asset);
    }
}
