//
// Copyright 2024 Picovoice Inc.
//
// You may not use this file except in compliance with the license. A copy of the license is located in the "LICENSE"
// file accompanying this source.
//
// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
// an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
// specific language governing permissions and limitations under the License.
//
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const pv_speaker_status_t_1 = require("./pv_speaker_status_t");
class PvSpeakerStatusOutOfMemoryError extends Error {
}
class PvSpeakerStatusInvalidArgumentError extends Error {
}
class PvSpeakerStatusInvalidStateError extends Error {
}
class PvSpeakerStatusBackendError extends Error {
}
class PvSpeakerStatusDeviceAlreadyInitializedError extends Error {
}
class PvSpeakerStatusDeviceNotInitializedError extends Error {
}
class PvSpeakerStatusIOError extends Error {
}
class PvSpeakerStatusRuntimeError extends Error {
}
function pvSpeakerStatusToException(status, errorMessage) {
    switch (status) {
        case pv_speaker_status_t_1.default.OUT_OF_MEMORY:
            return new PvSpeakerStatusOutOfMemoryError(errorMessage);
        case pv_speaker_status_t_1.default.INVALID_ARGUMENT:
            return new PvSpeakerStatusInvalidArgumentError(errorMessage);
        case pv_speaker_status_t_1.default.INVALID_STATE:
            return new PvSpeakerStatusInvalidStateError(errorMessage);
        case pv_speaker_status_t_1.default.BACKEND_ERROR:
            return new PvSpeakerStatusBackendError(errorMessage);
        case pv_speaker_status_t_1.default.DEVICE_ALREADY_INITIALIZED:
            return new PvSpeakerStatusDeviceAlreadyInitializedError(errorMessage);
        case pv_speaker_status_t_1.default.DEVICE_NOT_INITIALIZED:
            return new PvSpeakerStatusDeviceNotInitializedError(errorMessage);
        case pv_speaker_status_t_1.default.IO_ERROR:
            return new PvSpeakerStatusIOError(errorMessage);
        case pv_speaker_status_t_1.default.RUNTIME_ERROR:
            return new PvSpeakerStatusRuntimeError(errorMessage);
        default:
            // eslint-disable-next-line
            console.warn(`Unknown error code: ${status}`);
            return new Error(errorMessage);
    }
}
exports.default = pvSpeakerStatusToException;
//# sourceMappingURL=errors.js.map