package com.atlassian.bitbucket.mesh.network;

import io.grpc.Status;

import javax.annotation.Nullable;

/**
 * Basic connectivity summary information that is used to describe node to node connectivity.
 */
public class ConnectivitySummary {

    private final String errorMessage;
    private final boolean reachable;
    private final long roundTripTime;
    private final Status.Code statusCode;

    public ConnectivitySummary(boolean reachable, @Nullable String errorMessage, @Nullable Status.Code statusCode,
                               long roundTripTime) {
        this.errorMessage = errorMessage;
        this.reachable = reachable;
        this.roundTripTime = roundTripTime;
        this.statusCode = statusCode;
    }

    @Nullable
    public String getErrorMessage() {
        return errorMessage;
    }

    public long getRoundTripTime() {
        return roundTripTime;
    }

    @Nullable
    public Status.Code getStatusCode() {
        return statusCode;
    }

    public boolean isReachable() {
        return reachable;
    }
}
