// Licensed to Apache Software Foundation (ASF) under one or more contributor
// license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright
// ownership. Apache Software Foundation (ASF) licenses this file to you 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.

syntax = "proto3";

package banyandb.bydbql.v1;

import "banyandb/measure/v1/query.proto";
import "banyandb/measure/v1/topn.proto";
import "banyandb/property/v1/rpc.proto";
import "banyandb/stream/v1/query.proto";
import "banyandb/trace/v1/query.proto";
import "validate/validate.proto";

option go_package = "github.com/apache/skywalking-banyandb/api/proto/banyandb/bydbql/v1";
option java_package = "org.apache.skywalking.banyandb.bydbql.v1";

// QueryRequest is the main request message for BydbQL queries
message QueryRequest {
  // query is the BydbQL query string
  string query = 1 [(validate.rules).string.min_len = 1];
}

// QueryResponse contains the result of a BydbQL query
message QueryResponse {
  // result contains the actual query result based on the query type
  oneof result {
    // stream_result is returned for stream queries
    stream.v1.QueryResponse stream_result = 1;
    // measure_result is returned for measure queries
    measure.v1.QueryResponse measure_result = 2;
    // property_result is returned for property queries
    property.v1.QueryResponse property_result = 3;
    // trace_result is returned for trace queries
    trace.v1.QueryResponse trace_result = 4;
    // topn_result is returned for TopN queries
    measure.v1.TopNResponse topn_result = 5;
  }
}
