// services/device/public/mojom/geoposition.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 { TimeSpec as mojoBase_mojom_TimeSpec } from '//resources/mojo/mojo/public/mojom/base/time.mojom-webui.js';
export const BAD_LATITUDE_LONGITUDE = 200;
export const BAD_ALTITUDE = -10000;
export const BAD_ACCURACY = -1;
export const BAD_HEADING = -1;
export const BAD_SPEED = -1;
export const GEO_PERMISSION_DENIED_ERROR_MESSAGE = "User denied geolocation permission";
export const GEO_POSITION_UNAVAILABLE_ERROR_MESSAGE = "Position update is unavailable";
export const GeopositionErrorCodeSpec = { $: mojo.internal.Enum() };
export var GeopositionErrorCode;
(function (GeopositionErrorCode) {
    GeopositionErrorCode[GeopositionErrorCode["MIN_VALUE"] = 1] = "MIN_VALUE";
    GeopositionErrorCode[GeopositionErrorCode["MAX_VALUE"] = 3] = "MAX_VALUE";
    GeopositionErrorCode[GeopositionErrorCode["kPermissionDenied"] = 1] = "kPermissionDenied";
    GeopositionErrorCode[GeopositionErrorCode["kPositionUnavailable"] = 2] = "kPositionUnavailable";
    GeopositionErrorCode[GeopositionErrorCode["kWifiDisabled"] = 3] = "kWifiDisabled";
})(GeopositionErrorCode || (GeopositionErrorCode = {}));
export const GeopositionSpec = { $: {} };
export const GeopositionErrorSpec = { $: {} };
export const GeopositionResultSpec = { $: {} };
mojo.internal.Struct(GeopositionSpec.$, 'Geoposition', [
    mojo.internal.StructField('latitude', 0, 0, mojo.internal.Double, BAD_LATITUDE_LONGITUDE, false /* nullable */, 0, undefined, undefined),
    mojo.internal.StructField('longitude', 8, 0, mojo.internal.Double, BAD_LATITUDE_LONGITUDE, false /* nullable */, 0, undefined, undefined),
    mojo.internal.StructField('altitude', 16, 0, mojo.internal.Double, BAD_ALTITUDE, false /* nullable */, 0, undefined, undefined),
    mojo.internal.StructField('accuracy', 24, 0, mojo.internal.Double, BAD_ACCURACY, false /* nullable */, 0, undefined, undefined),
    mojo.internal.StructField('altitudeAccuracy', 32, 0, mojo.internal.Double, BAD_ACCURACY, false /* nullable */, 0, undefined, undefined),
    mojo.internal.StructField('heading', 40, 0, mojo.internal.Double, BAD_HEADING, false /* nullable */, 0, undefined, undefined),
    mojo.internal.StructField('speed', 48, 0, mojo.internal.Double, BAD_SPEED, false /* nullable */, 0, undefined, undefined),
    mojo.internal.StructField('timestamp', 56, 0, mojoBase_mojom_TimeSpec.$, null, false /* nullable */, 0, undefined, undefined),
    mojo.internal.StructField('isPrecise', 64, 0, mojo.internal.Bool, true, false /* nullable */, 0, undefined, undefined),
], [[0, 80],]);
mojo.internal.Struct(GeopositionErrorSpec.$, 'GeopositionError', [
    mojo.internal.StructField('errorCode', 0, 0, GeopositionErrorCodeSpec.$, 1, false /* nullable */, 0, undefined, undefined),
    mojo.internal.StructField('errorMessage', 8, 0, mojo.internal.String, null, false /* nullable */, 0, undefined, undefined),
    mojo.internal.StructField('errorTechnical', 16, 0, mojo.internal.String, null, false /* nullable */, 0, undefined, undefined),
], [[0, 32],]);
mojo.internal.Union(GeopositionResultSpec.$, 'GeopositionResult', {
    'position': {
        'ordinal': 0,
        'type': GeopositionSpec.$,
    },
    'error': {
        'ordinal': 1,
        'type': GeopositionErrorSpec.$,
    },
});
export var GeopositionResultFieldTags;
(function (GeopositionResultFieldTags) {
    GeopositionResultFieldTags[GeopositionResultFieldTags["POSITION"] = 0] = "POSITION";
    GeopositionResultFieldTags[GeopositionResultFieldTags["ERROR"] = 1] = "ERROR";
})(GeopositionResultFieldTags || (GeopositionResultFieldTags = {}));
export function whichGeopositionResult(u) {
    if (u.position !== null && u.position !== undefined) {
        return GeopositionResultFieldTags.POSITION;
    }
    if (u.error !== null && u.error !== undefined) {
        return GeopositionResultFieldTags.ERROR;
    }
    throw new Error("no union field has been set, this is an illegal state");
}
