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

  /// Request for the
  /// [AssistantService.StreamAssist][google.cloud.discoveryengine.v1.AssistantService.StreamAssist]
  /// method.
  ///
  /// [google.cloud.discoveryengine.v1.AssistantService.StreamAssist]: <doc:AssistantService/streamAssist(request:)>
  public struct StreamAssistRequest: Codable, Equatable, GoogleCloudWkt._AnyPackable,
    Sendable
  {
    /// Required. The resource name of the
    /// [Assistant][google.cloud.discoveryengine.v1.Assistant]. Format:
    /// `projects/{project}/locations/{location}/collections/{collection}/engines/{engine}/assistants/{assistant}`
    ///
    /// [google.cloud.discoveryengine.v1.Assistant]: <doc:Assistant>
    public var name: Swift.String = Swift.String()

    /// Optional. Current user query.
    ///
    /// Empty query is only supported if `file_ids` are provided. In this case, the
    /// answer will be generated based on those context files.
    public var query: Query? = nil

    /// Optional. The session to use for the request. If specified, the assistant
    /// has access to the session history, and the query and the answer are stored
    /// there.
    ///
    /// If `-` is specified as the session ID, or it is left empty, then a new
    /// session is created with an automatically generated ID.
    ///
    /// Format:
    /// `projects/{project}/locations/{location}/collections/{collection}/engines/{engine}/sessions/{session}`
    public var session: Swift.String = Swift.String()

    /// Optional. Information about the user initiating the query.
    public var userMetadata: AssistUserMetadata? = nil

    /// Optional. Specification of tools that are used to serve the request.
    public var toolsSpec: StreamAssistRequest.ToolsSpec? = nil

    /// Optional. Specification of the generation configuration for the request.
    public var generationSpec: StreamAssistRequest.GenerationSpec? = nil

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

    /// Specification of tools that are used to serve the request.
    public struct ToolsSpec: Codable, Equatable, GoogleCloudWkt._AnyPackable,
      Sendable
    {
      /// Optional. Specification of the Vertex AI Search tool.
      public var vertexAiSearchSpec: StreamAssistRequest.ToolsSpec.VertexAiSearchSpec? = nil

      /// Optional. Specification of the web grounding tool.
      /// If field is present, enables grounding with web search. Works only if
      /// [Assistant.web_grounding_type][google.cloud.discoveryengine.v1.Assistant.web_grounding_type]
      /// is [WEB_GROUNDING_TYPE_GOOGLE_SEARCH][] or
      /// [WEB_GROUNDING_TYPE_ENTERPRISE_WEB_SEARCH][].
      public var webGroundingSpec: StreamAssistRequest.ToolsSpec.WebGroundingSpec? = nil

      /// Optional. Specification of the image generation tool.
      public var imageGenerationSpec: StreamAssistRequest.ToolsSpec.ImageGenerationSpec? = nil

      /// Optional. Specification of the video generation tool.
      public var videoGenerationSpec: StreamAssistRequest.ToolsSpec.VideoGenerationSpec? = nil

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

      /// Specification of the Vertex AI Search tool.
      public struct VertexAiSearchSpec: Codable, Equatable, GoogleCloudWkt._AnyPackable,
        Sendable
      {
        /// Optional. Specs defining
        /// [DataStore][google.cloud.discoveryengine.v1.DataStore]s to filter on in
        /// a search call and configurations for those data stores. This is only
        /// considered for [Engine][google.cloud.discoveryengine.v1.Engine]s with
        /// multiple data stores.
        ///
        /// [google.cloud.discoveryengine.v1.DataStore]: <doc:DataStore>
        /// [google.cloud.discoveryengine.v1.Engine]: <doc:Engine>
        public var dataStoreSpecs: [SearchRequest.DataStoreSpec] = []

        /// Optional. The filter syntax consists of an expression language for
        /// constructing a predicate from one or more fields of the documents being
        /// filtered. Filter expression is case-sensitive.
        ///
        /// If this field is unrecognizable, an  `INVALID_ARGUMENT`  is returned.
        ///
        /// Filtering in Vertex AI Search is done by mapping the LHS filter key to
        /// a key property defined in the Vertex AI Search backend -- this mapping
        /// is defined by the customer in their schema. For example a media
        /// customer might have a field 'name' in their schema. In this case the
        /// filter would look like this: filter --> name:'ANY("king kong")'
        ///
        /// For more information about filtering including syntax and filter
        /// operators, see
        /// [Filter](https://cloud.google.com/generative-ai-app-builder/docs/filter-search-metadata)
        public var filter: Swift.String = Swift.String()

        /// Initialize a new instance of `VertexAiSearchSpec`.
        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 = VertexAiSearchSpec().with { $0.dataStoreSpecs = ... }
        /// ```
        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.discoveryengine.v1.StreamAssistRequest.ToolsSpec.VertexAiSearchSpec"
        }
        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)
        }
      }

      /// Specification of the web grounding tool.
      public struct WebGroundingSpec: Codable, Equatable, GoogleCloudWkt._AnyPackable,
        Sendable
      {
        /// Initialize a new instance of `WebGroundingSpec`.
        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 = WebGroundingSpec().with { $0.<placeholder> = ... }
        /// ```
        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.discoveryengine.v1.StreamAssistRequest.ToolsSpec.WebGroundingSpec"
        }
        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)
        }
      }

      /// Specification of the image generation tool.
      public struct ImageGenerationSpec: Codable, Equatable, GoogleCloudWkt._AnyPackable,
        Sendable
      {
        /// Initialize a new instance of `ImageGenerationSpec`.
        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 = ImageGenerationSpec().with { $0.<placeholder> = ... }
        /// ```
        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.discoveryengine.v1.StreamAssistRequest.ToolsSpec.ImageGenerationSpec"
        }
        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)
        }
      }

      /// Specification of the video generation tool.
      public struct VideoGenerationSpec: Codable, Equatable, GoogleCloudWkt._AnyPackable,
        Sendable
      {
        /// Initialize a new instance of `VideoGenerationSpec`.
        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 = VideoGenerationSpec().with { $0.<placeholder> = ... }
        /// ```
        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.discoveryengine.v1.StreamAssistRequest.ToolsSpec.VideoGenerationSpec"
        }
        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.discoveryengine.v1.StreamAssistRequest.ToolsSpec"
      }
      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)
      }
    }

    /// Assistant generation specification for the request.
    /// This allows to override the default generation configuration at the engine
    /// level.
    public struct GenerationSpec: Codable, Equatable, GoogleCloudWkt._AnyPackable,
      Sendable
    {
      /// Optional. The Vertex AI model_id used for the generative model. If not
      /// set, the default Assistant model will be used.
      public var modelId: Swift.String = Swift.String()

      /// Initialize a new instance of `GenerationSpec`.
      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 = GenerationSpec().with { $0.modelId = ... }
      /// ```
      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.discoveryengine.v1.StreamAssistRequest.GenerationSpec"
      }
      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.discoveryengine.v1.StreamAssistRequest"
    }
    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
