// 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 GenAiCacheService || LlmUtilityService || PredictionService || VertexRagService
  import Foundation
  import GoogleCloudWkt

  /// Retrieve from Vertex AI Search datastore or engine for grounding.
  /// datastore and engine are mutually exclusive.
  /// See https://cloud.google.com/products/agent-builder
  public struct VertexAISearch: Codable, Equatable, GoogleCloudWkt._AnyPackable,
    Sendable
  {
    /// Optional. Fully-qualified Vertex AI Search data store resource ID.
    /// Format:
    /// `projects/{project}/locations/{location}/collections/{collection}/dataStores/{dataStore}`
    public var datastore: Swift.String = Swift.String()

    /// Optional. Fully-qualified Vertex AI Search engine resource ID.
    /// Format:
    /// `projects/{project}/locations/{location}/collections/{collection}/engines/{engine}`
    public var engine: Swift.String = Swift.String()

    /// Optional. Number of search results to return per query.
    /// The default value is 10.
    /// The maximumm allowed value is 10.
    public var maxResults: Swift.Int32 = Swift.Int32()

    /// Optional. Filter strings to be passed to the search API.
    public var filter: Swift.String = Swift.String()

    /// Specifications that define the specific DataStores to be searched, along
    /// with configurations for those data stores. This is only considered for
    /// Engines with multiple data stores.
    /// It should only be set if engine is used.
    public var dataStoreSpecs: [VertexAISearch.DataStoreSpec] = []

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

    /// Define data stores within engine to filter on in a search call and
    /// configurations for those data stores. For more information, see
    /// https://cloud.google.com/generative-ai-app-builder/docs/reference/rpc/google.cloud.discoveryengine.v1#datastorespec
    public struct DataStoreSpec: Codable, Equatable, GoogleCloudWkt._AnyPackable,
      Sendable
    {
      /// Full resource name of DataStore, such as
      /// Format:
      /// `projects/{project}/locations/{location}/collections/{collection}/dataStores/{dataStore}`
      public var dataStore: Swift.String = Swift.String()

      /// Optional. Filter specification to filter documents in the data store
      /// specified by data_store field. For more information on filtering, see
      /// [Filtering](https://cloud.google.com/generative-ai-app-builder/docs/filter-search-metadata)
      public var filter: Swift.String = Swift.String()

      /// Initialize a new instance of `DataStoreSpec`.
      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 = DataStoreSpec().with { $0.dataStore = ... }
      /// ```
      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.aiplatform.v1.VertexAISearch.DataStoreSpec"
      }
      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.aiplatform.v1.VertexAISearch"
    }
    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
