// mojo/public/mojom/base/values.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';
export const DictionaryValueSpec = { $: {} };
export const ListValueSpec = { $: {} };
export const ValueSpec = { $: {} };
mojo.internal.Struct(DictionaryValueSpec.$, 'DictionaryValue', [
    mojo.internal.StructField('storage', 0, 0, mojo.internal.Map(mojo.internal.String, ValueSpec.$, false), null, false /* nullable */, 0, undefined, undefined),
], [[0, 16],]);
mojo.internal.Struct(ListValueSpec.$, 'ListValue', [
    mojo.internal.StructField('storage', 0, 0, mojo.internal.Array(ValueSpec.$, false), null, false /* nullable */, 0, undefined, undefined),
], [[0, 16],]);
mojo.internal.Union(ValueSpec.$, 'Value', {
    'nullValue': {
        'ordinal': 0,
        'type': mojo.internal.Uint8,
    },
    'boolValue': {
        'ordinal': 1,
        'type': mojo.internal.Bool,
    },
    'intValue': {
        'ordinal': 2,
        'type': mojo.internal.Int32,
    },
    'doubleValue': {
        'ordinal': 3,
        'type': mojo.internal.Double,
    },
    'stringValue': {
        'ordinal': 4,
        'type': mojo.internal.String,
    },
    'binaryValue': {
        'ordinal': 5,
        'type': mojo.internal.Array(mojo.internal.Uint8, false),
    },
    'dictionaryValue': {
        'ordinal': 6,
        'type': DictionaryValueSpec.$,
    },
    'listValue': {
        'ordinal': 7,
        'type': ListValueSpec.$,
    },
});
export var ValueFieldTags;
(function (ValueFieldTags) {
    ValueFieldTags[ValueFieldTags["NULL_VALUE"] = 0] = "NULL_VALUE";
    ValueFieldTags[ValueFieldTags["BOOL_VALUE"] = 1] = "BOOL_VALUE";
    ValueFieldTags[ValueFieldTags["INT_VALUE"] = 2] = "INT_VALUE";
    ValueFieldTags[ValueFieldTags["DOUBLE_VALUE"] = 3] = "DOUBLE_VALUE";
    ValueFieldTags[ValueFieldTags["STRING_VALUE"] = 4] = "STRING_VALUE";
    ValueFieldTags[ValueFieldTags["BINARY_VALUE"] = 5] = "BINARY_VALUE";
    ValueFieldTags[ValueFieldTags["DICTIONARY_VALUE"] = 6] = "DICTIONARY_VALUE";
    ValueFieldTags[ValueFieldTags["LIST_VALUE"] = 7] = "LIST_VALUE";
})(ValueFieldTags || (ValueFieldTags = {}));
export function whichValue(u) {
    if (u.nullValue !== null && u.nullValue !== undefined) {
        return ValueFieldTags.NULL_VALUE;
    }
    if (u.boolValue !== null && u.boolValue !== undefined) {
        return ValueFieldTags.BOOL_VALUE;
    }
    if (u.intValue !== null && u.intValue !== undefined) {
        return ValueFieldTags.INT_VALUE;
    }
    if (u.doubleValue !== null && u.doubleValue !== undefined) {
        return ValueFieldTags.DOUBLE_VALUE;
    }
    if (u.stringValue !== null && u.stringValue !== undefined) {
        return ValueFieldTags.STRING_VALUE;
    }
    if (u.binaryValue !== null && u.binaryValue !== undefined) {
        return ValueFieldTags.BINARY_VALUE;
    }
    if (u.dictionaryValue !== null && u.dictionaryValue !== undefined) {
        return ValueFieldTags.DICTIONARY_VALUE;
    }
    if (u.listValue !== null && u.listValue !== undefined) {
        return ValueFieldTags.LIST_VALUE;
    }
    throw new Error("no union field has been set, this is an illegal state");
}
