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

  /// Detailed search information.
  public struct SearchInfo: Codable, Equatable, GoogleCloudWkt._AnyPackable,
    Sendable
  {
    /// The user's search query.
    ///
    /// See
    /// [SearchRequest.query][google.cloud.discoveryengine.v1.SearchRequest.query]
    /// for definition.
    ///
    /// The value must be a UTF-8 encoded string with a length limit of 5,000
    /// characters. Otherwise, an `INVALID_ARGUMENT` error is returned.
    ///
    /// At least one of
    /// [search_query][google.cloud.discoveryengine.v1.SearchInfo.search_query] or
    /// [PageInfo.page_category][google.cloud.discoveryengine.v1.PageInfo.page_category]
    /// is required for `search` events. Other event types should not set this
    /// field. Otherwise, an `INVALID_ARGUMENT` error is returned.
    ///
    /// [google.cloud.discoveryengine.v1.PageInfo.page_category]: <doc:PageInfo/pageCategory>
    /// [google.cloud.discoveryengine.v1.SearchInfo.search_query]: <doc:SearchInfo/searchQuery>
    /// [google.cloud.discoveryengine.v1.SearchRequest.query]: <doc:SearchRequest/query>
    public var searchQuery: Swift.String = Swift.String()

    /// The order in which products are returned, if applicable.
    ///
    /// See
    /// [SearchRequest.order_by][google.cloud.discoveryengine.v1.SearchRequest.order_by]
    /// for definition and syntax.
    ///
    /// The value must be a UTF-8 encoded string with a length limit of 1,000
    /// characters. Otherwise, an `INVALID_ARGUMENT` error is returned.
    ///
    /// This can only be set for `search` events. Other event types should not set
    /// this field. Otherwise, an `INVALID_ARGUMENT` error is returned.
    ///
    /// [google.cloud.discoveryengine.v1.SearchRequest.order_by]: <doc:SearchRequest/orderBy>
    public var orderBy: Swift.String = Swift.String()

    /// An integer that specifies the current offset for pagination (the 0-indexed
    /// starting location, amongst the products deemed by the API as relevant).
    ///
    /// See
    /// [SearchRequest.offset][google.cloud.discoveryengine.v1.SearchRequest.offset]
    /// for definition.
    ///
    /// If this field is negative, an `INVALID_ARGUMENT` is returned.
    ///
    /// This can only be set for `search` events. Other event types should not set
    /// this field. Otherwise, an `INVALID_ARGUMENT` error is returned.
    ///
    /// [google.cloud.discoveryengine.v1.SearchRequest.offset]: <doc:SearchRequest/offset>
    public var offset: Swift.Int32? = nil

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