import { toURLSearchParams } from '@wix/metro-runtime';
import { serializer } from '@wix/metro-runtime/ambassador';
import { resolveUrl } from '@wix/metro-runtime';
var _bulkGetComponentSettingsRequest = {};
var _bulkGetComponentSettingsResponse = {};
var _getComponentSettingsRequest = {};
var _getComponentSettingsResponse = {};
var _getGlobalSettingsRequest = {};
var _getGlobalSettingsResponse = {};
var _getRequest = { fields: 'google.protobuf.FieldMask' };
var _getResponse = {};
var _setComponentSettingsRequest = {};
var _setComponentSettingsResponse = {};
var _setGlobalSettingsRequest = {};
var _setGlobalSettingsResponse = {};
var _setRequest = {};
var _setResponse = {};
var _updateRequest = { fields: 'google.protobuf.FieldMask' };
var _updateResponse = {};
function resolveComWixFedSettingsAppSettingsServiceUrl(opts) {
    var domainToMappings = {
        'www._base_domain_': [
            {
                srcPath: '/_api/app-settings-service',
                destPath: '/api',
            },
            {
                srcPath: '/_api/wix-user-preferences-webapp',
                destPath: '/api/v1/userPreferences',
            },
            {
                srcPath: '/_api/app-settings-service/v1/settings/components',
                destPath: '/api/v1/settings/components',
            },
        ],
        'api._api_base_domain_': [
            {
                srcPath: '/app-settings-service',
                destPath: '',
            },
            {
                srcPath: '/_api/app-settings-service',
                destPath: '/api',
            },
        ],
        'bo._base_domain_': [
            {
                srcPath: '/app-settings-service',
                destPath: '/private/api',
            },
            {
                srcPath: '/_api/app-settings-service',
                destPath: '/api',
            },
            {
                srcPath: '/_api/wix-user-preferences-webapp',
                destPath: '/api/v1/userPreferences',
            },
            {
                srcPath: '/dev/_api/wix-user-preferences-webapp',
                destPath: '/api/v1/userPreferences',
            },
        ],
        'wixbo.ai': [
            {
                srcPath: '/app-settings-service',
                destPath: '/private/api',
            },
            {
                srcPath: '/_api/app-settings-service',
                destPath: '/api',
            },
            {
                srcPath: '/_api/wix-user-preferences-webapp',
                destPath: '/api/v1/userPreferences',
            },
            {
                srcPath: '/dev/_api/wix-user-preferences-webapp',
                destPath: '/api/v1/userPreferences',
            },
        ],
        'wix-bo.com': [
            {
                srcPath: '/app-settings-service',
                destPath: '/private/api',
            },
            {
                srcPath: '/_api/app-settings-service',
                destPath: '/api',
            },
            {
                srcPath: '/_api/wix-user-preferences-webapp',
                destPath: '/api/v1/userPreferences',
            },
            {
                srcPath: '/dev/_api/wix-user-preferences-webapp',
                destPath: '/api/v1/userPreferences',
            },
        ],
        _: [
            {
                srcPath: '/_api/app-settings-service',
                destPath: '/api',
            },
            {
                srcPath: '/_api/wix-user-preferences-webapp',
                destPath: '/api/v1/userPreferences',
            },
            {
                srcPath: '/_api/app-settings-service/v1/settings/components',
                destPath: '/api/v1/settings/components',
            },
            {
                srcPath: '/_api/app-settings-service/v1/settings/instances',
                destPath: '/api/v1/settings/instances',
            },
        ],
        'editor._base_domain_': [
            {
                srcPath: '/_api/app-settings-service',
                destPath: '/api',
            },
            {
                srcPath: '/_api/wix-user-preferences-webapp',
                destPath: '/api/v1/userPreferences',
            },
        ],
        'blocks._base_domain_': [
            {
                srcPath: '/_api/app-settings-service',
                destPath: '/api',
            },
            {
                srcPath: '/_api/wix-user-preferences-webapp',
                destPath: '/api/v1/userPreferences',
            },
        ],
        'create.editorx': [
            {
                srcPath: '/_api/app-settings-service',
                destPath: '/api',
            },
            {
                srcPath: '/_api/wix-user-preferences-webapp',
                destPath: '/api/v1/userPreferences',
            },
        ],
        '*.dev.wix-code.com': [
            {
                srcPath: '/_api/app-settings-service',
                destPath: '/api',
            },
        ],
        'progallery._base_domain_': [
            {
                srcPath: '/_api/app-settings-service',
                destPath: '/api',
            },
            {
                srcPath: '/_api/wix-user-preferences-webapp',
                destPath: '/api/v1/userPreferences',
            },
        ],
        'ecom._base_domain_': [
            {
                srcPath: '/_api/app-settings-service',
                destPath: '/api',
            },
            {
                srcPath: '/_api/wix-user-preferences-webapp',
                destPath: '/api/v1/userPreferences',
            },
        ],
        'bookings.wixapps.net': [
            {
                srcPath: '/_api/wix-user-preferences-webapp',
                destPath: '/api/v1/userPreferences',
            },
            {
                srcPath: '/_api/app-settings-service',
                destPath: '/api',
            },
        ],
        'scheduler._base_domain_': [
            {
                srcPath: '/_api/wix-user-preferences-webapp',
                destPath: '/api/v1/userPreferences',
            },
        ],
        'manage._base_domain_': [
            {
                srcPath: '/_api/app-settings-service',
                destPath: '/api',
            },
            {
                srcPath: '/_api/wix-user-preferences-webapp',
                destPath: '/api/v1/userPreferences',
            },
        ],
        'progallery.wixapps.net': [
            {
                srcPath: '/_api/app-settings-service',
                destPath: '/api',
            },
            {
                srcPath: '/_api/wix-user-preferences-webapp',
                destPath: '/api/v1/userPreferences',
            },
        ],
        'support._base_domain_': [
            {
                srcPath: '/_api/wix-user-preferences-webapp',
                destPath: '/api/v1/userPreferences',
            },
        ],
        'social-blog._base_domain_': [
            {
                srcPath: '/_api/app-settings-service',
                destPath: '/api',
            },
        ],
        'editor.wixapps.net': [
            {
                srcPath: '/_api/app-settings-service',
                destPath: '/api',
            },
            {
                srcPath: '/_api/wix-user-preferences-webapp',
                destPath: '/api/v1/userPreferences',
            },
        ],
        'dev._base_domain_': [
            {
                srcPath: '/_api/app-settings-service',
                destPath: '/api',
            },
            {
                srcPath: '/_api/wix-user-preferences-webapp',
                destPath: '/api/v1/userPreferences',
            },
        ],
        'www.wixapis.com': [
            {
                srcPath: '/settings',
                destPath: '/api',
            },
            {
                srcPath: '/user-preferences',
                destPath: '/api/v1/userPreferences',
            },
            {
                srcPath: '/_api/app-settings-service',
                destPath: '/api',
            },
            {
                srcPath: '/_api/wix-user-preferences-webapp',
                destPath: '/api/v1/userPreferences',
            },
        ],
        'addresses.wixapps.net': [
            {
                srcPath: '/_api/app-settings-service',
                destPath: '/api',
            },
        ],
        'vibe._base_domain_': [
            {
                srcPath: '/_api/wix-user-preferences-webapp',
                destPath: '/api/v1/userPreferences',
            },
        ],
    };
    return resolveUrl(Object.assign(opts, { domainToMappings: domainToMappings }));
}
/** Set component settings by componentId */
export function setComponentSettings(payload) {
    var _a = serializer(_setComponentSettingsRequest, {}), toReq = _a.toJSON, fromReq = _a.fromJSON;
    var fromRes = serializer(_setComponentSettingsResponse, {}).fromJSON;
    function __setComponentSettings(_a) {
        var host = _a.host;
        var serializedData = toReq(payload);
        var metadata = {
            entityFqdn: 'wix.app_settings.v1.settings',
            method: 'PATCH',
            methodFqn: 'com.wix.fed.settings.AppSettingsService.SetComponentSettings',
            url: resolveComWixFedSettingsAppSettingsServiceUrl({
                protoPath: '/api/v1/settings/components/{componentId}',
                data: serializedData,
                host: host,
            }),
            data: serializedData,
            transformResponse: fromRes,
        };
        return metadata;
    }
    __setComponentSettings.fromReq = fromReq;
    __setComponentSettings.__isAmbassador = true;
    return __setComponentSettings;
}
/** Get component settings by componentId */
export function getComponentSettings(payload) {
    var _a = serializer(_getComponentSettingsRequest, {}), toReq = _a.toJSON, fromReq = _a.fromJSON;
    var fromRes = serializer(_getComponentSettingsResponse, {}).fromJSON;
    function __getComponentSettings(_a) {
        var host = _a.host;
        var serializedData = toReq(payload);
        var metadata = {
            entityFqdn: 'wix.app_settings.v1.settings',
            method: 'GET',
            methodFqn: 'com.wix.fed.settings.AppSettingsService.GetComponentSettings',
            url: resolveComWixFedSettingsAppSettingsServiceUrl({
                protoPath: '/api/v1/settings/components/{componentId}',
                data: serializedData,
                host: host,
            }),
            params: toURLSearchParams(serializedData),
            transformResponse: fromRes,
        };
        return metadata;
    }
    __getComponentSettings.fromReq = fromReq;
    __getComponentSettings.__isAmbassador = true;
    return __getComponentSettings;
}
/** Get component settings by componentId */
export function bulkGetComponentSettings(payload) {
    var _a = serializer(_bulkGetComponentSettingsRequest, {}), toReq = _a.toJSON, fromReq = _a.fromJSON;
    var fromRes = serializer(_bulkGetComponentSettingsResponse, {}).fromJSON;
    function __bulkGetComponentSettings(_a) {
        var host = _a.host;
        var serializedData = toReq(payload);
        var metadata = {
            entityFqdn: 'wix.app_settings.v1.settings',
            method: 'POST',
            methodFqn: 'com.wix.fed.settings.AppSettingsService.BulkGetComponentSettings',
            url: resolveComWixFedSettingsAppSettingsServiceUrl({
                protoPath: '/api/v1/settings/components/bulk',
                data: serializedData,
                host: host,
            }),
            data: serializedData,
            transformResponse: fromRes,
        };
        return metadata;
    }
    __bulkGetComponentSettings.fromReq = fromReq;
    __bulkGetComponentSettings.__isAmbassador = true;
    return __bulkGetComponentSettings;
}
/** Set global settings by instanceId (extracted from Authorization) */
export function setGlobalSettings(payload) {
    var _a = serializer(_setGlobalSettingsRequest, {}), toReq = _a.toJSON, fromReq = _a.fromJSON;
    var fromRes = serializer(_setGlobalSettingsResponse, {}).fromJSON;
    function __setGlobalSettings(_a) {
        var host = _a.host;
        var serializedData = toReq(payload);
        var metadata = {
            entityFqdn: 'wix.app_settings.v1.settings',
            method: 'PATCH',
            methodFqn: 'com.wix.fed.settings.AppSettingsService.SetGlobalSettings',
            url: resolveComWixFedSettingsAppSettingsServiceUrl({
                protoPath: '/api/v1/settings/instances',
                data: serializedData,
                host: host,
            }),
            data: serializedData,
            transformResponse: fromRes,
        };
        return metadata;
    }
    __setGlobalSettings.fromReq = fromReq;
    __setGlobalSettings.__isAmbassador = true;
    return __setGlobalSettings;
}
/** Get global settings by instanceId (extracted from Authorization) */
export function getGlobalSettings(payload) {
    var _a = serializer(_getGlobalSettingsRequest, {}), toReq = _a.toJSON, fromReq = _a.fromJSON;
    var fromRes = serializer(_getGlobalSettingsResponse, {}).fromJSON;
    function __getGlobalSettings(_a) {
        var host = _a.host;
        var serializedData = toReq(payload);
        var metadata = {
            entityFqdn: 'wix.app_settings.v1.settings',
            method: 'GET',
            methodFqn: 'com.wix.fed.settings.AppSettingsService.GetGlobalSettings',
            url: resolveComWixFedSettingsAppSettingsServiceUrl({
                protoPath: '/api/v1/settings/instances',
                data: serializedData,
                host: host,
            }),
            params: toURLSearchParams(serializedData),
            transformResponse: fromRes,
        };
        return metadata;
    }
    __getGlobalSettings.fromReq = fromReq;
    __getGlobalSettings.__isAmbassador = true;
    return __getGlobalSettings;
}
/**
 * retrieve settings for site. app and component-scoped settings ids can be provided.
 * looks-up settings for one or both ids provided.
 * @deprecated
 */
export function get(payload) {
    var _a = serializer(_getRequest, {}), toReq = _a.toJSON, fromReq = _a.fromJSON;
    var fromRes = serializer(_getResponse, {}).fromJSON;
    function __get(_a) {
        var host = _a.host;
        var serializedData = toReq(payload);
        var metadata = {
            entityFqdn: 'wix.app_settings.v1.settings',
            method: 'GET',
            methodFqn: 'com.wix.fed.settings.AppSettingsService.Get',
            url: resolveComWixFedSettingsAppSettingsServiceUrl({
                protoPath: '/api/v2/settings',
                data: serializedData,
                host: host,
            }),
            params: toURLSearchParams(serializedData),
            transformResponse: fromRes,
        };
        return metadata;
    }
    __get.fromReq = fromReq;
    __get.__isAmbassador = true;
    return __get;
}
/**
 * store new snapshot of settings on server
 * @deprecated
 */
export function set(payload) {
    var _a = serializer(_setRequest, {}), toReq = _a.toJSON, fromReq = _a.fromJSON;
    var fromRes = serializer(_setResponse, {}).fromJSON;
    function __set(_a) {
        var host = _a.host;
        var serializedData = toReq(payload);
        var metadata = {
            entityFqdn: 'wix.app_settings.v1.settings',
            method: 'PUT',
            methodFqn: 'com.wix.fed.settings.AppSettingsService.Set',
            url: resolveComWixFedSettingsAppSettingsServiceUrl({
                protoPath: '/api/v2/settings/{scope}/{externalId}',
                data: serializedData,
                host: host,
            }),
            data: serializedData,
            transformResponse: fromRes,
        };
        return metadata;
    }
    __set.fromReq = fromReq;
    __set.__isAmbassador = true;
    return __set;
}
/**
 * create new snapshot of settings (patch)
 * @deprecated
 */
export function update(payload) {
    var _a = serializer(_updateRequest, {}), toReq = _a.toJSON, fromReq = _a.fromJSON;
    var fromRes = serializer(_updateResponse, {}).fromJSON;
    function __update(_a) {
        var host = _a.host;
        var serializedData = toReq(payload);
        var metadata = {
            entityFqdn: 'wix.app_settings.v1.settings',
            method: 'PATCH',
            methodFqn: 'com.wix.fed.settings.AppSettingsService.Update',
            url: resolveComWixFedSettingsAppSettingsServiceUrl({
                protoPath: '/api/v2/settings/{scope}/{externalId}',
                data: serializedData,
                host: host,
            }),
            data: serializedData,
            transformResponse: fromRes,
        };
        return metadata;
    }
    __update.fromReq = fromReq;
    __update.__isAmbassador = true;
    return __update;
}
//# sourceMappingURL=http.impl.js.map