//
// Copyright (C) 2023 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// @generated by protoc-gen-es v2.2.2 with parameter "target=ts"
// @generated from file protos/perfetto/trace_processor/stack.proto (package perfetto.protos, syntax proto2)
/* eslint-disable */

import type { GenFile, GenMessage } from "@bufbuild/protobuf/codegenv1";
import { fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv1";
import type { Message } from "@bufbuild/protobuf";

/**
 * Describes the file protos/perfetto/trace_processor/stack.proto.
 */
export const file_protos_perfetto_trace_processor_stack: GenFile = /*@__PURE__*/
  fileDesc("Citwcm90b3MvcGVyZmV0dG8vdHJhY2VfcHJvY2Vzc29yL3N0YWNrLnByb3RvEg9wZXJmZXR0by5wcm90b3MipAEKBVN0YWNrEi0KB2VudHJpZXMYASADKAsyHC5wZXJmZXR0by5wcm90b3MuU3RhY2suRW50cnkabAoFRW50cnkSDgoEbmFtZRgBIAEoCUgAEhUKC2NhbGxzaXRlX2lkGAIgASgNSAASHwoVYW5ub3RhdGVkX2NhbGxzaXRlX2lkGAMgASgNSAASEgoIZnJhbWVfaWQYBCABKA1IAEIHCgVlbnRyeQ");

/**
 * Representation of a stack. To be used as input to generate flame charts
 * or pprof.
 *
 * @generated from message perfetto.protos.Stack
 */
export type Stack = Message<"perfetto.protos.Stack"> & {
  /**
   * Ordered list of "frames" in the stack. Leaf is at index 0.
   * Note that we call these entries and not frames because an entire call stack
   * can be referenced in one entry (via callsite_id).
   *
   * @generated from field: repeated perfetto.protos.Stack.Entry entries = 1;
   */
  entries: Stack_Entry[];
};

/**
 * Describes the message perfetto.protos.Stack.
 * Use `create(StackSchema)` to create a new message.
 */
export const StackSchema: GenMessage<Stack> = /*@__PURE__*/
  messageDesc(file_protos_perfetto_trace_processor_stack, 0);

/**
 * A stack is an ordered list of these entries. Think of them as frames in the
 * stack, although we support entire call stacks as an entry (for efficiency,
 * no need to copy entire stacks around if we can just copy a callsite_id).
 *
 * @generated from message perfetto.protos.Stack.Entry
 */
export type Stack_Entry = Message<"perfetto.protos.Stack.Entry"> & {
  /**
   * @generated from oneof perfetto.protos.Stack.Entry.entry
   */
  entry: {
    /**
     * @generated from field: string name = 1;
     */
    value: string;
    case: "name";
  } | {
    /**
     * @generated from field: uint32 callsite_id = 2;
     */
    value: number;
    case: "callsiteId";
  } | {
    /**
     * @generated from field: uint32 annotated_callsite_id = 3;
     */
    value: number;
    case: "annotatedCallsiteId";
  } | {
    /**
     * @generated from field: uint32 frame_id = 4;
     */
    value: number;
    case: "frameId";
  } | { case: undefined; value?: undefined };
};

/**
 * Describes the message perfetto.protos.Stack.Entry.
 * Use `create(Stack_EntrySchema)` to create a new message.
 */
export const Stack_EntrySchema: GenMessage<Stack_Entry> = /*@__PURE__*/
  messageDesc(file_protos_perfetto_trace_processor_stack, 0, 0);

