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

  /// Represents an environment for an agent. You can create multiple versions
  /// of your agent and publish them to separate environments. When you edit an
  /// agent, you are editing the draft agent. At any point, you can save the draft
  /// agent as an agent version, which is an immutable snapshot of your agent. When
  /// you save the draft agent, it is published to the default environment. When
  /// you create agent versions, you can publish them to custom environments. You
  /// can create a variety of custom environments for testing, development,
  /// production, etc.
  public struct Environment: Codable, Equatable, GoogleCloudWkt._AnyPackable,
    Sendable
  {
    /// The name of the environment.
    /// Format:
    /// `projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/environments/<EnvironmentID>`.
    public var name: Swift.String = Swift.String()

    /// Required. The human-readable name of the environment (unique in an agent).
    /// Limit of 64 characters.
    public var displayName: Swift.String = Swift.String()

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

    /// A list of configurations for flow versions. You should include version
    /// configs for all flows that are reachable from [`Start
    /// Flow`][Agent.start_flow] in the agent. Otherwise, an error will be
    /// returned.
    ///
    /// [Agent.start_flow]: <doc:Agent/startFlow>
    public var versionConfigs: [Environment.VersionConfig] = []

    /// Output only. Update time of this environment.
    public var updateTime: GoogleCloudWkt.Timestamp? = nil

    /// The test cases config for continuous tests of this environment.
    public var testCasesConfig: Environment.TestCasesConfig? = nil

    /// The webhook configuration for this environment.
    public var webhookConfig: Environment.WebhookConfig? = nil

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

    /// Configuration for the version.
    public struct VersionConfig: Codable, Equatable, GoogleCloudWkt._AnyPackable,
      Sendable
    {
      /// Required. Flow, playbook and tool versions are supported.
      /// Format for flow version:
      /// projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/flows/<FlowID>/versions/<VersionID>.
      /// Format for playbook version:
      /// projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/playbooks/<PlaybookID>/versions/<VersionID>.
      /// Format for tool version:
      /// projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/tools/<ToolID>/versions/<VersionID>.
      public var version: Swift.String = Swift.String()

      /// Initialize a new instance of `VersionConfig`.
      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 = VersionConfig().with { $0.version = ... }
      /// ```
      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.Environment.VersionConfig"
      }
      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 configuration for continuous tests.
    public struct TestCasesConfig: Codable, Equatable, GoogleCloudWkt._AnyPackable,
      Sendable
    {
      /// A list of test case names to run. They should be under the same agent.
      /// Format of each test case name:
      /// `projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/testCases/<TestCaseID>`
      public var testCases: [Swift.String] = []

      /// Whether to run test cases in
      /// [TestCasesConfig.test_cases][google.cloud.dialogflow.cx.v3.Environment.TestCasesConfig.test_cases]
      /// periodically. Default false. If set to true, run once a day.
      ///
      /// [google.cloud.dialogflow.cx.v3.Environment.TestCasesConfig.test_cases]: <doc:Environment/TestCasesConfig/testCases>
      public var enableContinuousRun: Swift.Bool = Swift.Bool()

      /// Whether to run test cases in
      /// [TestCasesConfig.test_cases][google.cloud.dialogflow.cx.v3.Environment.TestCasesConfig.test_cases]
      /// before deploying a flow version to the environment. Default false.
      ///
      /// [google.cloud.dialogflow.cx.v3.Environment.TestCasesConfig.test_cases]: <doc:Environment/TestCasesConfig/testCases>
      public var enablePredeploymentRun: Swift.Bool = Swift.Bool()

      /// Initialize a new instance of `TestCasesConfig`.
      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 = TestCasesConfig().with { $0.testCases = ... }
      /// ```
      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.Environment.TestCasesConfig"
      }
      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)
      }
    }

    /// Configuration for webhooks.
    public struct WebhookConfig: Codable, Equatable, GoogleCloudWkt._AnyPackable,
      Sendable
    {
      /// The list of webhooks to override for the agent environment. The webhook
      /// must exist in the agent. You can override fields in
      /// [`generic_web_service`][google.cloud.dialogflow.cx.v3.Webhook.generic_web_service]
      /// and
      /// [`service_directory`][google.cloud.dialogflow.cx.v3.Webhook.service_directory].
      ///
      /// [google.cloud.dialogflow.cx.v3.Webhook.generic_web_service]: <doc:Webhook/genericWebService>
      /// [google.cloud.dialogflow.cx.v3.Webhook.service_directory]: <doc:Webhook/serviceDirectory>
      public var webhookOverrides: [Webhook] = []

      /// Initialize a new instance of `WebhookConfig`.
      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 = WebhookConfig().with { $0.webhookOverrides = ... }
      /// ```
      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.Environment.WebhookConfig"
      }
      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.Environment"
    }
    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
