package be.iminds.ilabt.jfed.log.cache;

import be.iminds.ilabt.jfed.call_log_output.SerializableApiCallDetails;
import be.iminds.ilabt.jfed.log.ApiCallDetails;

/**
 * User: twalcari
 * Date: 4/28/2014
 * Time: 17:40
 */
public final class ApiCallDetailsRef {
    private final int apiCallDetailsId;

    public ApiCallDetailsRef(int apiCallDetailsId) {
        this.apiCallDetailsId = apiCallDetailsId;
    }
    public ApiCallDetailsRef(SerializableApiCallDetails apiCallDetails) {
        this.apiCallDetailsId = apiCallDetails.getId();
    }

    public ApiCallDetailsRef(ApiCallDetails apiCallDetails) {
        this.apiCallDetailsId = apiCallDetails.getId();
    }

    public int getId() {
        return apiCallDetailsId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        ApiCallDetailsRef that = (ApiCallDetailsRef) o;

        if (apiCallDetailsId != that.apiCallDetailsId) return false;

        return true;
    }

    @Override
    public int hashCode() {
        return apiCallDetailsId;
    }

    @Override
    public String toString() {
        return "ApiCallDetailsRef{" +
                "apiCallDetailsId=" + apiCallDetailsId +
                '}';
    }
}
