// 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 Flows || Sessions || TestCases
  import Foundation
  import GoogleCloudWkt

  /// Flows represents the conversation flows when you build your chatbot agent.
  ///
  /// A flow consists of many pages connected by the transition routes.
  /// Conversations always start with the built-in Start Flow (with an all-0 ID).
  /// Transition routes can direct the conversation session from the current flow
  /// (parent flow) to another flow (sub flow). When the sub flow is finished,
  /// Dialogflow will bring the session back to the parent flow, where the sub flow
  /// is started.
  ///
  /// Usually, when a transition route is followed by a matched intent, the intent
  /// will be "consumed". This means the intent won't activate more transition
  /// routes. However, when the followed transition route moves the conversation
  /// session into a different flow, the matched intent can be carried over and to
  /// be consumed in the target flow.
  public struct Flow: Codable, Equatable, GoogleCloudWkt._AnyPackable,
    Sendable
  {
    /// The unique identifier of the flow.
    /// Format:
    /// `projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/flows/<FlowID>`.
    public var name: Swift.String = Swift.String()

    /// Required. The human-readable name of the flow.
    public var displayName: Swift.String = Swift.String()

    /// The description of the flow. The maximum length is 500 characters. If
    /// exceeded, the request is rejected.
    public var description: Swift.String = Swift.String()

    /// A flow's transition routes serve two purposes:
    ///
    /// *   They are responsible for matching the user's first utterances in the
    /// flow.
    /// *   They are inherited by every page's [transition
    /// routes][Page.transition_routes] and can support use cases such as the user
    /// saying "help" or "can I talk to a human?", which can be handled in a common
    /// way regardless of the current page. Transition routes defined in the page
    /// have higher priority than those defined in the flow.
    ///
    /// TransitionRoutes are evaluated in the following order:
    ///
    /// *   TransitionRoutes with intent specified.
    /// *   TransitionRoutes with only condition specified.
    ///
    /// TransitionRoutes with intent specified are inherited by pages in the flow.
    ///
    /// [Page.transition_routes]: <doc:Page/transitionRoutes>
    public var transitionRoutes: [TransitionRoute] = []

    /// A flow's event handlers serve two purposes:
    ///
    /// *   They are responsible for handling events (e.g. no match,
    /// webhook errors) in the flow.
    /// *   They are inherited by every page's [event
    /// handlers][Page.event_handlers], which can be used to handle common events
    /// regardless of the current page. Event handlers defined in the page
    /// have higher priority than those defined in the flow.
    ///
    /// Unlike
    /// [transition_routes][google.cloud.dialogflow.cx.v3.Flow.transition_routes],
    /// these handlers are evaluated on a first-match basis. The first one that
    /// matches the event get executed, with the rest being ignored.
    ///
    /// [Page.event_handlers]: <doc:Page/eventHandlers>
    /// [google.cloud.dialogflow.cx.v3.Flow.transition_routes]: <doc:Flow/transitionRoutes>
    public var eventHandlers: [EventHandler] = []

    /// A flow's transition route group serve two purposes:
    ///
    /// *   They are responsible for matching the user's first utterances in the
    /// flow.
    /// *   They are inherited by every page's [transition
    /// route groups][Page.transition_route_groups]. Transition route groups
    /// defined in the page have higher priority than those defined in the flow.
    ///
    /// Format:
    /// `projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/flows/<FlowID>/transitionRouteGroups/<TransitionRouteGroupID>`
    /// or
    /// `projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/transitionRouteGroups/<TransitionRouteGroupID>`
    /// for agent-level groups.
    ///
    /// [Page.transition_route_groups]: <doc:Page/transitionRouteGroups>
    public var transitionRouteGroups: [Swift.String] = []

    /// NLU related settings of the flow.
    public var nluSettings: NluSettings? = nil

    /// Hierarchical advanced settings for this flow. The settings exposed at the
    /// lower level overrides the settings exposed at the higher level.
    public var advancedSettings: AdvancedSettings? = nil

    /// Optional. Knowledge connector configuration.
    public var knowledgeConnectorSettings: KnowledgeConnectorSettings? = nil

    /// Optional. Defined structured input parameters for this flow.
    public var inputParameterDefinitions: [ParameterDefinition] = []

    /// Optional. Defined structured output parameters for this flow.
    public var outputParameterDefinitions: [ParameterDefinition] = []

    /// Optional. Multi-lingual agent settings for this flow.
    public var multiLanguageSettings: Flow.MultiLanguageSettings? = nil

    /// Indicates whether the flow is locked for changes. If the flow is locked,
    /// modifications to the flow will be rejected.
    public var locked: Swift.Bool = Swift.Bool()

    /// Initialize a new instance of `Flow`.
    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 = Flow().with { $0.name = ... }
    /// ```
    public func with(_ config: (inout Self) throws -> Swift.Void) rethrows -> Self {
      var copy = self
      try config(&copy)
      return copy
    }

    /// Settings for multi-lingual agents.
    public struct MultiLanguageSettings: Codable, Equatable, GoogleCloudWkt._AnyPackable,
      Sendable
    {
      /// Optional. Enable multi-language detection for this flow. This can be set
      /// only if [agent level multi language
      /// setting][Agent.enable_multi_language_training] is enabled.
      ///
      /// [Agent.enable_multi_language_training]: <doc:Agent/enableMultiLanguageTraining>
      public var enableMultiLanguageDetection: Swift.Bool = Swift.Bool()

      /// Optional. Agent will respond in the detected language if the detected
      /// language code is in the supported resolved languages for this flow. This
      /// will be used only if multi-language training is enabled in the
      /// [agent][google.cloud.dialogflow.cx.v3.Agent.enable_multi_language_training]
      /// and multi-language detection is enabled in the
      /// [flow][google.cloud.dialogflow.cx.v3.Flow.MultiLanguageSettings.enable_multi_language_detection].
      /// The supported languages must be a subset of the languages supported by
      /// the agent.
      ///
      /// [google.cloud.dialogflow.cx.v3.Agent.enable_multi_language_training]: <doc:Agent/enableMultiLanguageTraining>
      /// [google.cloud.dialogflow.cx.v3.Flow.MultiLanguageSettings.enable_multi_language_detection]: <doc:Flow/MultiLanguageSettings/enableMultiLanguageDetection>
      public var supportedResponseLanguageCodes: [Swift.String] = []

      /// Initialize a new instance of `MultiLanguageSettings`.
      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 = MultiLanguageSettings().with { $0.enableMultiLanguageDetection = ... }
      /// ```
      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.cx.v3.Flow.MultiLanguageSettings"
      }
      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.cx.v3.Flow"
    }
    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
