// 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 Agents
  import Foundation
  import GoogleCloudWkt

  /// A Dialogflow agent is a virtual agent that handles conversations with your
  /// end-users. It is a natural language understanding module that understands the
  /// nuances of human language. Dialogflow translates end-user text or audio
  /// during a conversation to structured data that your apps and services can
  /// understand. You design and build a Dialogflow agent to handle the types of
  /// conversations required for your system.
  ///
  /// For more information about agents, see the
  /// [Agent guide](https://cloud.google.com/dialogflow/docs/agents-overview).
  ///
  public struct Agent: Codable, Equatable, GoogleCloudWkt._AnyPackable,
    Sendable
  {
    /// Required. The project of this agent.
    /// Format: `projects/<Project ID>`.
    public var parent: Swift.String = Swift.String()

    /// Required. The name of this agent.
    public var displayName: Swift.String = Swift.String()

    /// Required. The default language of the agent as a language tag. See
    /// [Language
    /// Support](https://cloud.google.com/dialogflow/docs/reference/language)
    /// for a list of the currently supported language codes. This field cannot be
    /// set by the `Update` method.
    public var defaultLanguageCode: Swift.String = Swift.String()

    /// Optional. The list of all languages supported by this agent (except for the
    /// `default_language_code`).
    public var supportedLanguageCodes: [Swift.String] = []

    /// Required. The time zone of this agent from the
    /// [time zone database](https://www.iana.org/time-zones), e.g.,
    /// America/New_York, Europe/Paris.
    public var timeZone: Swift.String = Swift.String()

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

    /// Optional. The URI of the agent's avatar.
    /// Avatars are used throughout the Dialogflow console and in the self-hosted
    /// [Web
    /// Demo](https://cloud.google.com/dialogflow/docs/integrations/web-demo)
    /// integration.
    public var avatarUri: Swift.String = Swift.String()

    /// Optional. Determines whether this agent should log conversation queries.
    public var enableLogging: Swift.Bool = Swift.Bool()

    /// Optional. Determines how intents are detected from user queries.
    @available(*, deprecated)
    public var matchMode: Agent.MatchMode = Agent.MatchMode()

    /// Optional. To filter out false positive results and still get variety in
    /// matched natural language inputs for your agent, you can tune the machine
    /// learning classification threshold. If the returned score value is less than
    /// the threshold value, then a fallback intent will be triggered or, if there
    /// are no fallback intents defined, no intent will be triggered. The score
    /// values range from 0.0 (completely uncertain) to 1.0 (completely certain).
    /// If set to 0.0, the default of 0.3 is used.
    public var classificationThreshold: Swift.Float = Swift.Float()

    /// Optional. API version displayed in Dialogflow console. If not specified,
    /// V2 API is assumed. Clients are free to query different service endpoints
    /// for different API versions. However, bots connectors and webhook calls will
    /// follow the specified API version.
    public var apiVersion: Agent.ApiVersion = Agent.ApiVersion()

    /// Optional. The agent tier. If not specified, TIER_STANDARD is assumed.
    public var tier: Agent.Tier = Agent.Tier()

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

    /// Match mode determines how intents are detected from user queries.
    public enum MatchMode: Codable, Equatable, Sendable {
      /// Not specified.
      case unspecified
      /// Best for agents with a small number of examples in intents and/or wide
      /// use of templates syntax and composite entities.
      case hybrid
      /// Can be used for agents with a large number of examples in intents,
      /// especially the ones using @sys.any or very large custom entities.
      case mlOnly
      /// 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 .hybrid: return 1
        case .mlOnly: return 2
        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 "MATCH_MODE_UNSPECIFIED"
        case .hybrid: return "MATCH_MODE_HYBRID"
        case .mlOnly: return "MATCH_MODE_ML_ONLY"
        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:MatchMode/unknownStringValue(_:)).
      public init(stringValue: Swift.String) {
        switch stringValue {
        case "MATCH_MODE_UNSPECIFIED": self = .unspecified
        case "MATCH_MODE_HYBRID": self = .hybrid
        case "MATCH_MODE_ML_ONLY": self = .mlOnly
        default: self = .unknownStringValue(stringValue)
        }
      }

      /// Initialize from an integer value.
      ///
      /// If the value is unknown, this initializes to [`unknownIntValue`](doc:MatchMode/unknownIntValue(_:)).
      public init(intValue: Int) {
        switch intValue {
        case 0: self = .unspecified
        case 1: self = .hybrid
        case 2: self = .mlOnly
        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 .hybrid: return try container.encode(1)
        case .mlOnly: return try container.encode(2)
        case .unknownIntValue(let v): return try container.encode(v)
        case .unknownStringValue(let v): return try container.encode(v)
        }
      }
    }

    /// API version for the agent.
    public enum ApiVersion: Codable, Equatable, Sendable {
      /// Not specified.
      case unspecified
      /// Legacy V1 API.
      case v1
      /// V2 API.
      case v2
      /// V2beta1 API.
      case v2Beta1
      /// 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 .v1: return 1
        case .v2: return 2
        case .v2Beta1: return 3
        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 "API_VERSION_UNSPECIFIED"
        case .v1: return "API_VERSION_V1"
        case .v2: return "API_VERSION_V2"
        case .v2Beta1: return "API_VERSION_V2_BETA_1"
        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:ApiVersion/unknownStringValue(_:)).
      public init(stringValue: Swift.String) {
        switch stringValue {
        case "API_VERSION_UNSPECIFIED": self = .unspecified
        case "API_VERSION_V1": self = .v1
        case "API_VERSION_V2": self = .v2
        case "API_VERSION_V2_BETA_1": self = .v2Beta1
        default: self = .unknownStringValue(stringValue)
        }
      }

      /// Initialize from an integer value.
      ///
      /// If the value is unknown, this initializes to [`unknownIntValue`](doc:ApiVersion/unknownIntValue(_:)).
      public init(intValue: Int) {
        switch intValue {
        case 0: self = .unspecified
        case 1: self = .v1
        case 2: self = .v2
        case 3: self = .v2Beta1
        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 .v1: return try container.encode(1)
        case .v2: return try container.encode(2)
        case .v2Beta1: return try container.encode(3)
        case .unknownIntValue(let v): return try container.encode(v)
        case .unknownStringValue(let v): return try container.encode(v)
        }
      }
    }

    /// Represents the agent tier.
    public enum Tier: Codable, Equatable, Sendable {
      /// Not specified. This value should never be used.
      case unspecified
      /// Trial Edition, previously known as Standard Edition.
      case standard
      /// Essentials Edition, previously known as Enterprise Essential Edition.
      case enterprise
      /// Essentials Edition (same as TIER_ENTERPRISE), previously known as
      /// Enterprise Plus Edition.
      @available(*, deprecated)
      case enterprisePlus
      /// 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 .standard: return 1
        case .enterprise: return 2
        case .enterprisePlus: return 3
        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 "TIER_UNSPECIFIED"
        case .standard: return "TIER_STANDARD"
        case .enterprise: return "TIER_ENTERPRISE"
        case .enterprisePlus: return "TIER_ENTERPRISE_PLUS"
        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:Tier/unknownStringValue(_:)).
      public init(stringValue: Swift.String) {
        switch stringValue {
        case "TIER_UNSPECIFIED": self = .unspecified
        case "TIER_STANDARD": self = .standard
        case "TIER_ENTERPRISE": self = .enterprise
        case "TIER_ENTERPRISE_PLUS": self = .enterprisePlus
        default: self = .unknownStringValue(stringValue)
        }
      }

      /// Initialize from an integer value.
      ///
      /// If the value is unknown, this initializes to [`unknownIntValue`](doc:Tier/unknownIntValue(_:)).
      public init(intValue: Int) {
        switch intValue {
        case 0: self = .unspecified
        case 1: self = .standard
        case 2: self = .enterprise
        case 3: self = .enterprisePlus
        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 .standard: return try container.encode(1)
        case .enterprise: return try container.encode(2)
        case .enterprisePlus: return try container.encode(3)
        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.Agent"
    }
    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
