package lc.mecha.cred;

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

public class AuthenticatedInetSocketAddress {
    private final InetSocketAddress socketAddress;
    private final Credential credential;

    public AuthenticatedInetSocketAddress(InetSocketAddress socketAddress, Credential credential) {
        this.socketAddress = socketAddress;
        this.credential = credential;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        AuthenticatedInetSocketAddress that = (AuthenticatedInetSocketAddress) o;
        return Objects.equals(socketAddress, that.socketAddress) &&
                Objects.equals(credential, that.credential);
    }

    @Override
    public int hashCode() {

        return Objects.hash(socketAddress, credential);
    }

    public InetSocketAddress getSocketAddress() {
        return socketAddress;
    }

    public Credential getCredential() {
        return credential;
    }
}
