import { toURLSearchParams } from '@wix/metro-runtime';
import { serializer } from '@wix/metro-runtime/ambassador';
import { resolveUrl } from '@wix/metro-runtime';
var _createGlobalTagRequest = { tag: '_tag' };
var _createGlobalTagResponse = { tag: '_tag' };
var _createTagForAccountRequest = { tag: '_tag' };
var _createTagForAccountResponse = { tag: '_tag' };
var _createTagRequest = { tag: '_tag' };
var _createTagResponse = { tag: '_tag' };
var _deleteGlobalTagRequest = {};
var _deleteGlobalTagResponse = {};
var _deleteTagForAccountRequest = {};
var _deleteTagForAccountResponse = {};
var _deleteTagRequest = {};
var _deleteTagResponse = {};
var _getGlobalTagRequest = {};
var _getGlobalTagResponse = { tag: '_tag' };
var _getTagForAccountRequest = {};
var _getTagForAccountResponse = { tag: '_tag' };
var _getTagRequest = {};
var _getTagResponse = { tag: '_tag' };
var _listGlobalTagsRequest = {};
var _listGlobalTagsResponse = { tags: '_tag' };
var _listTagsForAccountRequest = {};
var _listTagsForAccountResponse = { tags: '_tag' };
var _listTagsRequest = {};
var _listTagsResponse = { tags: '_tag' };
var _queryTagsForAccountRequest = {};
var _queryTagsForAccountResponse = { tags: '_tag' };
var _queryTagsRequest = {};
var _queryTagsResponse = { tags: '_tag' };
var _tag = {
    createdDate: 'google.protobuf.Timestamp',
    updatedDate: 'google.protobuf.Timestamp',
};
var _updateGlobalTagRequest = { tag: '_tag' };
var _updateGlobalTagResponse = { tag: '_tag' };
var _updateTagForAccountRequest = { tag: '_tag' };
var _updateTagForAccountResponse = { tag: '_tag' };
var _updateTagRequest = { tag: '_tag' };
var _updateTagResponse = { tag: '_tag' };
function resolveWixOsV1TagsAccountServiceUrl(opts) {
    var domainToMappings = {
        'api._api_base_domain_': [
            {
                srcPath: '/tags-service',
                destPath: '',
            },
        ],
        'manage._base_domain_': [
            {
                srcPath: '/tags-service',
                destPath: '',
            },
        ],
        '*.dev.wix-code.com': [
            {
                srcPath: '/_api/tags-service',
                destPath: '/v1/tags',
            },
        ],
        'www.wixapis.com': [
            {
                srcPath: '/tags/v1/tags',
                destPath: '/v1/tags',
            },
        ],
        'bo._base_domain_': [
            {
                srcPath: '/_api/tags-service',
                destPath: '',
            },
        ],
        'wixbo.ai': [
            {
                srcPath: '/_api/tags-service',
                destPath: '',
            },
        ],
        'wix-bo.com': [
            {
                srcPath: '/_api/tags-service',
                destPath: '',
            },
        ],
    };
    return resolveUrl(Object.assign(opts, { domainToMappings: domainToMappings }));
}
function resolveWixOsV1TagsGlobalServiceUrl(opts) {
    var domainToMappings = {
        'api._api_base_domain_': [
            {
                srcPath: '/tags-service',
                destPath: '',
            },
        ],
        'manage._base_domain_': [
            {
                srcPath: '/tags-service',
                destPath: '',
            },
        ],
        '*.dev.wix-code.com': [
            {
                srcPath: '/_api/tags-service',
                destPath: '/v1/tags',
            },
        ],
        'www.wixapis.com': [
            {
                srcPath: '/tags/v1/tags',
                destPath: '/v1/tags',
            },
        ],
        'bo._base_domain_': [
            {
                srcPath: '/_api/tags-service',
                destPath: '',
            },
        ],
        'wixbo.ai': [
            {
                srcPath: '/_api/tags-service',
                destPath: '',
            },
        ],
        'wix-bo.com': [
            {
                srcPath: '/_api/tags-service',
                destPath: '',
            },
        ],
    };
    return resolveUrl(Object.assign(opts, { domainToMappings: domainToMappings }));
}
function resolveWixOsV1TagsServiceUrl(opts) {
    var domainToMappings = {
        'api._api_base_domain_': [
            {
                srcPath: '/tags-service',
                destPath: '',
            },
        ],
        'manage._base_domain_': [
            {
                srcPath: '/tags-service',
                destPath: '',
            },
        ],
        '*.dev.wix-code.com': [
            {
                srcPath: '/_api/tags-service',
                destPath: '/v1/tags',
            },
        ],
        'www.wixapis.com': [
            {
                srcPath: '/tags/v1/tags',
                destPath: '/v1/tags',
            },
        ],
        'bo._base_domain_': [
            {
                srcPath: '/_api/tags-service',
                destPath: '',
            },
        ],
        'wixbo.ai': [
            {
                srcPath: '/_api/tags-service',
                destPath: '',
            },
        ],
        'wix-bo.com': [
            {
                srcPath: '/_api/tags-service',
                destPath: '',
            },
        ],
    };
    return resolveUrl(Object.assign(opts, { domainToMappings: domainToMappings }));
}
/** Creates a global tag. */
export function createGlobalTag(payload) {
    var _a = serializer(_createGlobalTagRequest, { _tag: _tag }), toReq = _a.toJSON, fromReq = _a.fromJSON;
    var fromRes = serializer(_createGlobalTagResponse, { _tag: _tag }).fromJSON;
    function __createGlobalTag(_a) {
        var host = _a.host;
        var serializedData = toReq(payload);
        var metadata = {
            entityFqdn: 'wix.os.tags.v1.tag',
            method: 'POST',
            methodFqn: 'wix.os.v1.TagsGlobalService.CreateGlobalTag',
            migrationOptions: {
                optInTransformResponse: true,
            },
            url: resolveWixOsV1TagsGlobalServiceUrl({
                protoPath: '/v1/global/tags',
                data: serializedData,
                host: host,
            }),
            data: serializedData,
            transformResponse: fromRes,
        };
        return metadata;
    }
    __createGlobalTag.fromReq = fromReq;
    __createGlobalTag.__isAmbassador = true;
    return __createGlobalTag;
}
/** Retrieves a global tag. */
export function getGlobalTag(payload) {
    var _a = serializer(_getGlobalTagRequest, {}), toReq = _a.toJSON, fromReq = _a.fromJSON;
    var fromRes = serializer(_getGlobalTagResponse, { _tag: _tag }).fromJSON;
    function __getGlobalTag(_a) {
        var host = _a.host;
        var serializedData = toReq(payload);
        var metadata = {
            entityFqdn: 'wix.os.tags.v1.tag',
            method: 'GET',
            methodFqn: 'wix.os.v1.TagsGlobalService.GetGlobalTag',
            migrationOptions: {
                optInTransformResponse: true,
            },
            url: resolveWixOsV1TagsGlobalServiceUrl({
                protoPath: '/v1/global/tags/{tagId}',
                data: serializedData,
                host: host,
            }),
            params: toURLSearchParams(serializedData),
            transformResponse: fromRes,
        };
        return metadata;
    }
    __getGlobalTag.fromReq = fromReq;
    __getGlobalTag.__isAmbassador = true;
    return __getGlobalTag;
}
/** Updates a global tag. */
export function updateGlobalTag(payload) {
    var _a = serializer(_updateGlobalTagRequest, { _tag: _tag }), toReq = _a.toJSON, fromReq = _a.fromJSON;
    var fromRes = serializer(_updateGlobalTagResponse, { _tag: _tag }).fromJSON;
    function __updateGlobalTag(_a) {
        var host = _a.host;
        var serializedData = toReq(payload);
        var metadata = {
            entityFqdn: 'wix.os.tags.v1.tag',
            method: 'PATCH',
            methodFqn: 'wix.os.v1.TagsGlobalService.UpdateGlobalTag',
            migrationOptions: {
                optInTransformResponse: true,
            },
            url: resolveWixOsV1TagsGlobalServiceUrl({
                protoPath: '/v1/global/tags/{tag.id}',
                data: serializedData,
                host: host,
            }),
            data: serializedData,
            transformResponse: fromRes,
        };
        return metadata;
    }
    __updateGlobalTag.fromReq = fromReq;
    __updateGlobalTag.__isAmbassador = true;
    return __updateGlobalTag;
}
/** Deletes a global tag. */
export function deleteGlobalTag(payload) {
    var _a = serializer(_deleteGlobalTagRequest, {}), toReq = _a.toJSON, fromReq = _a.fromJSON;
    var fromRes = serializer(_deleteGlobalTagResponse, {}).fromJSON;
    function __deleteGlobalTag(_a) {
        var host = _a.host;
        var serializedData = toReq(payload);
        var metadata = {
            entityFqdn: 'wix.os.tags.v1.tag',
            method: 'DELETE',
            methodFqn: 'wix.os.v1.TagsGlobalService.DeleteGlobalTag',
            migrationOptions: {
                optInTransformResponse: true,
            },
            url: resolveWixOsV1TagsGlobalServiceUrl({
                protoPath: '/v1/global/tags/{tagId}',
                data: serializedData,
                host: host,
            }),
            params: toURLSearchParams(serializedData),
            transformResponse: fromRes,
        };
        return metadata;
    }
    __deleteGlobalTag.fromReq = fromReq;
    __deleteGlobalTag.__isAmbassador = true;
    return __deleteGlobalTag;
}
/** Retrieves a list of global tags. */
export function listGlobalTags(payload) {
    var _a = serializer(_listGlobalTagsRequest, {}), toReq = _a.toJSON, fromReq = _a.fromJSON;
    var fromRes = serializer(_listGlobalTagsResponse, { _tag: _tag }).fromJSON;
    function __listGlobalTags(_a) {
        var host = _a.host;
        var serializedData = toReq(payload);
        var metadata = {
            entityFqdn: 'wix.os.tags.v1.tag',
            method: 'GET',
            methodFqn: 'wix.os.v1.TagsGlobalService.ListGlobalTags',
            migrationOptions: {
                optInTransformResponse: true,
            },
            url: resolveWixOsV1TagsGlobalServiceUrl({
                protoPath: '/v1/global/tags',
                data: serializedData,
                host: host,
            }),
            params: toURLSearchParams(serializedData),
            transformResponse: fromRes,
        };
        return metadata;
    }
    __listGlobalTags.fromReq = fromReq;
    __listGlobalTags.__isAmbassador = true;
    return __listGlobalTags;
}
/** Creates a tag. */
export function createTagForAccount(payload) {
    var _a = serializer(_createTagForAccountRequest, { _tag: _tag }), toReq = _a.toJSON, fromReq = _a.fromJSON;
    var fromRes = serializer(_createTagForAccountResponse, {
        _tag: _tag,
    }).fromJSON;
    function __createTagForAccount(_a) {
        var host = _a.host;
        var serializedData = toReq(payload);
        var metadata = {
            entityFqdn: 'wix.os.tags.v1.tag',
            method: 'POST',
            methodFqn: 'wix.os.v1.TagsAccountService.CreateTagForAccount',
            migrationOptions: {
                optInTransformResponse: true,
            },
            url: resolveWixOsV1TagsAccountServiceUrl({
                protoPath: '/v1/account/tags',
                data: serializedData,
                host: host,
            }),
            data: serializedData,
            transformResponse: fromRes,
        };
        return metadata;
    }
    __createTagForAccount.fromReq = fromReq;
    __createTagForAccount.__isAmbassador = true;
    return __createTagForAccount;
}
/** Retrieves a tag. */
export function getTagForAccount(payload) {
    var _a = serializer(_getTagForAccountRequest, {}), toReq = _a.toJSON, fromReq = _a.fromJSON;
    var fromRes = serializer(_getTagForAccountResponse, { _tag: _tag }).fromJSON;
    function __getTagForAccount(_a) {
        var host = _a.host;
        var serializedData = toReq(payload);
        var metadata = {
            entityFqdn: 'wix.os.tags.v1.tag',
            method: 'GET',
            methodFqn: 'wix.os.v1.TagsAccountService.GetTagForAccount',
            migrationOptions: {
                optInTransformResponse: true,
            },
            url: resolveWixOsV1TagsAccountServiceUrl({
                protoPath: '/v1/account/tags/{tagId}',
                data: serializedData,
                host: host,
            }),
            params: toURLSearchParams(serializedData),
            transformResponse: fromRes,
        };
        return metadata;
    }
    __getTagForAccount.fromReq = fromReq;
    __getTagForAccount.__isAmbassador = true;
    return __getTagForAccount;
}
/** Updates a tag. */
export function updateTagForAccount(payload) {
    var _a = serializer(_updateTagForAccountRequest, { _tag: _tag }), toReq = _a.toJSON, fromReq = _a.fromJSON;
    var fromRes = serializer(_updateTagForAccountResponse, {
        _tag: _tag,
    }).fromJSON;
    function __updateTagForAccount(_a) {
        var host = _a.host;
        var serializedData = toReq(payload);
        var metadata = {
            entityFqdn: 'wix.os.tags.v1.tag',
            method: 'PATCH',
            methodFqn: 'wix.os.v1.TagsAccountService.UpdateTagForAccount',
            migrationOptions: {
                optInTransformResponse: true,
            },
            url: resolveWixOsV1TagsAccountServiceUrl({
                protoPath: '/v1/account/tags/{tag.id}',
                data: serializedData,
                host: host,
            }),
            data: serializedData,
            transformResponse: fromRes,
        };
        return metadata;
    }
    __updateTagForAccount.fromReq = fromReq;
    __updateTagForAccount.__isAmbassador = true;
    return __updateTagForAccount;
}
/** Deletes a tag. */
export function deleteTagForAccount(payload) {
    var _a = serializer(_deleteTagForAccountRequest, {}), toReq = _a.toJSON, fromReq = _a.fromJSON;
    var fromRes = serializer(_deleteTagForAccountResponse, {}).fromJSON;
    function __deleteTagForAccount(_a) {
        var host = _a.host;
        var serializedData = toReq(payload);
        var metadata = {
            entityFqdn: 'wix.os.tags.v1.tag',
            method: 'DELETE',
            methodFqn: 'wix.os.v1.TagsAccountService.DeleteTagForAccount',
            migrationOptions: {
                optInTransformResponse: true,
            },
            url: resolveWixOsV1TagsAccountServiceUrl({
                protoPath: '/v1/account/tags/{tagId}',
                data: serializedData,
                host: host,
            }),
            params: toURLSearchParams(serializedData),
            transformResponse: fromRes,
        };
        return metadata;
    }
    __deleteTagForAccount.fromReq = fromReq;
    __deleteTagForAccount.__isAmbassador = true;
    return __deleteTagForAccount;
}
/** Retrieves a list of tags. */
export function listTagsForAccount(payload) {
    var _a = serializer(_listTagsForAccountRequest, {}), toReq = _a.toJSON, fromReq = _a.fromJSON;
    var fromRes = serializer(_listTagsForAccountResponse, {
        _tag: _tag,
    }).fromJSON;
    function __listTagsForAccount(_a) {
        var host = _a.host;
        var serializedData = toReq(payload);
        var metadata = {
            entityFqdn: 'wix.os.tags.v1.tag',
            method: 'GET',
            methodFqn: 'wix.os.v1.TagsAccountService.ListTagsForAccount',
            migrationOptions: {
                optInTransformResponse: true,
            },
            url: resolveWixOsV1TagsAccountServiceUrl({
                protoPath: '/v1/account/tags',
                data: serializedData,
                host: host,
            }),
            params: toURLSearchParams(serializedData),
            transformResponse: fromRes,
        };
        return metadata;
    }
    __listTagsForAccount.fromReq = fromReq;
    __listTagsForAccount.__isAmbassador = true;
    return __listTagsForAccount;
}
/** Retrieves a list of tags. */
export function queryTagsForAccount(payload) {
    var _a = serializer(_queryTagsForAccountRequest, {}), toReq = _a.toJSON, fromReq = _a.fromJSON;
    var fromRes = serializer(_queryTagsForAccountResponse, {
        _tag: _tag,
    }).fromJSON;
    function __queryTagsForAccount(_a) {
        var host = _a.host;
        var serializedData = toReq(payload);
        var metadata = {
            entityFqdn: 'wix.os.tags.v1.tag',
            method: 'GET',
            methodFqn: 'wix.os.v1.TagsAccountService.QueryTagsForAccount',
            migrationOptions: {
                optInTransformResponse: true,
            },
            url: resolveWixOsV1TagsAccountServiceUrl({
                protoPath: '/v1/account/tags/query',
                data: serializedData,
                host: host,
            }),
            params: toURLSearchParams(serializedData, true),
            transformResponse: fromRes,
            fallback: [
                {
                    method: 'POST',
                    url: resolveWixOsV1TagsAccountServiceUrl({
                        protoPath: '/v1/account/tags/query',
                        data: serializedData,
                        host: host,
                    }),
                    data: serializedData,
                },
            ],
        };
        return metadata;
    }
    __queryTagsForAccount.fromReq = fromReq;
    __queryTagsForAccount.__isAmbassador = true;
    return __queryTagsForAccount;
}
/** Creates a tag. */
export function createTag(payload) {
    var _a = serializer(_createTagRequest, {
        _tag: _tag,
    }), toReq = _a.toJSON, fromReq = _a.fromJSON;
    var fromRes = serializer(_createTagResponse, { _tag: _tag }).fromJSON;
    function __createTag(_a) {
        var host = _a.host;
        var serializedData = toReq(payload);
        var metadata = {
            entityFqdn: 'wix.os.tags.v1.tag',
            method: 'POST',
            methodFqn: 'wix.os.v1.TagsService.CreateTag',
            migrationOptions: {
                optInTransformResponse: true,
            },
            url: resolveWixOsV1TagsServiceUrl({
                protoPath: '/v1/tags',
                data: serializedData,
                host: host,
            }),
            data: serializedData,
            transformResponse: fromRes,
        };
        return metadata;
    }
    __createTag.fromReq = fromReq;
    __createTag.__isAmbassador = true;
    return __createTag;
}
/** Retrieves a tag. */
export function getTag(payload) {
    var _a = serializer(_getTagRequest, {}), toReq = _a.toJSON, fromReq = _a.fromJSON;
    var fromRes = serializer(_getTagResponse, { _tag: _tag }).fromJSON;
    function __getTag(_a) {
        var host = _a.host;
        var serializedData = toReq(payload);
        var metadata = {
            entityFqdn: 'wix.os.tags.v1.tag',
            method: 'GET',
            methodFqn: 'wix.os.v1.TagsService.GetTag',
            migrationOptions: {
                optInTransformResponse: true,
            },
            url: resolveWixOsV1TagsServiceUrl({
                protoPath: '/v1/tags/{tagId}',
                data: serializedData,
                host: host,
            }),
            params: toURLSearchParams(serializedData),
            transformResponse: fromRes,
        };
        return metadata;
    }
    __getTag.fromReq = fromReq;
    __getTag.__isAmbassador = true;
    return __getTag;
}
/** Updates a tag. */
export function updateTag(payload) {
    var _a = serializer(_updateTagRequest, {
        _tag: _tag,
    }), toReq = _a.toJSON, fromReq = _a.fromJSON;
    var fromRes = serializer(_updateTagResponse, { _tag: _tag }).fromJSON;
    function __updateTag(_a) {
        var host = _a.host;
        var serializedData = toReq(payload);
        var metadata = {
            entityFqdn: 'wix.os.tags.v1.tag',
            method: 'PATCH',
            methodFqn: 'wix.os.v1.TagsService.UpdateTag',
            migrationOptions: {
                optInTransformResponse: true,
            },
            url: resolveWixOsV1TagsServiceUrl({
                protoPath: '/v1/tags/{tag.id}',
                data: serializedData,
                host: host,
            }),
            data: serializedData,
            transformResponse: fromRes,
        };
        return metadata;
    }
    __updateTag.fromReq = fromReq;
    __updateTag.__isAmbassador = true;
    return __updateTag;
}
/** Deletes a tag. */
export function deleteTag(payload) {
    var _a = serializer(_deleteTagRequest, {}), toReq = _a.toJSON, fromReq = _a.fromJSON;
    var fromRes = serializer(_deleteTagResponse, {}).fromJSON;
    function __deleteTag(_a) {
        var host = _a.host;
        var serializedData = toReq(payload);
        var metadata = {
            entityFqdn: 'wix.os.tags.v1.tag',
            method: 'DELETE',
            methodFqn: 'wix.os.v1.TagsService.DeleteTag',
            migrationOptions: {
                optInTransformResponse: true,
            },
            url: resolveWixOsV1TagsServiceUrl({
                protoPath: '/v1/tags/{tagId}',
                data: serializedData,
                host: host,
            }),
            params: toURLSearchParams(serializedData),
            transformResponse: fromRes,
        };
        return metadata;
    }
    __deleteTag.fromReq = fromReq;
    __deleteTag.__isAmbassador = true;
    return __deleteTag;
}
/** Retrieves a list of tags. */
export function listTags(payload) {
    var _a = serializer(_listTagsRequest, {}), toReq = _a.toJSON, fromReq = _a.fromJSON;
    var fromRes = serializer(_listTagsResponse, { _tag: _tag }).fromJSON;
    function __listTags(_a) {
        var host = _a.host;
        var serializedData = toReq(payload);
        var metadata = {
            entityFqdn: 'wix.os.tags.v1.tag',
            method: 'GET',
            methodFqn: 'wix.os.v1.TagsService.ListTags',
            migrationOptions: {
                optInTransformResponse: true,
            },
            url: resolveWixOsV1TagsServiceUrl({
                protoPath: '/v1/tags',
                data: serializedData,
                host: host,
            }),
            params: toURLSearchParams(serializedData),
            transformResponse: fromRes,
        };
        return metadata;
    }
    __listTags.fromReq = fromReq;
    __listTags.__isAmbassador = true;
    return __listTags;
}
/** Retrieves a list of tags. */
export function queryTags(payload) {
    var _a = serializer(_queryTagsRequest, {}), toReq = _a.toJSON, fromReq = _a.fromJSON;
    var fromRes = serializer(_queryTagsResponse, { _tag: _tag }).fromJSON;
    function __queryTags(_a) {
        var host = _a.host;
        var serializedData = toReq(payload);
        var metadata = {
            entityFqdn: 'wix.os.tags.v1.tag',
            method: 'GET',
            methodFqn: 'wix.os.v1.TagsService.QueryTags',
            migrationOptions: {
                optInTransformResponse: true,
            },
            url: resolveWixOsV1TagsServiceUrl({
                protoPath: '/v1/tags/query',
                data: serializedData,
                host: host,
            }),
            params: toURLSearchParams(serializedData, true),
            transformResponse: fromRes,
            fallback: [
                {
                    method: 'POST',
                    url: resolveWixOsV1TagsServiceUrl({
                        protoPath: '/v1/tags/query',
                        data: serializedData,
                        host: host,
                    }),
                    data: serializedData,
                },
            ],
        };
        return metadata;
    }
    __queryTags.fromReq = fromReq;
    __queryTags.__isAmbassador = true;
    return __queryTags;
}
//# sourceMappingURL=http.impl.js.map