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

  /// A collection of metrics calculated by comparing Model's predictions on all of
  /// the test data against annotations from the test data.
  public struct ModelEvaluation: Codable, Equatable, GoogleCloudWkt._AnyPackable,
    Sendable
  {
    /// Output only. The resource name of the ModelEvaluation.
    public var name: Swift.String = Swift.String()

    /// The display name of the ModelEvaluation.
    public var displayName: Swift.String = Swift.String()

    /// Points to a YAML file stored on Google Cloud Storage describing the
    /// [metrics][google.cloud.aiplatform.v1.ModelEvaluation.metrics] of this
    /// ModelEvaluation. The schema is defined as an OpenAPI 3.0.2 [Schema
    /// Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.2.md#schemaObject).
    ///
    /// [google.cloud.aiplatform.v1.ModelEvaluation.metrics]: <doc:ModelEvaluation/metrics>
    public var metricsSchemaUri: Swift.String = Swift.String()

    /// Evaluation metrics of the Model. The schema of the metrics is stored in
    /// [metrics_schema_uri][google.cloud.aiplatform.v1.ModelEvaluation.metrics_schema_uri]
    ///
    /// [google.cloud.aiplatform.v1.ModelEvaluation.metrics_schema_uri]: <doc:ModelEvaluation/metricsSchemaUri>
    public var metrics: GoogleCloudWkt.Value? = nil

    /// Output only. Timestamp when this ModelEvaluation was created.
    public var createTime: GoogleCloudWkt.Timestamp? = nil

    /// All possible
    /// [dimensions][google.cloud.aiplatform.v1.ModelEvaluationSlice.Slice.dimension]
    /// of ModelEvaluationSlices. The dimensions can be used as the filter of the
    /// [ModelService.ListModelEvaluationSlices][google.cloud.aiplatform.v1.ModelService.ListModelEvaluationSlices]
    /// request, in the form of `slice.dimension = <dimension>`.
    ///
    /// [google.cloud.aiplatform.v1.ModelEvaluationSlice.Slice.dimension]: <doc:ModelEvaluationSlice/Slice/dimension>
    /// [google.cloud.aiplatform.v1.ModelService.ListModelEvaluationSlices]: <doc:ModelService/listModelEvaluationSlices(request:)>
    public var sliceDimensions: [Swift.String] = []

    /// Points to a YAML file stored on Google Cloud Storage describing
    /// [EvaluatedDataItemView.data_item_payload][] and
    /// [EvaluatedAnnotation.data_item_payload][google.cloud.aiplatform.v1.EvaluatedAnnotation.data_item_payload].
    /// The schema is defined as an OpenAPI 3.0.2 [Schema
    /// Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.2.md#schemaObject).
    ///
    /// This field is not populated if there are neither EvaluatedDataItemViews nor
    /// EvaluatedAnnotations under this ModelEvaluation.
    public var dataItemSchemaUri: Swift.String = Swift.String()

    /// Points to a YAML file stored on Google Cloud Storage describing
    /// [EvaluatedDataItemView.predictions][],
    /// [EvaluatedDataItemView.ground_truths][],
    /// [EvaluatedAnnotation.predictions][google.cloud.aiplatform.v1.EvaluatedAnnotation.predictions],
    /// and
    /// [EvaluatedAnnotation.ground_truths][google.cloud.aiplatform.v1.EvaluatedAnnotation.ground_truths].
    /// The schema is defined as an OpenAPI 3.0.2 [Schema
    /// Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.2.md#schemaObject).
    ///
    /// This field is not populated if there are neither EvaluatedDataItemViews nor
    /// EvaluatedAnnotations under this ModelEvaluation.
    ///
    /// [google.cloud.aiplatform.v1.EvaluatedAnnotation.ground_truths]: <doc:EvaluatedAnnotation/groundTruths>
    /// [google.cloud.aiplatform.v1.EvaluatedAnnotation.predictions]: <doc:EvaluatedAnnotation/predictions>
    public var annotationSchemaUri: Swift.String = Swift.String()

    /// Aggregated explanation metrics for the Model's prediction output over the
    /// data this ModelEvaluation uses. This field is populated only if the Model
    /// is evaluated with explanations, and only for AutoML tabular Models.
    ///
    public var modelExplanation: ModelExplanation? = nil

    /// Describes the values of
    /// [ExplanationSpec][google.cloud.aiplatform.v1.ExplanationSpec] that are used
    /// for explaining the predicted values on the evaluated data.
    ///
    /// [google.cloud.aiplatform.v1.ExplanationSpec]: <doc:ExplanationSpec>
    public var explanationSpecs: [ModelEvaluation.ModelEvaluationExplanationSpec] = []

    /// The metadata of the ModelEvaluation.
    /// For the ModelEvaluation uploaded from Managed Pipeline, metadata contains a
    /// structured value with keys of "pipeline_job_id", "evaluation_dataset_type",
    /// "evaluation_dataset_path", "row_based_metrics_path".
    public var metadata: GoogleCloudWkt.Value? = nil

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

    public struct ModelEvaluationExplanationSpec: Codable, Equatable, GoogleCloudWkt._AnyPackable,
      Sendable
    {
      /// Explanation type.
      ///
      /// For AutoML Image Classification models, possible values are:
      ///
      ///   * `image-integrated-gradients`
      ///   * `image-xrai`
      public var explanationType: Swift.String = Swift.String()

      /// Explanation spec details.
      public var explanationSpec: ExplanationSpec? = nil

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