// components/browser_apis/tab_strip/tab_strip_api_events.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 { ContainerSpec as tabsApi_mojom_ContainerSpec, SplitTabSpec as tabsApi_mojom_SplitTabSpec, TabSpec as tabsApi_mojom_TabSpec, TabCreatedContainerSpec as tabsApi_mojom_TabCreatedContainerSpec, TabGroupSpec as tabsApi_mojom_TabGroupSpec } from './tab_strip_api_data_model.mojom-webui.js';
import { NodeIdSpec as tabsApi_mojom_NodeIdSpec, PositionSpec as tabsApi_mojom_PositionSpec, TabFieldMaskSpec as tabsApi_mojom_TabFieldMaskSpec } from './tab_strip_api_types.mojom-webui.js';
export const OnTabsCreatedEventSpec = { $: {} };
export const OnNodesClosedEventSpec = { $: {} };
export const TabChangeSpec = { $: {} };
export const TabGroupChangeSpec = { $: {} };
export const SplitTabChangeSpec = { $: {} };
export const OnCollectionCreatedEventSpec = { $: {} };
export const OnNodeMovedEventSpec = { $: {} };
export const OnDataChangedEventSpec = { $: {} };
mojo.internal.Struct(OnTabsCreatedEventSpec.$, 'OnTabsCreatedEvent', [
    mojo.internal.StructField('tabs', 0, 0, mojo.internal.Array(tabsApi_mojom_TabCreatedContainerSpec.$, false), null, false /* nullable */, 0, undefined, undefined),
], [[0, 16],]);
mojo.internal.Struct(OnNodesClosedEventSpec.$, 'OnNodesClosedEvent', [
    mojo.internal.StructField('nodeIds', 0, 0, mojo.internal.Array(tabsApi_mojom_NodeIdSpec.$, false), null, false /* nullable */, 0, undefined, undefined),
], [[0, 16],]);
mojo.internal.Struct(TabChangeSpec.$, 'TabChange', [
    mojo.internal.StructField('data', 0, 0, tabsApi_mojom_TabSpec.$, null, false /* nullable */, 0, undefined, undefined),
    mojo.internal.StructField('mask', 8, 0, tabsApi_mojom_TabFieldMaskSpec.$, null, false /* nullable */, 0, undefined, undefined),
], [[0, 24],]);
mojo.internal.Struct(TabGroupChangeSpec.$, 'TabGroupChange', [
    mojo.internal.StructField('data', 0, 0, tabsApi_mojom_TabGroupSpec.$, null, false /* nullable */, 0, undefined, undefined),
], [[0, 16],]);
mojo.internal.Struct(SplitTabChangeSpec.$, 'SplitTabChange', [
    mojo.internal.StructField('data', 0, 0, tabsApi_mojom_SplitTabSpec.$, null, false /* nullable */, 0, undefined, undefined),
], [[0, 16],]);
mojo.internal.Struct(OnCollectionCreatedEventSpec.$, 'OnCollectionCreatedEvent', [
    mojo.internal.StructField('position', 0, 0, tabsApi_mojom_PositionSpec.$, null, false /* nullable */, 0, undefined, undefined),
    mojo.internal.StructField('collection', 8, 0, tabsApi_mojom_ContainerSpec.$, null, false /* nullable */, 0, undefined, undefined),
], [[0, 24],]);
mojo.internal.Struct(OnNodeMovedEventSpec.$, 'OnNodeMovedEvent', [
    mojo.internal.StructField('id', 0, 0, tabsApi_mojom_NodeIdSpec.$, null, false /* nullable */, 0, undefined, undefined),
    mojo.internal.StructField('from', 8, 0, tabsApi_mojom_PositionSpec.$, null, false /* nullable */, 0, undefined, undefined),
    mojo.internal.StructField('to', 16, 0, tabsApi_mojom_PositionSpec.$, null, false /* nullable */, 0, undefined, undefined),
], [[0, 32],]);
mojo.internal.Union(OnDataChangedEventSpec.$, 'OnDataChangedEvent', {
    'tab': {
        'ordinal': 0,
        'type': TabChangeSpec.$,
    },
    'tabGroup': {
        'ordinal': 1,
        'type': TabGroupChangeSpec.$,
    },
    'splitTab': {
        'ordinal': 2,
        'type': SplitTabChangeSpec.$,
    },
});
export var OnDataChangedEventFieldTags;
(function (OnDataChangedEventFieldTags) {
    OnDataChangedEventFieldTags[OnDataChangedEventFieldTags["TAB"] = 0] = "TAB";
    OnDataChangedEventFieldTags[OnDataChangedEventFieldTags["TAB_GROUP"] = 1] = "TAB_GROUP";
    OnDataChangedEventFieldTags[OnDataChangedEventFieldTags["SPLIT_TAB"] = 2] = "SPLIT_TAB";
})(OnDataChangedEventFieldTags || (OnDataChangedEventFieldTags = {}));
export function whichOnDataChangedEvent(u) {
    if (u.tab !== null && u.tab !== undefined) {
        return OnDataChangedEventFieldTags.TAB;
    }
    if (u.tabGroup !== null && u.tabGroup !== undefined) {
        return OnDataChangedEventFieldTags.TAB_GROUP;
    }
    if (u.splitTab !== null && u.splitTab !== undefined) {
        return OnDataChangedEventFieldTags.SPLIT_TAB;
    }
    throw new Error("no union field has been set, this is an illegal state");
}
