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

package com.hypixel.hytale.server.core.codec;

import com.hypixel.hytale.codec.validation.Validator;
import com.hypixel.hytale.codec.validation.Validators;
import com.hypixel.hytale.codec.KeyedCodec;
import com.hypixel.hytale.codec.Codec;
import javax.annotation.Nonnull;
import it.unimi.dsi.fastutil.Pair;
import com.hypixel.hytale.codec.builder.BuilderCodec;

public class PairCodec
{
    public static class IntegerPair
    {
        public static final BuilderCodec<IntegerPair> CODEC;
        private Integer left;
        private Integer right;
        
        public IntegerPair() {
        }
        
        public IntegerPair(final Integer left, final Integer right) {
            this.left = left;
            this.right = right;
        }
        
        @Nonnull
        public Pair<Integer, Integer> toPair() {
            return Pair.of(this.left, this.right);
        }
        
        @Nonnull
        public static IntegerPair fromPair(@Nonnull final Pair<Integer, Integer> pair) {
            return new IntegerPair(pair.left(), pair.right());
        }
        
        public Integer getLeft() {
            return this.left;
        }
        
        public Integer getRight() {
            return this.right;
        }
        
        static {
            CODEC = BuilderCodec.builder(IntegerPair.class, IntegerPair::new).append(new KeyedCodec<Integer>("Left", Codec.INTEGER), (pair, left) -> pair.left = left, pair -> pair.left).addValidator(Validators.nonNull()).add().append(new KeyedCodec("Right", Codec.INTEGER), (pair, right) -> pair.right = right, pair -> pair.right).addValidator(Validators.nonNull()).add().build();
        }
    }
    
    public static class IntegerStringPair
    {
        public static final BuilderCodec<IntegerStringPair> CODEC;
        private Integer left;
        private String right;
        
        public IntegerStringPair() {
        }
        
        public IntegerStringPair(final Integer left, final String right) {
            this.left = left;
            this.right = right;
        }
        
        @Nonnull
        public Pair<Integer, String> toPair() {
            return Pair.of(this.left, this.right);
        }
        
        @Nonnull
        public static IntegerStringPair fromPair(@Nonnull final Pair<Integer, String> pair) {
            return new IntegerStringPair(pair.left(), pair.right());
        }
        
        public Integer getLeft() {
            return this.left;
        }
        
        public String getRight() {
            return this.right;
        }
        
        static {
            CODEC = BuilderCodec.builder(IntegerStringPair.class, IntegerStringPair::new).append(new KeyedCodec<Integer>("Left", Codec.INTEGER), (pair, left) -> pair.left = left, pair -> pair.left).addValidator(Validators.nonNull()).add().append(new KeyedCodec("Right", Codec.STRING), (pair, right) -> pair.right = right, pair -> pair.right).addValidator(Validators.nonNull()).add().build();
        }
    }
}
