// 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.

import Foundation
import GoogleCloudWkt

/// Request message for
/// [SearchCatalog][google.cloud.datacatalog.v1.DataCatalog.SearchCatalog].
///
/// [google.cloud.datacatalog.v1.DataCatalog.SearchCatalog]: <doc:DataCatalog/searchCatalog(request:)>
public struct SearchCatalogRequest: Codable, Equatable, GoogleCloudWkt._AnyPackable,
  Sendable
{
  /// Required. The scope of this search request.
  ///
  /// The `scope` is invalid if `include_org_ids`, `include_project_ids` are
  /// empty AND `include_gcp_public_datasets` is set to `false`. In this case,
  /// the request returns an error.
  public var scope: SearchCatalogRequest.Scope? = nil

  /// Optional. The query string with a minimum of 3 characters and specific
  /// syntax. For more information, see [Data Catalog search
  /// syntax](https://cloud.google.com/data-catalog/docs/how-to/search-reference).
  ///
  /// An empty query string returns all data assets (in the specified scope)
  /// that you have access to.
  ///
  /// A query string can be a simple `xyz` or qualified by predicates:
  ///
  /// * `name:x`
  /// * `column:y`
  /// * `description:z`
  public var query: Swift.String = Swift.String()

  /// Upper bound on the number of results you can get in a single response.
  ///
  /// Can't be negative or 0, defaults to 10 in this case.
  /// The maximum number is 1000. If exceeded, throws an "invalid argument"
  /// exception.
  public var pageSize: Swift.Int32 = Swift.Int32()

  /// Optional. Pagination token that, if specified, returns the next page of
  /// search results. If empty, returns the first page.
  ///
  /// This token is returned in the
  /// [SearchCatalogResponse.next_page_token][google.cloud.datacatalog.v1.SearchCatalogResponse.next_page_token]
  /// field of the response to a previous
  /// [SearchCatalogRequest][google.cloud.datacatalog.v1.DataCatalog.SearchCatalog]
  /// call.
  ///
  /// [google.cloud.datacatalog.v1.DataCatalog.SearchCatalog]: <doc:DataCatalog/searchCatalog(request:)>
  /// [google.cloud.datacatalog.v1.SearchCatalogResponse.next_page_token]: <doc:SearchCatalogResponse/nextPageToken>
  public var pageToken: Swift.String = Swift.String()

  /// Specifies the order of results.
  ///
  /// Currently supported case-sensitive values are:
  ///
  /// * `relevance` that can only be descending
  /// * `last_modified_timestamp [asc|desc]` with descending (`desc`) as default
  /// * `default` that can only be descending
  ///
  /// Search queries don't guarantee full recall. Results that match your query
  /// might not be returned, even in subsequent result pages. Additionally,
  /// returned (and not returned) results can vary if you repeat search queries.
  /// If you are experiencing recall issues and you don't have to fetch the
  /// results in any specific order, consider setting this parameter to
  /// `default`.
  ///
  /// If this parameter is omitted, it defaults to the descending `relevance`.
  public var orderBy: Swift.String = Swift.String()

  /// Optional. If set, use searchAll permission granted on organizations from
  /// `include_org_ids` and projects from `include_project_ids` instead of the
  /// fine grained per resource permissions when filtering the search results.
  /// The only allowed `order_by` criteria for admin_search mode is `default`.
  /// Using this flags guarantees a full recall of the search results.
  public var adminSearch: Swift.Bool = Swift.Bool()

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

  /// The criteria that select the subspace used for query matching.
  public struct Scope: Codable, Equatable, GoogleCloudWkt._AnyPackable,
    Sendable
  {
    /// The list of organization IDs to search within.
    ///
    /// To find your organization ID, follow the steps from
    /// [Creating and managing organizations]
    /// (/resource-manager/docs/creating-managing-organization).
    public var includeOrgIds: [Swift.String] = []

    /// The list of project IDs to search within.
    ///
    /// For more information on the distinction between project names, IDs, and
    /// numbers, see [Projects](/docs/overview/#projects).
    public var includeProjectIds: [Swift.String] = []

    /// If `true`, include Google Cloud public datasets in
    /// search results. By default, they are excluded.
    ///
    /// See [Google Cloud Public Datasets](/public-datasets) for more
    /// information.
    public var includeGcpPublicDatasets: Swift.Bool = Swift.Bool()

    /// Optional. The list of locations to search within. If empty, all locations
    /// are searched.
    ///
    /// Returns an error if any location in the list isn't one of the [Supported
    /// regions](https://cloud.google.com/data-catalog/docs/concepts/regions#supported_regions).
    ///
    /// If a location is unreachable, its name is returned in the
    /// `SearchCatalogResponse.unreachable` field. To get additional information
    /// on the error, repeat the search request and set the location name as the
    /// value of this parameter.
    public var restrictedLocations: [Swift.String] = []

    /// Optional. If `true`, search only among starred entries.
    ///
    /// By default, all results are returned, starred or not.
    public var starredOnly: Swift.Bool = Swift.Bool()

    /// Optional. This field is deprecated. The search mechanism for public and
    /// private tag templates is the same.
    @available(*, deprecated)
    public var includePublicTagTemplates: Swift.Bool = Swift.Bool()

    /// Initialize a new instance of `Scope`.
    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 = Scope().with { $0.includeOrgIds = ... }
    /// ```
    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.datacatalog.v1.SearchCatalogRequest.Scope"
    }
    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.datacatalog.v1.SearchCatalogRequest"
  }
  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)
  }
}
