// Copyright 2026 Google LLC
//
// 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.

syntax = "proto3";

package google.cloud.dialogflow.cx.v3;

import "google/api/field_behavior.proto";

option go_package = "cloud.google.com/go/dialogflow/cx/apiv3/cxpb;cxpb";
option java_multiple_files = true;
option java_outer_classname = "ParameterDefinitionProto";
option java_package = "com.google.cloud.dialogflow.cx.v3";
option ruby_package = "Google::Cloud::Dialogflow::CX::V3";

// Defines the properties of a parameter.
// Used to define parameters used in the agent and the
// input / output parameters for each fulfillment.
message ParameterDefinition {
  // Parameter types are used for validation.
  // These types are consistent with
  // [google.protobuf.Value][google.protobuf.Value].
  enum ParameterType {
    // Not specified. No validation will be performed.
    PARAMETER_TYPE_UNSPECIFIED = 0;

    // Represents any string value.
    STRING = 1;

    // Represents any number value.
    NUMBER = 2;

    // Represents a boolean value.
    BOOLEAN = 3;

    // Represents a null value.
    NULL = 4;

    // Represents any object value.
    OBJECT = 5;

    // Represents a repeated value.
    LIST = 6;
  }

  // Required. Name of parameter.
  string name = 1 [(google.api.field_behavior) = REQUIRED];

  // Type of parameter.
  ParameterType type = 2 [deprecated = true];

  // Optional. Type schema of parameter.
  TypeSchema type_schema = 4 [(google.api.field_behavior) = OPTIONAL];

  // Human-readable description of the parameter. Limited to 300 characters.
  string description = 3;
}

// Encapsulates different type schema variations: either a reference to an
// a schema that's already defined by a tool, or an inline definition.
message TypeSchema {
  // A reference to the schema of an existing tool.
  message SchemaReference {
    // The tool that contains this schema definition.
    // Format:
    // `projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/tools/<ToolID>`.
    string tool = 1;

    // The name of the schema.
    string schema = 2;
  }

  // The encapsulated schema.
  oneof schema {
    // Set if this is an inline schema definition.
    InlineSchema inline_schema = 1;

    // Set if this is a schema reference.
    SchemaReference schema_reference = 2;
  }
}

// A type schema object that's specified inline.
message InlineSchema {
  // Data type of the schema.
  DataType type = 1;

  // Schema of the elements if this is an ARRAY type.
  TypeSchema items = 2;
}

// Defines data types that are supported for inlined schemas. These types are
// consistent with [google.protobuf.Value][google.protobuf.Value].
enum DataType {
  // Not specified.
  DATA_TYPE_UNSPECIFIED = 0;

  // Represents any string value.
  STRING = 1;

  // Represents any number value.
  NUMBER = 2;

  // Represents a boolean value.
  BOOLEAN = 3;

  // Represents a repeated value.
  ARRAY = 6;
}
