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

  /// Request message for
  /// [PredictionService.Explain][google.cloud.aiplatform.v1.PredictionService.Explain].
  ///
  /// [google.cloud.aiplatform.v1.PredictionService.Explain]: <doc:PredictionService/explain(request:)>
  public struct ExplainRequest: Codable, Equatable, GoogleCloudWkt._AnyPackable,
    Sendable
  {
    /// Required. The name of the Endpoint requested to serve the explanation.
    /// Format:
    /// `projects/{project}/locations/{location}/endpoints/{endpoint}`
    public var endpoint: Swift.String = Swift.String()

    /// Required. The instances that are the input to the explanation call.
    /// A DeployedModel may have an upper limit on the number of instances it
    /// supports per request, and when it is exceeded the explanation call errors
    /// in case of AutoML Models, or, in case of customer created Models, the
    /// behaviour is as documented by that Model.
    /// The schema of any single instance may be specified via Endpoint's
    /// DeployedModels' [Model's][google.cloud.aiplatform.v1.DeployedModel.model]
    /// [PredictSchemata's][google.cloud.aiplatform.v1.Model.predict_schemata]
    /// [instance_schema_uri][google.cloud.aiplatform.v1.PredictSchemata.instance_schema_uri].
    ///
    /// [google.cloud.aiplatform.v1.DeployedModel.model]: <doc:DeployedModel/model>
    /// [google.cloud.aiplatform.v1.Model.predict_schemata]: <doc:Model/predictSchemata>
    /// [google.cloud.aiplatform.v1.PredictSchemata.instance_schema_uri]: <doc:PredictSchemata/instanceSchemaUri>
    public var instances: [GoogleCloudWkt.Value] = []

    /// The parameters that govern the prediction. The schema of the parameters may
    /// be specified via Endpoint's DeployedModels' [Model's
    /// ][google.cloud.aiplatform.v1.DeployedModel.model]
    /// [PredictSchemata's][google.cloud.aiplatform.v1.Model.predict_schemata]
    /// [parameters_schema_uri][google.cloud.aiplatform.v1.PredictSchemata.parameters_schema_uri].
    ///
    /// [google.cloud.aiplatform.v1.DeployedModel.model]: <doc:DeployedModel/model>
    /// [google.cloud.aiplatform.v1.Model.predict_schemata]: <doc:Model/predictSchemata>
    /// [google.cloud.aiplatform.v1.PredictSchemata.parameters_schema_uri]: <doc:PredictSchemata/parametersSchemaUri>
    public var parameters: GoogleCloudWkt.Value? = nil

    /// If specified, overrides the
    /// [explanation_spec][google.cloud.aiplatform.v1.DeployedModel.explanation_spec]
    /// of the DeployedModel. Can be used for explaining prediction results with
    /// different configurations, such as:
    ///  - Explaining top-5 predictions results as opposed to top-1;
    ///  - Increasing path count or step count of the attribution methods to reduce
    ///    approximate errors;
    ///  - Using different baselines for explaining the prediction results.
    ///
    /// [google.cloud.aiplatform.v1.DeployedModel.explanation_spec]: <doc:DeployedModel/explanationSpec>
    public var explanationSpecOverride: ExplanationSpecOverride? = nil

    /// If specified, this ExplainRequest will be served by the chosen
    /// DeployedModel, overriding
    /// [Endpoint.traffic_split][google.cloud.aiplatform.v1.Endpoint.traffic_split].
    ///
    /// [google.cloud.aiplatform.v1.Endpoint.traffic_split]: <doc:Endpoint/trafficSplit>
    public var deployedModelId: Swift.String = Swift.String()

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