// Copyright (C) 2025 Rivos Inc.
//
// 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.

// Autogenerated by the ProtoZero Rust compiler plugin.
// Invoked by contrib/rust-sdk/tools/gen_rust_protos
// DO NOT EDIT.

use crate::pb_enum;
use crate::pb_msg;
use crate::protos::common::descriptor::*;
use crate::protos::trace_processor::metatrace_categories::*;
use crate::protos::trace_summary::file::*;

pb_enum!(TraceProcessorApiVersion {
    TRACE_PROCESSOR_CURRENT_API_VERSION: 14,
});

pb_enum!(TraceSummaryArgsFormat {
    BINARY_PROTOBUF: 0,
    TEXTPROTO: 1,
});

pb_enum!(ResetTraceProcessorArgsDropTrackEventDataBefore {
    NO_DROP: 0,
    TRACK_EVENT_RANGE_OF_INTEREST: 1,
});

pb_enum!(ResetTraceProcessorArgsParsingMode {
    DEFAULT: 0,
    TOKENIZE_ONLY: 1,
    TOKENIZE_AND_SORT: 2,
});

pb_enum!(ResetTraceProcessorArgsSortingMode {
    DEFAULT_HEURISTICS: 0,
    FORCE_FULL_SORT: 1,
});

pb_enum!(ComputeMetricArgsResultFormat {
    BINARY_PROTOBUF: 0,
    TEXTPROTO: 1,
    JSON: 2,
});

pb_enum!(CellsBatchCellType {
    CELL_INVALID: 0,
    CELL_NULL: 1,
    CELL_VARINT: 2,
    CELL_FLOAT64: 3,
    CELL_STRING: 4,
    CELL_BLOB: 5,
});

pb_enum!(TraceProcessorRpcTraceProcessorMethod {
    TPM_UNSPECIFIED: 0,
    TPM_APPEND_TRACE_DATA: 1,
    TPM_FINALIZE_TRACE_DATA: 2,
    TPM_QUERY_STREAMING: 3,
    TPM_COMPUTE_METRIC: 5,
    TPM_GET_METRIC_DESCRIPTORS: 6,
    TPM_RESTORE_INITIAL_TABLES: 7,
    TPM_ENABLE_METATRACE: 8,
    TPM_DISABLE_AND_READ_METATRACE: 9,
    TPM_GET_STATUS: 10,
    TPM_RESET_TRACE_PROCESSOR: 11,
    TPM_REGISTER_SQL_PACKAGE: 13,
    TPM_SUMMARIZE_TRACE: 15,
    TPM_CREATE_SUMMARIZER: 16,
    TPM_UPDATE_SUMMARIZER_SPEC: 17,
    TPM_QUERY_SUMMARIZER: 18,
    TPM_DESTROY_SUMMARIZER: 19,
});

pb_msg!(DestroySummarizerResult {
    error: String, primitive, 1,
});

pb_msg!(DestroySummarizerArgs {
    summarizer_id: String, primitive, 1,
});

pb_msg!(QuerySummarizerResult {
    exists: bool, primitive, 1,
    table_name: String, primitive, 2,
    row_count: i64, primitive, 3,
    columns: String, primitive, 4,
    duration_ms: f64, primitive, 5,
    error: String, primitive, 6,
    sql: String, primitive, 7,
    textproto: String, primitive, 8,
    standalone_sql: String, primitive, 9,
});

pb_msg!(QuerySummarizerArgs {
    summarizer_id: String, primitive, 1,
    query_id: String, primitive, 2,
});

pb_msg!(UpdateSummarizerSpecResult {
    queries: SummarizerQuerySyncInfo, msg, 1,
    error: String, primitive, 2,
});

pb_msg!(SummarizerQuerySyncInfo {
    query_id: String, primitive, 1,
    error: String, primitive, 2,
    was_updated: bool, primitive, 3,
    was_dropped: bool, primitive, 4,
});

pb_msg!(UpdateSummarizerSpecArgs {
    summarizer_id: String, primitive, 1,
    spec: TraceSummarySpec, msg, 2,
});

pb_msg!(CreateSummarizerResult {
    summarizer_id: String, primitive, 1,
    error: String, primitive, 2,
});

pb_msg!(CreateSummarizerArgs {
    summarizer_id: String, primitive, 1,
});

pb_msg!(TraceSummaryResult {
    proto_summary: String, primitive, 1,
    textproto_summary: String, primitive, 2,
    error: String, primitive, 3,
});

pb_msg!(TraceSummaryArgs {
    proto_specs: TraceSummarySpec, msg, 1,
    textproto_specs: String, primitive, 2,
    computation_spec: TraceSummaryArgsComputationSpec, msg, 3,
    output_format: TraceSummaryArgsFormat, enum, 4,
});

pb_msg!(TraceSummaryArgsComputationSpec {
    metric_ids: String, primitive, 1,
    run_all_metrics: bool, primitive, 3,
    metadata_query_id: String, primitive, 2,
});

pb_msg!(FinalizeDataResult {
    error: String, primitive, 1,
});

pb_msg!(RegisterSqlPackageResult {
    error: String, primitive, 1,
});

pb_msg!(RegisterSqlPackageArgs {
    package_name: String, primitive, 1,
    modules: RegisterSqlPackageArgsModule, msg, 2,
    allow_override: bool, primitive, 3,
});

pb_msg!(RegisterSqlPackageArgsModule {
    name: String, primitive, 1,
    sql: String, primitive, 2,
});

pb_msg!(ResetTraceProcessorArgs {
    drop_track_event_data_before: ResetTraceProcessorArgsDropTrackEventDataBefore, enum, 1,
    ingest_ftrace_in_raw_table: bool, primitive, 2,
    analyze_trace_proto_content: bool, primitive, 3,
    ftrace_drop_until_all_cpus_valid: bool, primitive, 4,
    parsing_mode: ResetTraceProcessorArgsParsingMode, enum, 5,
    sorting_mode: ResetTraceProcessorArgsSortingMode, enum, 6,
    extra_parsing_descriptors: String, primitive, 7,
});

pb_msg!(DescriptorSet {
    descriptors: DescriptorProto, msg, 1,
});

pb_msg!(DisableAndReadMetatraceResult {
    metatrace: String, primitive, 1,
    error: String, primitive, 2,
});

pb_msg!(DisableAndReadMetatraceArgs {});

pb_msg!(EnableMetatraceResult {});

pb_msg!(EnableMetatraceArgs {
    categories: MetatraceCategories, enum, 1,
});

pb_msg!(ComputeMetricResult {
    metrics: String, primitive, 1,
    metrics_as_prototext: String, primitive, 3,
    metrics_as_json: String, primitive, 4,
    error: String, primitive, 2,
});

pb_msg!(ComputeMetricArgs {
    metric_names: String, primitive, 1,
    format: ComputeMetricArgsResultFormat, enum, 2,
});

pb_msg!(StatusResult {
    loaded_trace_name: String, primitive, 1,
    human_readable_version: String, primitive, 2,
    api_version: i32, primitive, 3,
    version_code: String, primitive, 4,
});

pb_msg!(StatusArgs {});

pb_msg!(QueryResult {
    column_names: String, primitive, 1,
    error: String, primitive, 2,
    batch: QueryResultCellsBatch, msg, 3,
    statement_count: u32, primitive, 4,
    statement_with_output_count: u32, primitive, 5,
    last_statement_sql: String, primitive, 6,
    elapsed_time_ms: f64, primitive, 7,
});

pb_msg!(QueryResultCellsBatch {
    cells: CellsBatchCellType, enum, 1,
    varint_cells: i64, primitive, 2,
    float64_cells: f64, primitive, 3,
    blob_cells: String, primitive, 4,
    string_cells: String, primitive, 5,
    is_last_batch: bool, primitive, 6,
});

pb_msg!(QueryArgs {
    sql_query: String, primitive, 1,
    tag: String, primitive, 3,
});

pb_msg!(AppendTraceDataResult {
    total_bytes_parsed: i64, primitive, 1,
    error: String, primitive, 2,
});

pb_msg!(TraceProcessorRpc {
    seq: i64, primitive, 1,
    fatal_error: String, primitive, 5,
    request: TraceProcessorRpcTraceProcessorMethod, enum, 2,
    response: TraceProcessorRpcTraceProcessorMethod, enum, 3,
    invalid_request: TraceProcessorRpcTraceProcessorMethod, enum, 4,
    append_trace_data: String, primitive, 101,
    query_args: QueryArgs, msg, 103,
    compute_metric_args: ComputeMetricArgs, msg, 105,
    enable_metatrace_args: EnableMetatraceArgs, msg, 106,
    reset_trace_processor_args: ResetTraceProcessorArgs, msg, 107,
    register_sql_package_args: RegisterSqlPackageArgs, msg, 108,
    trace_summary_args: TraceSummaryArgs, msg, 110,
    create_summarizer_args: CreateSummarizerArgs, msg, 111,
    update_summarizer_spec_args: UpdateSummarizerSpecArgs, msg, 112,
    query_summarizer_args: QuerySummarizerArgs, msg, 113,
    destroy_summarizer_args: DestroySummarizerArgs, msg, 114,
    append_result: AppendTraceDataResult, msg, 201,
    query_result: QueryResult, msg, 203,
    metric_result: ComputeMetricResult, msg, 205,
    metric_descriptors: DescriptorSet, msg, 206,
    metatrace: DisableAndReadMetatraceResult, msg, 209,
    status: StatusResult, msg, 210,
    register_sql_package_result: RegisterSqlPackageResult, msg, 211,
    finalize_data_result: FinalizeDataResult, msg, 212,
    trace_summary_result: TraceSummaryResult, msg, 214,
    create_summarizer_result: CreateSummarizerResult, msg, 215,
    update_summarizer_spec_result: UpdateSummarizerSpecResult, msg, 216,
    query_summarizer_result: QuerySummarizerResult, msg, 217,
    destroy_summarizer_result: DestroySummarizerResult, msg, 218,
});

pb_msg!(TraceProcessorRpcStream {
    msg: TraceProcessorRpc, msg, 1,
});
