package be.iminds.ilabt.jfed.experimenter_gui.slice.errors;

import be.iminds.ilabt.jfed.highlevel.controller.TaskExecution;
import be.iminds.ilabt.jfed.log.cache.ApiCallDetailsRef;
import be.iminds.ilabt.jfed.lowlevel.api_wrapper.ErrorDetails;
import be.iminds.ilabt.jfed.util.GeniUrn;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;

/**
 * User: twalcari
 * Date: 10/15/2014
 * Time: 09:09
 */
public class ApiCallErrorDetails extends ErrorDetails {
    @Nonnull
    private final TaskExecution taskExecution;
    @Nullable
    private final ApiCallDetailsRef apiCallDetailsRef;

    public ApiCallErrorDetails(String error, GeniUrn sliverUrn, GeniUrn componentUrn, @Nonnull TaskExecution taskExecution, @Nullable ApiCallDetailsRef apiCallDetailsRef) {
        super(error, sliverUrn, componentUrn);
        this.taskExecution = taskExecution;
        this.apiCallDetailsRef = apiCallDetailsRef;
    }

    public ApiCallErrorDetails(String error, GeniUrn sliverUrn, @Nonnull TaskExecution taskExecution, @Nullable ApiCallDetailsRef apiCallDetailsRef) {
        super(error, sliverUrn);
        this.taskExecution = taskExecution;
        this.apiCallDetailsRef = apiCallDetailsRef;
    }

    public ApiCallErrorDetails(String error, String sliverUrn, String componentUrn, @Nonnull TaskExecution taskExecution, @Nullable ApiCallDetailsRef apiCallDetailsRef) {
        super(error, sliverUrn, componentUrn);
        this.taskExecution = taskExecution;
        this.apiCallDetailsRef = apiCallDetailsRef;
    }

    public ApiCallErrorDetails(String error, String sliverUrn, @Nonnull TaskExecution taskExecution, @Nullable ApiCallDetailsRef apiCallDetailsRef) {
        super(error, sliverUrn);
        this.taskExecution = taskExecution;
        this.apiCallDetailsRef = apiCallDetailsRef;
    }

    public ApiCallErrorDetails(String error, @Nonnull TaskExecution taskExecution, @Nullable ApiCallDetailsRef apiCallDetailsRef) {
        super(error);
        this.taskExecution = taskExecution;
        this.apiCallDetailsRef = apiCallDetailsRef;
    }

    public TaskExecution getTaskExecution() {
        return taskExecution;
    }

    @Nullable
    public ApiCallDetailsRef getApiCallDetailsRef() {
        return apiCallDetailsRef;
    }
}
