// Code generated by sidekick. DO NOT EDIT.
//
// 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
//
//     https://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.

#if AnswerRecords || Conversations || GeneratorEvaluations || Generators || Participants
  import Foundation
  import GoogleCloudWkt

  /// Agent Coaching instructions that customer can configure.
  public struct AgentCoachingInstruction: Codable, Equatable, GoogleCloudWkt._AnyPackable,
    Sendable
  {
    /// Optional. Display name for the instruction.
    public var displayName: Swift.String = Swift.String()

    /// Optional. The detailed description of this instruction.
    public var displayDetails: Swift.String = Swift.String()

    /// 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.
    public var condition: Swift.String = Swift.String()

    /// 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
    public var agentAction: Swift.String = Swift.String()

    /// 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
    public var systemAction: Swift.String = Swift.String()

    /// Output only. Duplication check for the AgentCoachingInstruction.
    public var duplicateCheckResult: AgentCoachingInstruction.DuplicateCheckResult? = nil

    /// Optional. The event that should trigger this instruction.
    /// If UNSPECIFIED, the instruction triggering will be same as the generator's
    /// trigger_event.
    public var triggeringEvent: AgentCoachingInstruction.TriggerEvent =
      AgentCoachingInstruction.TriggerEvent()

    /// Initialize a new instance of `AgentCoachingInstruction`.
    public init() {}

    /// Use `config` to return a new instance of this object, with some fields updated.
    ///
    /// Commonly used to initialize the value, for example:
    ///
    /// ```
    /// let value = AgentCoachingInstruction().with { $0.displayName = ... }
    /// ```
    public func with(_ config: (inout Self) throws -> Swift.Void) rethrows -> Self {
      var copy = self
      try config(&copy)
      return copy
    }

    /// Duplication check for the suggestion.
    public struct DuplicateCheckResult: Codable, Equatable, GoogleCloudWkt._AnyPackable,
      Sendable
    {
      /// Output only. The duplicate suggestions.
      public var duplicateSuggestions:
        [AgentCoachingInstruction.DuplicateCheckResult.DuplicateSuggestion] = []

      /// Initialize a new instance of `DuplicateCheckResult`.
      public init() {}

      /// Use `config` to return a new instance of this object, with some fields updated.
      ///
      /// Commonly used to initialize the value, for example:
      ///
      /// ```
      /// let value = DuplicateCheckResult().with { $0.duplicateSuggestions = ... }
      /// ```
      public func with(_ config: (inout Self) throws -> Swift.Void) rethrows -> Self {
        var copy = self
        try config(&copy)
        return copy
      }

      /// The duplicate suggestion details.
      public struct DuplicateSuggestion: Codable, Equatable, GoogleCloudWkt._AnyPackable,
        Sendable
      {
        /// Output only. The answer record id of the past duplicate suggestion.
        public var answerRecord: Swift.String = Swift.String()

        /// Output only. The index of the duplicate suggestion in the past
        /// suggestion list.
        public var suggestionIndex: Swift.Int32 = Swift.Int32()

        /// Output only. The similarity score of between the past and current
        /// suggestion.
        public var similarityScore: Swift.Float = Swift.Float()

        /// Initialize a new instance of `DuplicateSuggestion`.
        public init() {}

        /// Use `config` to return a new instance of this object, with some fields updated.
        ///
        /// Commonly used to initialize the value, for example:
        ///
        /// ```
        /// let value = DuplicateSuggestion().with { $0.answerRecord = ... }
        /// ```
        public func with(_ config: (inout Self) throws -> Swift.Void) rethrows -> Self {
          var copy = self
          try config(&copy)
          return copy
        }

        public static var _anyTypeUrl: Swift.String {
          return
            "type.googleapis.com/google.cloud.dialogflow.v2.AgentCoachingInstruction.DuplicateCheckResult.DuplicateSuggestion"
        }
        public init(fromAny any: GoogleCloudWkt.`Any`) throws {
          self = try GoogleCloudWkt._slowAnyDeserialize(Self.self, from: any)
        }
        public func _pack() throws -> GoogleCloudWkt.Struct {
          return try GoogleCloudWkt._slowAnySerialize(message: self)
        }
      }

      public static var _anyTypeUrl: Swift.String {
        return
          "type.googleapis.com/google.cloud.dialogflow.v2.AgentCoachingInstruction.DuplicateCheckResult"
      }
      public init(fromAny any: GoogleCloudWkt.`Any`) throws {
        self = try GoogleCloudWkt._slowAnyDeserialize(Self.self, from: any)
      }
      public func _pack() throws -> GoogleCloudWkt.Struct {
        return try GoogleCloudWkt._slowAnySerialize(message: self)
      }
    }

    /// The event that should trigger this instruction.
    public enum TriggerEvent: Codable, Equatable, Sendable {
      /// Default value for TriggerEvent.
      case unspecified
      /// Triggers when each chat message or voice utterance ends.
      case endOfUtterance
      /// Triggers on the conversation manually by API calls.
      case manualCall
      /// Triggers after each customer message.
      case customerMessage
      /// Triggers after each agent message.
      case agentMessage
      /// Triggers on tool call completion.
      case toolCallCompletion
      /// Encodes an unknown integer value.
      ///
      /// The most common cause for an unknown values is for the service to send
      /// a value unknown to the library. We recommend you update your library to
      /// the latest version.
      case unknownIntValue(Int)
      /// Encodes an unknown string value.
      ///
      /// The most common cause for an unknown values is for the service to send
      /// a value unknown to the library. We recommend you update your library to
      /// the latest version.
      case unknownStringValue(String)

      public init() {
        self = .unspecified
      }

      /// Returns the integer value associated with the enumeration.
      ///
      /// If the enumeration was initialized with an unknown string value, this returns `nil`.
      public var intValue: Int? {
        switch self {
        case .unspecified: return 0
        case .endOfUtterance: return 1
        case .manualCall: return 2
        case .customerMessage: return 3
        case .agentMessage: return 4
        case .toolCallCompletion: return 5
        case .unknownIntValue(let v): return v
        case .unknownStringValue: return nil
        }
      }

      /// Returns the string value (or name) associated with the enumeration.
      ///
      /// If the enumeration was initialized with an unknown integer value, this returns `nil`.
      public var stringValue: Swift.String? {
        switch self {
        case .unspecified: return "TRIGGER_EVENT_UNSPECIFIED"
        case .endOfUtterance: return "END_OF_UTTERANCE"
        case .manualCall: return "MANUAL_CALL"
        case .customerMessage: return "CUSTOMER_MESSAGE"
        case .agentMessage: return "AGENT_MESSAGE"
        case .toolCallCompletion: return "TOOL_CALL_COMPLETION"
        case .unknownIntValue: return nil
        case .unknownStringValue(let v): return v
        }
      }

      /// Initialize from a string value.
      ///
      /// If the value is unknown, this initializes to [`unknownStringValue`](doc:TriggerEvent/unknownStringValue(_:)).
      public init(stringValue: Swift.String) {
        switch stringValue {
        case "TRIGGER_EVENT_UNSPECIFIED": self = .unspecified
        case "END_OF_UTTERANCE": self = .endOfUtterance
        case "MANUAL_CALL": self = .manualCall
        case "CUSTOMER_MESSAGE": self = .customerMessage
        case "AGENT_MESSAGE": self = .agentMessage
        case "TOOL_CALL_COMPLETION": self = .toolCallCompletion
        default: self = .unknownStringValue(stringValue)
        }
      }

      /// Initialize from an integer value.
      ///
      /// If the value is unknown, this initializes to [`unknownIntValue`](doc:TriggerEvent/unknownIntValue(_:)).
      public init(intValue: Int) {
        switch intValue {
        case 0: self = .unspecified
        case 1: self = .endOfUtterance
        case 2: self = .manualCall
        case 3: self = .customerMessage
        case 4: self = .agentMessage
        case 5: self = .toolCallCompletion
        default: self = .unknownIntValue(intValue)
        }
      }

      public init(from decoder: Decoder) throws {
        let container = try decoder.singleValueContainer()
        if let v = try? container.decode(Int.self) {
          self.init(intValue: v)
          return
        }
        if let s = try? container.decode(String.self) {
          if let v = Int(s) {
            self.init(intValue: v)
          } else {
            self.init(stringValue: s)
          }
          return
        }
        throw DecodingError.dataCorruptedError(
          in: container, debugDescription: "Expected enum value, must be integer or string.")
      }

      public func encode(to encoder: Encoder) throws {
        var container = encoder.singleValueContainer()
        switch self {
        case .unspecified: return try container.encode(0)
        case .endOfUtterance: return try container.encode(1)
        case .manualCall: return try container.encode(2)
        case .customerMessage: return try container.encode(3)
        case .agentMessage: return try container.encode(4)
        case .toolCallCompletion: return try container.encode(5)
        case .unknownIntValue(let v): return try container.encode(v)
        case .unknownStringValue(let v): return try container.encode(v)
        }
      }
    }

    public static var _anyTypeUrl: Swift.String {
      return "type.googleapis.com/google.cloud.dialogflow.v2.AgentCoachingInstruction"
    }
    public init(fromAny any: GoogleCloudWkt.`Any`) throws {
      self = try GoogleCloudWkt._slowAnyDeserialize(Self.self, from: any)
    }
    public func _pack() throws -> GoogleCloudWkt.Struct {
      return try GoogleCloudWkt._slowAnySerialize(message: self)
    }
  }
#endif
