// components/browser_apis/bookmarks/bookmarks_api.mojom-webui.ts is auto generated by mojom_bindings_generator.py, do not edit
// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import { mojo } from '//resources/mojo/mojo/public/js/bindings.js';
import { EmptySpec as mojoBase_mojom_EmptySpec } from '//resources/mojo/mojo/public/mojom/base/empty.mojom-webui.js';
import { ErrorSpec as mojoBase_mojom_ErrorSpec } from '//resources/mojo/mojo/public/mojom/base/error.mojom-webui.js';
import { UuidSpec as mojoBase_mojom_UuidSpec } from '//resources/mojo/mojo/public/mojom/base/uuid.mojom-webui.js';
import { UrlSpec as url_mojom_UrlSpec } from '//resources/mojo/url/mojom/url.mojom-webui.js';
export const PermanentFolderTypeSpec = { $: mojo.internal.Enum() };
export var PermanentFolderType;
(function (PermanentFolderType) {
    PermanentFolderType[PermanentFolderType["MIN_VALUE"] = 0] = "MIN_VALUE";
    PermanentFolderType[PermanentFolderType["MAX_VALUE"] = 4] = "MAX_VALUE";
    PermanentFolderType[PermanentFolderType["kUnknown"] = 0] = "kUnknown";
    PermanentFolderType[PermanentFolderType["kBookmarkBar"] = 1] = "kBookmarkBar";
    PermanentFolderType[PermanentFolderType["kOther"] = 2] = "kOther";
    PermanentFolderType[PermanentFolderType["kMobile"] = 3] = "kMobile";
    PermanentFolderType[PermanentFolderType["kManaged"] = 4] = "kManaged";
})(PermanentFolderType || (PermanentFolderType = {}));
export class BookmarksObserverPendingReceiver {
    handle;
    constructor(handle) {
        this.handle = mojo.internal.interfaceSupport.getEndpointForReceiver(handle);
    }
    bindInBrowser(scope = 'context') {
        mojo.internal.interfaceSupport.bind(this.handle, 'bookmarks_api.mojom.BookmarksObserver', scope);
    }
}
export class BookmarksObserverRemote {
    proxy;
    $;
    onConnectionError;
    constructor(handle) {
        this.proxy =
            new mojo.internal.interfaceSupport.InterfaceRemoteBase(BookmarksObserverPendingReceiver, handle);
        this.$ = new mojo.internal.interfaceSupport.InterfaceRemoteBaseWrapper(this.proxy);
        this.onConnectionError = this.proxy.getConnectionErrorEventRouter();
    }
    onBookmarksEvents(events) {
        this.proxy.sendMessage(1087816961, BookmarksObserver_OnBookmarksEvents_ParamsSpec.$, null, [
            events
        ], false);
    }
}
;
/**
 * An object which receives request messages for the BookmarksObserver
 * mojom interface. Must be constructed over an object which implements that
 * interface.
 */
export class BookmarksObserverReceiver {
    helper_internal_;
    $;
    onConnectionError;
    constructor(impl) {
        this.helper_internal_ = new mojo.internal.interfaceSupport.InterfaceReceiverHelperInternal(BookmarksObserverRemote);
        this.$ = new mojo.internal.interfaceSupport.InterfaceReceiverHelper(this.helper_internal_);
        this.helper_internal_.registerHandler(1087816961, BookmarksObserver_OnBookmarksEvents_ParamsSpec.$, null, impl.onBookmarksEvents.bind(impl), false);
        this.onConnectionError = this.helper_internal_.getConnectionErrorEventRouter();
    }
}
export class BookmarksObserver {
    static get $interfaceName() {
        return "bookmarks_api.mojom.BookmarksObserver";
    }
    /**
     * Returns a remote for this interface which sends messages to the browser.
     * The browser must have an interface request binder registered for this
     * interface and accessible to the calling document's frame.
     */
    static getRemote() {
        let remote = new BookmarksObserverRemote;
        remote.$.bindNewPipeAndPassReceiver().bindInBrowser();
        return remote;
    }
}
/**
 * An object which receives request messages for the BookmarksObserver
 * mojom interface and dispatches them as callbacks. One callback receiver exists
 * on this object for each message defined in the mojom interface, and each
 * receiver can have any number of listeners added to it.
 */
export class BookmarksObserverCallbackRouter {
    helper_internal_;
    $;
    router_;
    onBookmarksEvents;
    onConnectionError;
    constructor() {
        this.helper_internal_ = new mojo.internal.interfaceSupport.InterfaceReceiverHelperInternal(BookmarksObserverRemote);
        this.$ = new mojo.internal.interfaceSupport.InterfaceReceiverHelper(this.helper_internal_);
        this.router_ = new mojo.internal.interfaceSupport.CallbackRouter;
        this.onBookmarksEvents =
            new mojo.internal.interfaceSupport.InterfaceCallbackReceiver(this.router_);
        this.helper_internal_.registerHandler(1087816961, BookmarksObserver_OnBookmarksEvents_ParamsSpec.$, null, this.onBookmarksEvents.createReceiverHandler(false /* expectsResponse */), false);
        this.onConnectionError = this.helper_internal_.getConnectionErrorEventRouter();
    }
    /**
     * @param id An ID returned by a prior call to addListener.
     * @return True iff the identified listener was found and removed.
     */
    removeListener(id) {
        return this.router_.removeListener(id);
    }
}
export class BookmarksServicePendingReceiver {
    handle;
    constructor(handle) {
        this.handle = mojo.internal.interfaceSupport.getEndpointForReceiver(handle);
    }
    bindInBrowser(scope = 'context') {
        mojo.internal.interfaceSupport.bind(this.handle, 'bookmarks_api.mojom.BookmarksService', scope);
    }
}
export class BookmarksServiceRemote {
    proxy;
    $;
    onConnectionError;
    constructor(handle) {
        this.proxy =
            new mojo.internal.interfaceSupport.InterfaceRemoteBase(BookmarksServicePendingReceiver, handle);
        this.$ = new mojo.internal.interfaceSupport.InterfaceRemoteBaseWrapper(this.proxy);
        this.onConnectionError = this.proxy.getConnectionErrorEventRouter();
    }
    getBookmarks() {
        return this.proxy.sendMessage(766811475, BookmarksService_GetBookmarks_ParamsSpec.$, BookmarksService_GetBookmarks_ResponseParamsSpec.$, [], true);
    }
    getBookmark(id) {
        return this.proxy.sendMessage(643280134, BookmarksService_GetBookmark_ParamsSpec.$, BookmarksService_GetBookmark_ResponseParamsSpec.$, [
            id
        ], true);
    }
    createBookmarkNode(parentId, index, node) {
        return this.proxy.sendMessage(1893748173, BookmarksService_CreateBookmarkNode_ParamsSpec.$, BookmarksService_CreateBookmarkNode_ResponseParamsSpec.$, [
            parentId,
            index,
            node
        ], true);
    }
    updateBookmarkNode(node) {
        return this.proxy.sendMessage(862082479, BookmarksService_UpdateBookmarkNode_ParamsSpec.$, BookmarksService_UpdateBookmarkNode_ResponseParamsSpec.$, [
            node
        ], true);
    }
    moveBookmarkNode(id, newParentId, index) {
        return this.proxy.sendMessage(1947567732, BookmarksService_MoveBookmarkNode_ParamsSpec.$, BookmarksService_MoveBookmarkNode_ResponseParamsSpec.$, [
            id,
            newParentId,
            index
        ], true);
    }
    deleteBookmarkNodes(ids) {
        return this.proxy.sendMessage(626758655, BookmarksService_DeleteBookmarkNodes_ParamsSpec.$, BookmarksService_DeleteBookmarkNodes_ResponseParamsSpec.$, [
            ids
        ], true);
    }
}
;
/**
 * An object which receives request messages for the BookmarksService
 * mojom interface. Must be constructed over an object which implements that
 * interface.
 */
export class BookmarksServiceReceiver {
    helper_internal_;
    $;
    onConnectionError;
    constructor(impl) {
        this.helper_internal_ = new mojo.internal.interfaceSupport.InterfaceReceiverHelperInternal(BookmarksServiceRemote);
        this.$ = new mojo.internal.interfaceSupport.InterfaceReceiverHelper(this.helper_internal_);
        this.helper_internal_.registerHandler(766811475, BookmarksService_GetBookmarks_ParamsSpec.$, BookmarksService_GetBookmarks_ResponseParamsSpec.$, impl.getBookmarks.bind(impl), true);
        this.helper_internal_.registerHandler(643280134, BookmarksService_GetBookmark_ParamsSpec.$, BookmarksService_GetBookmark_ResponseParamsSpec.$, impl.getBookmark.bind(impl), true);
        this.helper_internal_.registerHandler(1893748173, BookmarksService_CreateBookmarkNode_ParamsSpec.$, BookmarksService_CreateBookmarkNode_ResponseParamsSpec.$, impl.createBookmarkNode.bind(impl), true);
        this.helper_internal_.registerHandler(862082479, BookmarksService_UpdateBookmarkNode_ParamsSpec.$, BookmarksService_UpdateBookmarkNode_ResponseParamsSpec.$, impl.updateBookmarkNode.bind(impl), true);
        this.helper_internal_.registerHandler(1947567732, BookmarksService_MoveBookmarkNode_ParamsSpec.$, BookmarksService_MoveBookmarkNode_ResponseParamsSpec.$, impl.moveBookmarkNode.bind(impl), true);
        this.helper_internal_.registerHandler(626758655, BookmarksService_DeleteBookmarkNodes_ParamsSpec.$, BookmarksService_DeleteBookmarkNodes_ResponseParamsSpec.$, impl.deleteBookmarkNodes.bind(impl), true);
        this.onConnectionError = this.helper_internal_.getConnectionErrorEventRouter();
    }
}
export class BookmarksService {
    static get $interfaceName() {
        return "bookmarks_api.mojom.BookmarksService";
    }
    /**
     * Returns a remote for this interface which sends messages to the browser.
     * The browser must have an interface request binder registered for this
     * interface and accessible to the calling document's frame.
     */
    static getRemote() {
        let remote = new BookmarksServiceRemote;
        remote.$.bindNewPipeAndPassReceiver().bindInBrowser();
        return remote;
    }
}
/**
 * An object which receives request messages for the BookmarksService
 * mojom interface and dispatches them as callbacks. One callback receiver exists
 * on this object for each message defined in the mojom interface, and each
 * receiver can have any number of listeners added to it.
 */
export class BookmarksServiceCallbackRouter {
    helper_internal_;
    $;
    router_;
    getBookmarks;
    getBookmark;
    createBookmarkNode;
    updateBookmarkNode;
    moveBookmarkNode;
    deleteBookmarkNodes;
    onConnectionError;
    constructor() {
        this.helper_internal_ = new mojo.internal.interfaceSupport.InterfaceReceiverHelperInternal(BookmarksServiceRemote);
        this.$ = new mojo.internal.interfaceSupport.InterfaceReceiverHelper(this.helper_internal_);
        this.router_ = new mojo.internal.interfaceSupport.CallbackRouter;
        this.getBookmarks =
            new mojo.internal.interfaceSupport.InterfaceCallbackReceiver(this.router_);
        this.helper_internal_.registerHandler(766811475, BookmarksService_GetBookmarks_ParamsSpec.$, BookmarksService_GetBookmarks_ResponseParamsSpec.$, this.getBookmarks.createReceiverHandler(true /* expectsResponse */), true);
        this.getBookmark =
            new mojo.internal.interfaceSupport.InterfaceCallbackReceiver(this.router_);
        this.helper_internal_.registerHandler(643280134, BookmarksService_GetBookmark_ParamsSpec.$, BookmarksService_GetBookmark_ResponseParamsSpec.$, this.getBookmark.createReceiverHandler(true /* expectsResponse */), true);
        this.createBookmarkNode =
            new mojo.internal.interfaceSupport.InterfaceCallbackReceiver(this.router_);
        this.helper_internal_.registerHandler(1893748173, BookmarksService_CreateBookmarkNode_ParamsSpec.$, BookmarksService_CreateBookmarkNode_ResponseParamsSpec.$, this.createBookmarkNode.createReceiverHandler(true /* expectsResponse */), true);
        this.updateBookmarkNode =
            new mojo.internal.interfaceSupport.InterfaceCallbackReceiver(this.router_);
        this.helper_internal_.registerHandler(862082479, BookmarksService_UpdateBookmarkNode_ParamsSpec.$, BookmarksService_UpdateBookmarkNode_ResponseParamsSpec.$, this.updateBookmarkNode.createReceiverHandler(true /* expectsResponse */), true);
        this.moveBookmarkNode =
            new mojo.internal.interfaceSupport.InterfaceCallbackReceiver(this.router_);
        this.helper_internal_.registerHandler(1947567732, BookmarksService_MoveBookmarkNode_ParamsSpec.$, BookmarksService_MoveBookmarkNode_ResponseParamsSpec.$, this.moveBookmarkNode.createReceiverHandler(true /* expectsResponse */), true);
        this.deleteBookmarkNodes =
            new mojo.internal.interfaceSupport.InterfaceCallbackReceiver(this.router_);
        this.helper_internal_.registerHandler(626758655, BookmarksService_DeleteBookmarkNodes_ParamsSpec.$, BookmarksService_DeleteBookmarkNodes_ResponseParamsSpec.$, this.deleteBookmarkNodes.createReceiverHandler(true /* expectsResponse */), true);
        this.onConnectionError = this.helper_internal_.getConnectionErrorEventRouter();
    }
    /**
     * @param id An ID returned by a prior call to addListener.
     * @return True iff the identified listener was found and removed.
     */
    removeListener(id) {
        return this.router_.removeListener(id);
    }
}
export const RootNodeSpec = { $: {} };
export const UrlSpec = { $: {} };
export const FolderSpec = { $: {} };
export const BookmarksSnapshotSpec = { $: {} };
export const BookmarkNodeCreatedSpec = { $: {} };
export const BookmarkNodeRemovedSpec = { $: {} };
export const BookmarkNodeMovedSpec = { $: {} };
export const BookmarkNodeChangedSpec = { $: {} };
export const BookmarksObserver_OnBookmarksEvents_ParamsSpec = { $: {} };
export const BookmarksService_GetBookmarks_ParamsSpec = { $: {} };
export const BookmarksService_GetBookmarks_ResponseParamsSpec = { $: {} };
export const BookmarksService_GetBookmark_ParamsSpec = { $: {} };
export const BookmarksService_GetBookmark_ResponseParamsSpec = { $: {} };
export const BookmarksService_CreateBookmarkNode_ParamsSpec = { $: {} };
export const BookmarksService_CreateBookmarkNode_ResponseParamsSpec = { $: {} };
export const BookmarksService_UpdateBookmarkNode_ParamsSpec = { $: {} };
export const BookmarksService_UpdateBookmarkNode_ResponseParamsSpec = { $: {} };
export const BookmarksService_MoveBookmarkNode_ParamsSpec = { $: {} };
export const BookmarksService_MoveBookmarkNode_ResponseParamsSpec = { $: {} };
export const BookmarksService_DeleteBookmarkNodes_ParamsSpec = { $: {} };
export const BookmarksService_DeleteBookmarkNodes_ResponseParamsSpec = { $: {} };
export const BookmarkNodeSpec = { $: {} };
export const BookmarksEventSpec = { $: {} };
export const BookmarksService_GetBookmarks_ResponseParam_ResultSpec = { $: {} };
export const BookmarksService_GetBookmark_ResponseParam_ResultSpec = { $: {} };
export const BookmarksService_CreateBookmarkNode_ResponseParam_ResultSpec = { $: {} };
export const BookmarksService_UpdateBookmarkNode_ResponseParam_ResultSpec = { $: {} };
export const BookmarksService_MoveBookmarkNode_ResponseParam_ResultSpec = { $: {} };
export const BookmarksService_DeleteBookmarkNodes_ResponseParam_ResultSpec = { $: {} };
mojo.internal.Struct(RootNodeSpec.$, 'RootNode', [
    mojo.internal.StructField('id', 0, 0, mojoBase_mojom_UuidSpec.$, null, false /* nullable */, 0, undefined, undefined),
    mojo.internal.StructField('children', 8, 0, mojo.internal.Array(FolderSpec.$, false), null, false /* nullable */, 0, undefined, undefined),
], [[0, 24],]);
mojo.internal.Struct(UrlSpec.$, 'Url', [
    mojo.internal.StructField('id', 0, 0, mojoBase_mojom_UuidSpec.$, null, true /* nullable */, 0, undefined, undefined),
    mojo.internal.StructField('title', 8, 0, mojo.internal.String, null, false /* nullable */, 0, undefined, undefined),
    mojo.internal.StructField('url', 16, 0, url_mojom_UrlSpec.$, null, false /* nullable */, 0, undefined, undefined),
    mojo.internal.StructField('faviconUrl', 24, 0, url_mojom_UrlSpec.$, null, true /* nullable */, 0, undefined, undefined),
    mojo.internal.StructField('isSynced', 32, 0, mojo.internal.Bool, false, false /* nullable */, 0, undefined, undefined),
], [[0, 48],]);
mojo.internal.Struct(FolderSpec.$, 'Folder', [
    mojo.internal.StructField('id', 0, 0, mojoBase_mojom_UuidSpec.$, null, true /* nullable */, 0, undefined, undefined),
    mojo.internal.StructField('title', 8, 0, mojo.internal.String, null, false /* nullable */, 0, undefined, undefined),
    mojo.internal.StructField('children', 16, 0, mojo.internal.Array(BookmarkNodeSpec.$, false), null, false /* nullable */, 0, undefined, undefined),
    mojo.internal.StructField('permanent_folder_type_$flag', 24, 0, mojo.internal.Bool, false, false /* nullable */, 0, {
        isPrimary: true,
        linkedValueFieldName: "permanent_folder_type_$value",
        originalFieldName: "permanentFolderType",
    }, undefined),
    mojo.internal.StructField('permanent_folder_type_$value', 28, 0, PermanentFolderTypeSpec.$, 0, false /* nullable */, 0, {
        isPrimary: false,
        originalFieldName: "permanentFolderType",
    }, undefined),
    mojo.internal.StructField('isSynced', 24, 1, mojo.internal.Bool, false, false /* nullable */, 0, undefined, undefined),
], [[0, 40],]);
mojo.internal.Struct(BookmarksSnapshotSpec.$, 'BookmarksSnapshot', [
    mojo.internal.StructField('root', 0, 0, RootNodeSpec.$, null, false /* nullable */, 0, undefined, undefined),
    mojo.internal.StructField('stream', 8, 0, mojo.internal.AssociatedInterfaceRequest(BookmarksObserverPendingReceiver), null, false /* nullable */, 0, undefined, undefined),
], [[0, 24],]);
mojo.internal.Struct(BookmarkNodeCreatedSpec.$, 'BookmarkNodeCreated', [
    mojo.internal.StructField('parentId', 0, 0, mojoBase_mojom_UuidSpec.$, null, false /* nullable */, 0, undefined, undefined),
    mojo.internal.StructField('index', 8, 0, mojo.internal.Int32, 0, false /* nullable */, 0, undefined, undefined),
    mojo.internal.StructField('node', 16, 0, BookmarkNodeSpec.$, null, false /* nullable */, 0, undefined, undefined),
], [[0, 40],]);
mojo.internal.Struct(BookmarkNodeRemovedSpec.$, 'BookmarkNodeRemoved', [
    mojo.internal.StructField('id', 0, 0, mojoBase_mojom_UuidSpec.$, null, false /* nullable */, 0, undefined, undefined),
], [[0, 16],]);
mojo.internal.Struct(BookmarkNodeMovedSpec.$, 'BookmarkNodeMoved', [
    mojo.internal.StructField('oldParentId', 0, 0, mojoBase_mojom_UuidSpec.$, null, false /* nullable */, 0, undefined, undefined),
    mojo.internal.StructField('oldIndex', 8, 0, mojo.internal.Int32, 0, false /* nullable */, 0, undefined, undefined),
    mojo.internal.StructField('newParentId', 16, 0, mojoBase_mojom_UuidSpec.$, null, false /* nullable */, 0, undefined, undefined),
    mojo.internal.StructField('newIndex', 12, 0, mojo.internal.Int32, 0, false /* nullable */, 0, undefined, undefined),
], [[0, 32],]);
mojo.internal.Struct(BookmarkNodeChangedSpec.$, 'BookmarkNodeChanged', [
    mojo.internal.StructField('node', 0, 0, BookmarkNodeSpec.$, null, false /* nullable */, 0, undefined, undefined),
], [[0, 24],]);
mojo.internal.Struct(BookmarksObserver_OnBookmarksEvents_ParamsSpec.$, 'BookmarksObserver_OnBookmarksEvents_Params', [
    mojo.internal.StructField('events', 0, 0, mojo.internal.Array(BookmarksEventSpec.$, false), null, false /* nullable */, 0, undefined, undefined),
], [[0, 16],]);
mojo.internal.Struct(BookmarksService_GetBookmarks_ParamsSpec.$, 'BookmarksService_GetBookmarks_Params', [], [[0, 8],]);
mojo.internal.Struct(BookmarksService_GetBookmarks_ResponseParamsSpec.$, 'BookmarksService_GetBookmarks_ResponseParams', [
    mojo.internal.StructField('result', 0, 0, BookmarksService_GetBookmarks_ResponseParam_ResultSpec.$, null, false /* nullable */, 0, undefined, undefined),
], [[0, 24],]);
mojo.internal.Struct(BookmarksService_GetBookmark_ParamsSpec.$, 'BookmarksService_GetBookmark_Params', [
    mojo.internal.StructField('id', 0, 0, mojoBase_mojom_UuidSpec.$, null, false /* nullable */, 0, undefined, undefined),
], [[0, 16],]);
mojo.internal.Struct(BookmarksService_GetBookmark_ResponseParamsSpec.$, 'BookmarksService_GetBookmark_ResponseParams', [
    mojo.internal.StructField('result', 0, 0, BookmarksService_GetBookmark_ResponseParam_ResultSpec.$, null, false /* nullable */, 0, undefined, undefined),
], [[0, 24],]);
mojo.internal.Struct(BookmarksService_CreateBookmarkNode_ParamsSpec.$, 'BookmarksService_CreateBookmarkNode_Params', [
    mojo.internal.StructField('parentId', 0, 0, mojoBase_mojom_UuidSpec.$, null, false /* nullable */, 0, undefined, undefined),
    mojo.internal.StructField('index_$flag', 8, 0, mojo.internal.Bool, false, false /* nullable */, 0, {
        isPrimary: true,
        linkedValueFieldName: "index_$value",
        originalFieldName: "index",
    }, undefined),
    mojo.internal.StructField('index_$value', 12, 0, mojo.internal.Int32, 0, false /* nullable */, 0, {
        isPrimary: false,
        originalFieldName: "index",
    }, undefined),
    mojo.internal.StructField('node', 16, 0, BookmarkNodeSpec.$, null, false /* nullable */, 0, undefined, undefined),
], [[0, 40],]);
mojo.internal.Struct(BookmarksService_CreateBookmarkNode_ResponseParamsSpec.$, 'BookmarksService_CreateBookmarkNode_ResponseParams', [
    mojo.internal.StructField('result', 0, 0, BookmarksService_CreateBookmarkNode_ResponseParam_ResultSpec.$, null, false /* nullable */, 0, undefined, undefined),
], [[0, 24],]);
mojo.internal.Struct(BookmarksService_UpdateBookmarkNode_ParamsSpec.$, 'BookmarksService_UpdateBookmarkNode_Params', [
    mojo.internal.StructField('node', 0, 0, BookmarkNodeSpec.$, null, false /* nullable */, 0, undefined, undefined),
], [[0, 24],]);
mojo.internal.Struct(BookmarksService_UpdateBookmarkNode_ResponseParamsSpec.$, 'BookmarksService_UpdateBookmarkNode_ResponseParams', [
    mojo.internal.StructField('result', 0, 0, BookmarksService_UpdateBookmarkNode_ResponseParam_ResultSpec.$, null, false /* nullable */, 0, undefined, undefined),
], [[0, 24],]);
mojo.internal.Struct(BookmarksService_MoveBookmarkNode_ParamsSpec.$, 'BookmarksService_MoveBookmarkNode_Params', [
    mojo.internal.StructField('id', 0, 0, mojoBase_mojom_UuidSpec.$, null, false /* nullable */, 0, undefined, undefined),
    mojo.internal.StructField('newParentId', 8, 0, mojoBase_mojom_UuidSpec.$, null, false /* nullable */, 0, undefined, undefined),
    mojo.internal.StructField('index_$flag', 16, 0, mojo.internal.Bool, false, false /* nullable */, 0, {
        isPrimary: true,
        linkedValueFieldName: "index_$value",
        originalFieldName: "index",
    }, undefined),
    mojo.internal.StructField('index_$value', 20, 0, mojo.internal.Int32, 0, false /* nullable */, 0, {
        isPrimary: false,
        originalFieldName: "index",
    }, undefined),
], [[0, 32],]);
mojo.internal.Struct(BookmarksService_MoveBookmarkNode_ResponseParamsSpec.$, 'BookmarksService_MoveBookmarkNode_ResponseParams', [
    mojo.internal.StructField('result', 0, 0, BookmarksService_MoveBookmarkNode_ResponseParam_ResultSpec.$, null, false /* nullable */, 0, undefined, undefined),
], [[0, 24],]);
mojo.internal.Struct(BookmarksService_DeleteBookmarkNodes_ParamsSpec.$, 'BookmarksService_DeleteBookmarkNodes_Params', [
    mojo.internal.StructField('ids', 0, 0, mojo.internal.Array(mojoBase_mojom_UuidSpec.$, false), null, false /* nullable */, 0, undefined, undefined),
], [[0, 16],]);
mojo.internal.Struct(BookmarksService_DeleteBookmarkNodes_ResponseParamsSpec.$, 'BookmarksService_DeleteBookmarkNodes_ResponseParams', [
    mojo.internal.StructField('result', 0, 0, BookmarksService_DeleteBookmarkNodes_ResponseParam_ResultSpec.$, null, false /* nullable */, 0, undefined, undefined),
], [[0, 24],]);
mojo.internal.Union(BookmarkNodeSpec.$, 'BookmarkNode', {
    'url': {
        'ordinal': 0,
        'type': UrlSpec.$,
    },
    'folder': {
        'ordinal': 1,
        'type': FolderSpec.$,
    },
});
export var BookmarkNodeFieldTags;
(function (BookmarkNodeFieldTags) {
    BookmarkNodeFieldTags[BookmarkNodeFieldTags["URL"] = 0] = "URL";
    BookmarkNodeFieldTags[BookmarkNodeFieldTags["FOLDER"] = 1] = "FOLDER";
})(BookmarkNodeFieldTags || (BookmarkNodeFieldTags = {}));
export function whichBookmarkNode(u) {
    if (u.url !== null && u.url !== undefined) {
        return BookmarkNodeFieldTags.URL;
    }
    if (u.folder !== null && u.folder !== undefined) {
        return BookmarkNodeFieldTags.FOLDER;
    }
    throw new Error("no union field has been set, this is an illegal state");
}
mojo.internal.Union(BookmarksEventSpec.$, 'BookmarksEvent', {
    'added': {
        'ordinal': 0,
        'type': BookmarkNodeCreatedSpec.$,
    },
    'removed': {
        'ordinal': 1,
        'type': BookmarkNodeRemovedSpec.$,
    },
    'moved': {
        'ordinal': 2,
        'type': BookmarkNodeMovedSpec.$,
    },
    'changed': {
        'ordinal': 3,
        'type': BookmarkNodeChangedSpec.$,
    },
});
export var BookmarksEventFieldTags;
(function (BookmarksEventFieldTags) {
    BookmarksEventFieldTags[BookmarksEventFieldTags["ADDED"] = 0] = "ADDED";
    BookmarksEventFieldTags[BookmarksEventFieldTags["REMOVED"] = 1] = "REMOVED";
    BookmarksEventFieldTags[BookmarksEventFieldTags["MOVED"] = 2] = "MOVED";
    BookmarksEventFieldTags[BookmarksEventFieldTags["CHANGED"] = 3] = "CHANGED";
})(BookmarksEventFieldTags || (BookmarksEventFieldTags = {}));
export function whichBookmarksEvent(u) {
    if (u.added !== null && u.added !== undefined) {
        return BookmarksEventFieldTags.ADDED;
    }
    if (u.removed !== null && u.removed !== undefined) {
        return BookmarksEventFieldTags.REMOVED;
    }
    if (u.moved !== null && u.moved !== undefined) {
        return BookmarksEventFieldTags.MOVED;
    }
    if (u.changed !== null && u.changed !== undefined) {
        return BookmarksEventFieldTags.CHANGED;
    }
    throw new Error("no union field has been set, this is an illegal state");
}
mojo.internal.Union(BookmarksService_GetBookmarks_ResponseParam_ResultSpec.$, 'BookmarksService_GetBookmarks_ResponseParam_Result', {
    'success': {
        'ordinal': 0,
        'type': BookmarksSnapshotSpec.$,
    },
    'failure': {
        'ordinal': 1,
        'type': mojoBase_mojom_ErrorSpec.$,
    },
});
export var BookmarksService_GetBookmarks_ResponseParam_ResultFieldTags;
(function (BookmarksService_GetBookmarks_ResponseParam_ResultFieldTags) {
    BookmarksService_GetBookmarks_ResponseParam_ResultFieldTags[BookmarksService_GetBookmarks_ResponseParam_ResultFieldTags["SUCCESS"] = 0] = "SUCCESS";
    BookmarksService_GetBookmarks_ResponseParam_ResultFieldTags[BookmarksService_GetBookmarks_ResponseParam_ResultFieldTags["FAILURE"] = 1] = "FAILURE";
})(BookmarksService_GetBookmarks_ResponseParam_ResultFieldTags || (BookmarksService_GetBookmarks_ResponseParam_ResultFieldTags = {}));
export function whichBookmarksService_GetBookmarks_ResponseParam_Result(u) {
    if (u.success !== null && u.success !== undefined) {
        return BookmarksService_GetBookmarks_ResponseParam_ResultFieldTags.SUCCESS;
    }
    if (u.failure !== null && u.failure !== undefined) {
        return BookmarksService_GetBookmarks_ResponseParam_ResultFieldTags.FAILURE;
    }
    throw new Error("no union field has been set, this is an illegal state");
}
mojo.internal.Union(BookmarksService_GetBookmark_ResponseParam_ResultSpec.$, 'BookmarksService_GetBookmark_ResponseParam_Result', {
    'success': {
        'ordinal': 0,
        'type': BookmarkNodeSpec.$,
    },
    'failure': {
        'ordinal': 1,
        'type': mojoBase_mojom_ErrorSpec.$,
    },
});
export var BookmarksService_GetBookmark_ResponseParam_ResultFieldTags;
(function (BookmarksService_GetBookmark_ResponseParam_ResultFieldTags) {
    BookmarksService_GetBookmark_ResponseParam_ResultFieldTags[BookmarksService_GetBookmark_ResponseParam_ResultFieldTags["SUCCESS"] = 0] = "SUCCESS";
    BookmarksService_GetBookmark_ResponseParam_ResultFieldTags[BookmarksService_GetBookmark_ResponseParam_ResultFieldTags["FAILURE"] = 1] = "FAILURE";
})(BookmarksService_GetBookmark_ResponseParam_ResultFieldTags || (BookmarksService_GetBookmark_ResponseParam_ResultFieldTags = {}));
export function whichBookmarksService_GetBookmark_ResponseParam_Result(u) {
    if (u.success !== null && u.success !== undefined) {
        return BookmarksService_GetBookmark_ResponseParam_ResultFieldTags.SUCCESS;
    }
    if (u.failure !== null && u.failure !== undefined) {
        return BookmarksService_GetBookmark_ResponseParam_ResultFieldTags.FAILURE;
    }
    throw new Error("no union field has been set, this is an illegal state");
}
mojo.internal.Union(BookmarksService_CreateBookmarkNode_ResponseParam_ResultSpec.$, 'BookmarksService_CreateBookmarkNode_ResponseParam_Result', {
    'success': {
        'ordinal': 0,
        'type': BookmarkNodeSpec.$,
    },
    'failure': {
        'ordinal': 1,
        'type': mojoBase_mojom_ErrorSpec.$,
    },
});
export var BookmarksService_CreateBookmarkNode_ResponseParam_ResultFieldTags;
(function (BookmarksService_CreateBookmarkNode_ResponseParam_ResultFieldTags) {
    BookmarksService_CreateBookmarkNode_ResponseParam_ResultFieldTags[BookmarksService_CreateBookmarkNode_ResponseParam_ResultFieldTags["SUCCESS"] = 0] = "SUCCESS";
    BookmarksService_CreateBookmarkNode_ResponseParam_ResultFieldTags[BookmarksService_CreateBookmarkNode_ResponseParam_ResultFieldTags["FAILURE"] = 1] = "FAILURE";
})(BookmarksService_CreateBookmarkNode_ResponseParam_ResultFieldTags || (BookmarksService_CreateBookmarkNode_ResponseParam_ResultFieldTags = {}));
export function whichBookmarksService_CreateBookmarkNode_ResponseParam_Result(u) {
    if (u.success !== null && u.success !== undefined) {
        return BookmarksService_CreateBookmarkNode_ResponseParam_ResultFieldTags.SUCCESS;
    }
    if (u.failure !== null && u.failure !== undefined) {
        return BookmarksService_CreateBookmarkNode_ResponseParam_ResultFieldTags.FAILURE;
    }
    throw new Error("no union field has been set, this is an illegal state");
}
mojo.internal.Union(BookmarksService_UpdateBookmarkNode_ResponseParam_ResultSpec.$, 'BookmarksService_UpdateBookmarkNode_ResponseParam_Result', {
    'success': {
        'ordinal': 0,
        'type': BookmarkNodeSpec.$,
    },
    'failure': {
        'ordinal': 1,
        'type': mojoBase_mojom_ErrorSpec.$,
    },
});
export var BookmarksService_UpdateBookmarkNode_ResponseParam_ResultFieldTags;
(function (BookmarksService_UpdateBookmarkNode_ResponseParam_ResultFieldTags) {
    BookmarksService_UpdateBookmarkNode_ResponseParam_ResultFieldTags[BookmarksService_UpdateBookmarkNode_ResponseParam_ResultFieldTags["SUCCESS"] = 0] = "SUCCESS";
    BookmarksService_UpdateBookmarkNode_ResponseParam_ResultFieldTags[BookmarksService_UpdateBookmarkNode_ResponseParam_ResultFieldTags["FAILURE"] = 1] = "FAILURE";
})(BookmarksService_UpdateBookmarkNode_ResponseParam_ResultFieldTags || (BookmarksService_UpdateBookmarkNode_ResponseParam_ResultFieldTags = {}));
export function whichBookmarksService_UpdateBookmarkNode_ResponseParam_Result(u) {
    if (u.success !== null && u.success !== undefined) {
        return BookmarksService_UpdateBookmarkNode_ResponseParam_ResultFieldTags.SUCCESS;
    }
    if (u.failure !== null && u.failure !== undefined) {
        return BookmarksService_UpdateBookmarkNode_ResponseParam_ResultFieldTags.FAILURE;
    }
    throw new Error("no union field has been set, this is an illegal state");
}
mojo.internal.Union(BookmarksService_MoveBookmarkNode_ResponseParam_ResultSpec.$, 'BookmarksService_MoveBookmarkNode_ResponseParam_Result', {
    'success': {
        'ordinal': 0,
        'type': mojoBase_mojom_EmptySpec.$,
    },
    'failure': {
        'ordinal': 1,
        'type': mojoBase_mojom_ErrorSpec.$,
    },
});
export var BookmarksService_MoveBookmarkNode_ResponseParam_ResultFieldTags;
(function (BookmarksService_MoveBookmarkNode_ResponseParam_ResultFieldTags) {
    BookmarksService_MoveBookmarkNode_ResponseParam_ResultFieldTags[BookmarksService_MoveBookmarkNode_ResponseParam_ResultFieldTags["SUCCESS"] = 0] = "SUCCESS";
    BookmarksService_MoveBookmarkNode_ResponseParam_ResultFieldTags[BookmarksService_MoveBookmarkNode_ResponseParam_ResultFieldTags["FAILURE"] = 1] = "FAILURE";
})(BookmarksService_MoveBookmarkNode_ResponseParam_ResultFieldTags || (BookmarksService_MoveBookmarkNode_ResponseParam_ResultFieldTags = {}));
export function whichBookmarksService_MoveBookmarkNode_ResponseParam_Result(u) {
    if (u.success !== null && u.success !== undefined) {
        return BookmarksService_MoveBookmarkNode_ResponseParam_ResultFieldTags.SUCCESS;
    }
    if (u.failure !== null && u.failure !== undefined) {
        return BookmarksService_MoveBookmarkNode_ResponseParam_ResultFieldTags.FAILURE;
    }
    throw new Error("no union field has been set, this is an illegal state");
}
mojo.internal.Union(BookmarksService_DeleteBookmarkNodes_ResponseParam_ResultSpec.$, 'BookmarksService_DeleteBookmarkNodes_ResponseParam_Result', {
    'success': {
        'ordinal': 0,
        'type': mojoBase_mojom_EmptySpec.$,
    },
    'failure': {
        'ordinal': 1,
        'type': mojoBase_mojom_ErrorSpec.$,
    },
});
export var BookmarksService_DeleteBookmarkNodes_ResponseParam_ResultFieldTags;
(function (BookmarksService_DeleteBookmarkNodes_ResponseParam_ResultFieldTags) {
    BookmarksService_DeleteBookmarkNodes_ResponseParam_ResultFieldTags[BookmarksService_DeleteBookmarkNodes_ResponseParam_ResultFieldTags["SUCCESS"] = 0] = "SUCCESS";
    BookmarksService_DeleteBookmarkNodes_ResponseParam_ResultFieldTags[BookmarksService_DeleteBookmarkNodes_ResponseParam_ResultFieldTags["FAILURE"] = 1] = "FAILURE";
})(BookmarksService_DeleteBookmarkNodes_ResponseParam_ResultFieldTags || (BookmarksService_DeleteBookmarkNodes_ResponseParam_ResultFieldTags = {}));
export function whichBookmarksService_DeleteBookmarkNodes_ResponseParam_Result(u) {
    if (u.success !== null && u.success !== undefined) {
        return BookmarksService_DeleteBookmarkNodes_ResponseParam_ResultFieldTags.SUCCESS;
    }
    if (u.failure !== null && u.failure !== undefined) {
        return BookmarksService_DeleteBookmarkNodes_ResponseParam_ResultFieldTags.FAILURE;
    }
    throw new Error("no union field has been set, this is an illegal state");
}
