//
// 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/config/chrome/scenario_config.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 { TraceConfig } from "../trace_config_pb";
import { file_protos_perfetto_config_trace_config } from "../trace_config_pb";
import type { Message } from "@bufbuild/protobuf";

/**
 * Describes the file protos/perfetto/config/chrome/scenario_config.proto.
 */
export const file_protos_perfetto_config_chrome_scenario_config: GenFile = /*@__PURE__*/
  fileDesc("CjNwcm90b3MvcGVyZmV0dG8vY29uZmlnL2Nocm9tZS9zY2VuYXJpb19jb25maWcucHJvdG8SD3BlcmZldHRvLnByb3RvcyKsAwoLVHJpZ2dlclJ1bGUSDAoEbmFtZRgBIAEoCRIWCg50cmlnZ2VyX2NoYW5jZRgCIAEoAhIQCghkZWxheV9tcxgDIAEoBBIbChNhY3RpdmF0aW9uX2RlbGF5X21zGAggASgEEh0KE21hbnVhbF90cmlnZ2VyX25hbWUYBCABKAlIABJCCgloaXN0b2dyYW0YBSABKAsyLS5wZXJmZXR0by5wcm90b3MuVHJpZ2dlclJ1bGUuSGlzdG9ncmFtVHJpZ2dlckgAEkwKEnJlcGVhdGluZ19pbnRlcnZhbBgGIAEoCzIuLnBlcmZldHRvLnByb3Rvcy5UcmlnZ2VyUnVsZS5SZXBlYXRpbmdJbnRlcnZhbEgAGlAKEEhpc3RvZ3JhbVRyaWdnZXISFgoOaGlzdG9ncmFtX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xlcxgBIAMoCzIcLnBlcmZldHRvLnByb3Rvcy5UcmlnZ2VyUnVsZQ", [file_protos_perfetto_config_trace_config]);

/**
 * Rule that triggers scenario events (e.g. start, stop).
 *
 * @generated from message perfetto.protos.TriggerRule
 */
export type TriggerRule = Message<"perfetto.protos.TriggerRule"> & {
  /**
   * Rule unique name.
   *
   * @generated from field: optional string name = 1;
   */
  name: string;

  /**
   * A value between 0 and 1 which encodes the probability this rule is
   * triggered.
   *
   * @generated from field: optional float trigger_chance = 2;
   */
  triggerChance: number;

  /**
   * Additional delay *after* the trigger below. This is mostly useful
   * to trace beyond a triggered event in upload rules. Other triggers
   * can still be serviced during this period.
   *
   * @generated from field: optional uint64 delay_ms = 3;
   */
  delayMs: bigint;

  /**
   * Delay *before* which the rule is activated. Trigger events during this
   * period are ignored by this rule. This is mostly useful to trace for a
   * minimum duration before watching trigger events.
   *
   * @generated from field: optional uint64 activation_delay_ms = 8;
   */
  activationDelayMs: bigint;

  /**
   * @generated from oneof perfetto.protos.TriggerRule.trigger
   */
  trigger: {
    /**
     * Triggers when the associated named trigger is manually emitted in Chrome
     * client code.
     *
     * @generated from field: string manual_trigger_name = 4;
     */
    value: string;
    case: "manualTriggerName";
  } | {
    /**
     * @generated from field: perfetto.protos.TriggerRule.HistogramTrigger histogram = 5;
     */
    value: TriggerRule_HistogramTrigger;
    case: "histogram";
  } | {
    /**
     * @generated from field: perfetto.protos.TriggerRule.RepeatingInterval repeating_interval = 6;
     */
    value: TriggerRule_RepeatingInterval;
    case: "repeatingInterval";
  } | { case: undefined; value?: undefined };
};

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

/**
 * Triggers when a value within the specified bounds [min_value,
 * max_value] is emitted into a Chrome histogram.
 *
 * @generated from message perfetto.protos.TriggerRule.HistogramTrigger
 */
export type TriggerRule_HistogramTrigger = Message<"perfetto.protos.TriggerRule.HistogramTrigger"> & {
  /**
   * @generated from field: optional string histogram_name = 1;
   */
  histogramName: string;

  /**
   * @generated from field: optional int64 min_value = 2;
   */
  minValue: bigint;

  /**
   * @generated from field: optional int64 max_value = 3;
   */
  maxValue: bigint;
};

/**
 * Describes the message perfetto.protos.TriggerRule.HistogramTrigger.
 * Use `create(TriggerRule_HistogramTriggerSchema)` to create a new message.
 */
export const TriggerRule_HistogramTriggerSchema: GenMessage<TriggerRule_HistogramTrigger> = /*@__PURE__*/
  messageDesc(file_protos_perfetto_config_chrome_scenario_config, 0, 0);

/**
 * Triggers on a repeating interval, every `period_ms` milliseconds if
 * `randomized` is false, and at random time within a `period_ms` window
 * otherwise, thus ticking with an average period of `period_ms` milliseconds.
 *
 * @generated from message perfetto.protos.TriggerRule.RepeatingInterval
 */
export type TriggerRule_RepeatingInterval = Message<"perfetto.protos.TriggerRule.RepeatingInterval"> & {
  /**
   * @generated from field: optional uint64 period_ms = 1;
   */
  periodMs: bigint;

  /**
   * @generated from field: optional bool randomized = 2;
   */
  randomized: boolean;
};

/**
 * Describes the message perfetto.protos.TriggerRule.RepeatingInterval.
 * Use `create(TriggerRule_RepeatingIntervalSchema)` to create a new message.
 */
export const TriggerRule_RepeatingIntervalSchema: GenMessage<TriggerRule_RepeatingInterval> = /*@__PURE__*/
  messageDesc(file_protos_perfetto_config_chrome_scenario_config, 0, 1);

/**
 * @generated from message perfetto.protos.NestedScenarioConfig
 */
export type NestedScenarioConfig = Message<"perfetto.protos.NestedScenarioConfig"> & {
  /**
   * Nested scenario name, unique within the parent scenario.
   *
   * @generated from field: optional string scenario_name = 1;
   */
  scenarioName: string;

  /**
   * When triggered, this scenario becomes active. This activates `upload_rules`
   * and `stop_rules`.
   *
   * @generated from field: repeated perfetto.protos.TriggerRule start_rules = 2;
   */
  startRules: TriggerRule[];

  /**
   * When triggered, exits the scenario. This reverts back to the parent
   * scenario. All nested scenarios within the parent scenario will be observed
   * again.
   *
   * @generated from field: repeated perfetto.protos.TriggerRule stop_rules = 3;
   */
  stopRules: TriggerRule[];

  /**
   * When triggered, exits both this scenario and the parent scenario, stops the
   * tracing session, and attempts to upload the trace. All scenarios are
   * observed again.
   *
   * @generated from field: repeated perfetto.protos.TriggerRule upload_rules = 4;
   */
  uploadRules: TriggerRule[];
};

/**
 * Describes the message perfetto.protos.NestedScenarioConfig.
 * Use `create(NestedScenarioConfigSchema)` to create a new message.
 */
export const NestedScenarioConfigSchema: GenMessage<NestedScenarioConfig> = /*@__PURE__*/
  messageDesc(file_protos_perfetto_config_chrome_scenario_config, 1);

/**
 * @generated from message perfetto.protos.ScenarioConfig
 */
export type ScenarioConfig = Message<"perfetto.protos.ScenarioConfig"> & {
  /**
   * Scenario name, unique within the whole field tracing config.
   *
   * @generated from field: optional string scenario_name = 1;
   */
  scenarioName: string;

  /**
   * When triggered, this scenario becomes active. Initializes a tracing session
   * and starts recording data sources. This activates `upload_rules` and
   * `stop_rules`.
   *
   * @generated from field: repeated perfetto.protos.TriggerRule start_rules = 2;
   */
  startRules: TriggerRule[];

  /**
   * When triggered, exits the scenario. This stops the tracing session and
   * discards the trace. All scenarios will be observed again.
   *
   * @generated from field: repeated perfetto.protos.TriggerRule stop_rules = 3;
   */
  stopRules: TriggerRule[];

  /**
   * When triggered, exits the scenario, stops the tracing session, and attempts
   * to upload the trace. All scenarios will be observed again.
   *
   * @generated from field: repeated perfetto.protos.TriggerRule upload_rules = 4;
   */
  uploadRules: TriggerRule[];

  /**
   * When triggered, this scenario becomes active. Initializes a tracing
   * session, without recording data sources, and waits for a `start_rules` or
   * to enter a `nested_scenarios`, which would start recording. This also
   * activates `stop_rules`.
   *
   * @generated from field: repeated perfetto.protos.TriggerRule setup_rules = 5;
   */
  setupRules: TriggerRule[];

  /**
   * @generated from field: optional perfetto.protos.TraceConfig trace_config = 6;
   */
  traceConfig?: TraceConfig;

  /**
   * @generated from field: repeated perfetto.protos.NestedScenarioConfig nested_scenarios = 7;
   */
  nestedScenarios: NestedScenarioConfig[];
};

/**
 * Describes the message perfetto.protos.ScenarioConfig.
 * Use `create(ScenarioConfigSchema)` to create a new message.
 */
export const ScenarioConfigSchema: GenMessage<ScenarioConfig> = /*@__PURE__*/
  messageDesc(file_protos_perfetto_config_chrome_scenario_config, 2);

/**
 * @generated from message perfetto.protos.ChromeFieldTracingConfig
 */
export type ChromeFieldTracingConfig = Message<"perfetto.protos.ChromeFieldTracingConfig"> & {
  /**
   * @generated from field: repeated perfetto.protos.ScenarioConfig scenarios = 1;
   */
  scenarios: ScenarioConfig[];
};

/**
 * Describes the message perfetto.protos.ChromeFieldTracingConfig.
 * Use `create(ChromeFieldTracingConfigSchema)` to create a new message.
 */
export const ChromeFieldTracingConfigSchema: GenMessage<ChromeFieldTracingConfig> = /*@__PURE__*/
  messageDesc(file_protos_perfetto_config_chrome_scenario_config, 3);

/**
 * @generated from message perfetto.protos.TracingTriggerRulesConfig
 */
export type TracingTriggerRulesConfig = Message<"perfetto.protos.TracingTriggerRulesConfig"> & {
  /**
   * @generated from field: repeated perfetto.protos.TriggerRule rules = 1;
   */
  rules: TriggerRule[];
};

/**
 * Describes the message perfetto.protos.TracingTriggerRulesConfig.
 * Use `create(TracingTriggerRulesConfigSchema)` to create a new message.
 */
export const TracingTriggerRulesConfigSchema: GenMessage<TracingTriggerRulesConfig> = /*@__PURE__*/
  messageDesc(file_protos_perfetto_config_chrome_scenario_config, 4);

