// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
import { FinalStateValue } from "@azure-tools/typespec-azure-core";
export var OperationFinalStateVia;
(function (OperationFinalStateVia) {
    OperationFinalStateVia[OperationFinalStateVia["AzureAsyncOperation"] = 0] = "AzureAsyncOperation";
    OperationFinalStateVia[OperationFinalStateVia["Location"] = 1] = "Location";
    OperationFinalStateVia[OperationFinalStateVia["OriginalUri"] = 2] = "OriginalUri";
    OperationFinalStateVia[OperationFinalStateVia["OperationLocation"] = 3] = "OperationLocation";
    OperationFinalStateVia[OperationFinalStateVia["CustomLink"] = 4] = "CustomLink";
    OperationFinalStateVia[OperationFinalStateVia["CustomOperationReference"] = 5] = "CustomOperationReference";
    OperationFinalStateVia[OperationFinalStateVia["NoResult"] = 6] = "NoResult";
})(OperationFinalStateVia || (OperationFinalStateVia = {}));
export function convertLroFinalStateVia(finalStateValue) {
    switch (finalStateValue) {
        case FinalStateValue.azureAsyncOperation:
            return OperationFinalStateVia.AzureAsyncOperation;
        // TODO: we don't have implementation of custom-link and custom-operation-reference yet
        // case FinalStateValue.customLink:
        //     return OperationFinalStateVia.CustomLink;
        // And right now some existing API specs are not correctly defined so that they are parsed
        // into `custom-operation-reference` which should be `operation-location`.
        // so let's fallback `custom-operation-reference` into `operation-location` as a work-around
        case FinalStateValue.customOperationReference:
            return OperationFinalStateVia.OperationLocation;
        case FinalStateValue.location:
            return OperationFinalStateVia.Location;
        case FinalStateValue.originalUri:
            return OperationFinalStateVia.OriginalUri;
        case FinalStateValue.operationLocation:
            return OperationFinalStateVia.OperationLocation;
        default:
            throw `Unsupported LRO final state value: ${finalStateValue}`;
    }
}
//# sourceMappingURL=operation-final-state-via.js.map