// 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.v2;

import "google/api/field_behavior.proto";

option csharp_namespace = "Google.Cloud.Dialogflow.V2";
option go_package = "cloud.google.com/go/dialogflow/apiv2/dialogflowpb;dialogflowpb";
option java_multiple_files = true;
option java_outer_classname = "AgentCoachingInstructionProto";
option java_package = "com.google.cloud.dialogflow.v2";
option objc_class_prefix = "DF";

// Agent Coaching instructions that customer can configure.
message AgentCoachingInstruction {
  // Duplication check for the suggestion.
  message DuplicateCheckResult {
    // The duplicate suggestion details.
    message DuplicateSuggestion {
      // Output only. The answer record id of the past duplicate suggestion.
      string answer_record = 1 [(google.api.field_behavior) = OUTPUT_ONLY];

      // Output only. The index of the duplicate suggestion in the past
      // suggestion list.
      int32 suggestion_index = 3 [(google.api.field_behavior) = OUTPUT_ONLY];

      // Output only. The similarity score of between the past and current
      // suggestion.
      float similarity_score = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
    }

    // Output only. The duplicate suggestions.
    repeated DuplicateSuggestion duplicate_suggestions = 1
        [(google.api.field_behavior) = OUTPUT_ONLY];
  }

  // The event that should trigger this instruction.
  enum TriggerEvent {
    // Default value for TriggerEvent.
    TRIGGER_EVENT_UNSPECIFIED = 0;

    // Triggers when each chat message or voice utterance ends.
    END_OF_UTTERANCE = 1;

    // Triggers on the conversation manually by API calls.
    MANUAL_CALL = 2;

    // Triggers after each customer message.
    CUSTOMER_MESSAGE = 3;

    // Triggers after each agent message.
    AGENT_MESSAGE = 4;

    // Triggers on tool call completion.
    TOOL_CALL_COMPLETION = 5;
  }

  // Optional. Display name for the instruction.
  string display_name = 1 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The detailed description of this instruction.
  string display_details = 2 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The condition of the instruction. For example, "the customer
  // wants to cancel an order".  If the users want the instruction to be
  // triggered unconditionally, the condition can be empty.
  string condition = 3 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The action that human agent should take. For example, "apologize
  // for the slow shipping". If the users only want to use agent coaching for
  // intent detection, agent_action can be empty
  string agent_action = 4 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The action that system should take. For example,
  // "call GetOrderTime with order_number={order number provided by the
  // customer}". If the users don't have plugins or don't want to trigger
  // plugins, the system_action can be empty
  string system_action = 5 [(google.api.field_behavior) = OPTIONAL];

  // Output only. Duplication check for the AgentCoachingInstruction.
  DuplicateCheckResult duplicate_check_result = 8
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Optional. The event that should trigger this instruction.
  // If UNSPECIFIED, the instruction triggering will be same as the generator's
  // trigger_event.
  TriggerEvent triggering_event = 10 [(google.api.field_behavior) = OPTIONAL];
}
