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

  /// Request message for
  /// [GroundedGenerationService.CheckGrounding][google.cloud.discoveryengine.v1.GroundedGenerationService.CheckGrounding]
  /// method.
  ///
  /// [google.cloud.discoveryengine.v1.GroundedGenerationService.CheckGrounding]: <doc:GroundedGenerationService/checkGrounding(request:)>
  public struct CheckGroundingRequest: Codable, Equatable, GoogleCloudWkt._AnyPackable,
    Sendable
  {
    /// Required. The resource name of the grounding config, such as
    /// `projects/*/locations/global/groundingConfigs/default_grounding_config`.
    public var groundingConfig: Swift.String = Swift.String()

    /// Answer candidate to check. It can have a maximum length of 4096 tokens.
    public var answerCandidate: Swift.String = Swift.String()

    /// List of facts for the grounding check.
    /// We support up to 200 facts.
    public var facts: [GroundingFact] = []

    /// Configuration of the grounding check.
    public var groundingSpec: CheckGroundingSpec? = nil

    /// The user labels applied to a resource must meet the following requirements:
    ///
    /// * Each resource can have multiple labels, up to a maximum of 64.
    /// * Each label must be a key-value pair.
    /// * Keys have a minimum length of 1 character and a maximum length of 63
    ///   characters and cannot be empty. Values can be empty and have a maximum
    ///   length of 63 characters.
    /// * Keys and values can contain only lowercase letters, numeric characters,
    ///   underscores, and dashes. All characters must use UTF-8 encoding, and
    ///   international characters are allowed.
    /// * The key portion of a label must be unique. However, you can use the same
    ///   key with multiple resources.
    /// * Keys must start with a lowercase letter or international character.
    ///
    /// See [Google Cloud
    /// Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements)
    /// for more details.
    public var userLabels: [Swift.String: Swift.String] = [:]

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