// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.maps.route.implementation.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.models.ResponseError;
import com.azure.maps.route.models.RouteDirections;
import com.fasterxml.jackson.annotation.JsonProperty;

/** The result of the query. RouteDirections if the query completed successfully, ErrorResponse otherwise. */
@Fluent
public final class RouteDirectionsBatchItemResponse extends RouteDirections {
    /*
     * The error object.
     */
    @JsonProperty(value = "error")
    private ErrorDetail error;

    /**
     * Constructor with error
     *
     * @param error The error object
     */
    public RouteDirectionsBatchItemResponse(ErrorDetail error) {
        this.error = error;
    }

    /** Empty constructor */
    public RouteDirectionsBatchItemResponse() {}

    /**
     * Set the error property: The error object.
     *
     * @param error error the error value to set.
     * @return the RouteDirectionsBatchItemResponse object itself.
     */
    public ResponseError getError() {
        return new ResponseError(this.error.getCode(), this.error.getMessage());
    }

    public RouteDirectionsBatchItemResponse setError(ResponseError error) {
        this.error = new ErrorDetail().setCode(error.getCode()).setMessage(error.getMessage());
        return this;
    }
}
