// Copyright (c) 2009-2026 SAP SE, All Rights Reserved

/**
 * @fileOverview Deprecated service stub for the Fiori Launchpad Sandbox.
 *
 * This module provides a service constructor that throws an error when instantiated,
 * indicating that the requested service is deprecated and not supported in the sandbox
 * environment. It is used in the sandbox configuration to explicitly block legacy services
 * that have been replaced by their V2 successors.
 *
 * @version 1.148.1
 * @since 1.147
 */
sap.ui.define([], () => {
    "use strict";

    /**
     * Deprecated service constructor.
     *
     * Throws an error when instantiated, informing the developer that the service
     * is deprecated and providing the name of the successor service (if available).
     *
     * @param {object} oContainerInterface The container interface
     * @param {string} sParameters The service parameters
     * @param {object} oServiceConfiguration The service configuration
     * @param {string} oServiceConfiguration.name The name of the deprecated service
     * @param {string} [oServiceConfiguration.successor] The name of the successor service
     * @param {string} [oServiceConfiguration.reason] Custom reason text (used when no successor exists)
     * @throws {Error} Always throws an error indicating the service is deprecated
     * @since 1.147
     * @private
     */
    function DeprecatedService (oContainerInterface, sParameters, oServiceConfiguration) {
        const sSuccessorText = oServiceConfiguration.successor
            ? `Use ${oServiceConfiguration.successor} instead.`
            : (oServiceConfiguration.reason ?? "This concept has been abandoned.");
        throw new Error(
            `The '${oServiceConfiguration.name}' service is deprecated and not supported in the sandbox environment. ${sSuccessorText}`
        );
    }

    DeprecatedService.hasNoAdapter = true;

    return DeprecatedService;
});
