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

package io.netty.handler.codec.quic;

import java.util.Objects;
import java.net.InetSocketAddress;

public abstract class QuicPathEvent implements QuicEvent
{
    private final InetSocketAddress local;
    private final InetSocketAddress remote;
    
    QuicPathEvent(final InetSocketAddress local, final InetSocketAddress remote) {
        this.local = Objects.requireNonNull(local, "local");
        this.remote = Objects.requireNonNull(remote, "remote");
    }
    
    public InetSocketAddress local() {
        return this.local;
    }
    
    public InetSocketAddress remote() {
        return this.remote;
    }
    
    @Override
    public String toString() {
        return "QuicPathEvent{local=" + this.local + ", remote=" + this.remote + '}';
    }
    
    @Override
    public boolean equals(final Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || this.getClass() != o.getClass()) {
            return false;
        }
        final QuicPathEvent that = (QuicPathEvent)o;
        return Objects.equals(this.local, that.local) && Objects.equals(this.remote, that.remote);
    }
    
    @Override
    public int hashCode() {
        int result = (this.local != null) ? this.local.hashCode() : 0;
        result = 31 * result + ((this.remote != null) ? this.remote.hashCode() : 0);
        return result;
    }
    
    public static final class New extends QuicPathEvent
    {
        public New(final InetSocketAddress local, final InetSocketAddress remote) {
            super(local, remote);
        }
        
        @Override
        public String toString() {
            return "QuicPathEvent.New{local=" + this.local() + ", remote=" + this.remote() + '}';
        }
    }
    
    public static final class Validated extends QuicPathEvent
    {
        public Validated(final InetSocketAddress local, final InetSocketAddress remote) {
            super(local, remote);
        }
        
        @Override
        public String toString() {
            return "QuicPathEvent.Validated{local=" + this.local() + ", remote=" + this.remote() + '}';
        }
    }
    
    public static final class FailedValidation extends QuicPathEvent
    {
        public FailedValidation(final InetSocketAddress local, final InetSocketAddress remote) {
            super(local, remote);
        }
        
        @Override
        public String toString() {
            return "QuicPathEvent.FailedValidation{local=" + this.local() + ", remote=" + this.remote() + '}';
        }
    }
    
    public static final class Closed extends QuicPathEvent
    {
        public Closed(final InetSocketAddress local, final InetSocketAddress remote) {
            super(local, remote);
        }
        
        @Override
        public boolean equals(final Object o) {
            return this == o || (o != null && this.getClass() == o.getClass() && super.equals(o));
        }
        
        @Override
        public int hashCode() {
            return 31 * super.hashCode();
        }
        
        @Override
        public String toString() {
            return "QuicPathEvent.Closed{local=" + this.local() + ", remote=" + this.remote() + '}';
        }
    }
    
    public static final class ReusedSourceConnectionId extends QuicPathEvent
    {
        private final long seq;
        private final InetSocketAddress oldLocal;
        private final InetSocketAddress oldRemote;
        
        public ReusedSourceConnectionId(final long seq, final InetSocketAddress oldLocal, final InetSocketAddress oldRemote, final InetSocketAddress local, final InetSocketAddress remote) {
            super(local, remote);
            this.seq = seq;
            this.oldLocal = Objects.requireNonNull(oldLocal, "oldLocal");
            this.oldRemote = Objects.requireNonNull(oldRemote, "oldRemote");
        }
        
        public long seq() {
            return this.seq;
        }
        
        public InetSocketAddress oldLocal() {
            return this.oldLocal;
        }
        
        public InetSocketAddress oldRemote() {
            return this.oldRemote;
        }
        
        @Override
        public boolean equals(final Object o) {
            if (this == o) {
                return true;
            }
            if (o == null || this.getClass() != o.getClass()) {
                return false;
            }
            if (!super.equals(o)) {
                return false;
            }
            final ReusedSourceConnectionId that = (ReusedSourceConnectionId)o;
            return this.seq == that.seq && Objects.equals(this.oldLocal, that.oldLocal) && Objects.equals(this.oldRemote, that.oldRemote);
        }
        
        @Override
        public int hashCode() {
            int result = super.hashCode();
            result = 31 * result + (int)(this.seq ^ this.seq >>> 32);
            result = 31 * result + ((this.oldLocal != null) ? this.oldLocal.hashCode() : 0);
            result = 31 * result + ((this.oldRemote != null) ? this.oldRemote.hashCode() : 0);
            return result;
        }
        
        @Override
        public String toString() {
            return "QuicPathEvent.ReusedSourceConnectionId{seq=" + this.seq + ", oldLocal=" + this.oldLocal + ", oldRemote=" + this.oldRemote + ", local=" + this.local() + ", remote=" + this.remote() + '}';
        }
    }
    
    public static final class PeerMigrated extends QuicPathEvent
    {
        public PeerMigrated(final InetSocketAddress local, final InetSocketAddress remote) {
            super(local, remote);
        }
        
        @Override
        public String toString() {
            return "QuicPathEvent.PeerMigrated{local=" + this.local() + ", remote=" + this.remote() + '}';
        }
    }
}
