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

  /// Response message for
  /// [FeaturestoreOnlineServingService.ReadFeatureValues][google.cloud.aiplatform.v1.FeaturestoreOnlineServingService.ReadFeatureValues].
  ///
  /// [google.cloud.aiplatform.v1.FeaturestoreOnlineServingService.ReadFeatureValues]: <doc:FeaturestoreOnlineServingService/readFeatureValues(request:)>
  public struct ReadFeatureValuesResponse: Codable, Equatable, GoogleCloudWkt._AnyPackable,
    Sendable
  {
    /// Response header.
    public var header: ReadFeatureValuesResponse.Header? = nil

    /// Entity view with Feature values. This may be the entity in the
    /// Featurestore if values for all Features were requested, or a projection
    /// of the entity in the Featurestore if values for only some Features were
    /// requested.
    public var entityView: ReadFeatureValuesResponse.EntityView? = nil

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

    /// Metadata for requested Features.
    public struct FeatureDescriptor: Codable, Equatable, GoogleCloudWkt._AnyPackable,
      Sendable
    {
      /// Feature ID.
      public var id: Swift.String = Swift.String()

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

    /// Response header with metadata for the requested
    /// [ReadFeatureValuesRequest.entity_type][google.cloud.aiplatform.v1.ReadFeatureValuesRequest.entity_type]
    /// and Features.
    ///
    /// [google.cloud.aiplatform.v1.ReadFeatureValuesRequest.entity_type]: <doc:ReadFeatureValuesRequest/entityType>
    public struct Header: Codable, Equatable, GoogleCloudWkt._AnyPackable,
      Sendable
    {
      /// The resource name of the EntityType from the
      /// [ReadFeatureValuesRequest][google.cloud.aiplatform.v1.ReadFeatureValuesRequest].
      /// Value format:
      /// `projects/{project}/locations/{location}/featurestores/{featurestore}/entityTypes/{entityType}`.
      ///
      /// [google.cloud.aiplatform.v1.ReadFeatureValuesRequest]: <doc:ReadFeatureValuesRequest>
      public var entityType: Swift.String = Swift.String()

      /// List of Feature metadata corresponding to each piece of
      /// [ReadFeatureValuesResponse.EntityView.data][google.cloud.aiplatform.v1.ReadFeatureValuesResponse.EntityView.data].
      ///
      /// [google.cloud.aiplatform.v1.ReadFeatureValuesResponse.EntityView.data]: <doc:ReadFeatureValuesResponse/EntityView/data>
      public var featureDescriptors: [ReadFeatureValuesResponse.FeatureDescriptor] = []

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

    /// Entity view with Feature values.
    public struct EntityView: Codable, Equatable, GoogleCloudWkt._AnyPackable,
      Sendable
    {
      /// ID of the requested entity.
      public var entityId: Swift.String = Swift.String()

      /// Each piece of data holds the k
      /// requested values for one requested Feature. If no values
      /// for the requested Feature exist, the corresponding cell will be empty.
      /// This has the same size and is in the same order as the features from the
      /// header
      /// [ReadFeatureValuesResponse.header][google.cloud.aiplatform.v1.ReadFeatureValuesResponse.header].
      ///
      /// [google.cloud.aiplatform.v1.ReadFeatureValuesResponse.header]: <doc:ReadFeatureValuesResponse/header>
      public var data: [ReadFeatureValuesResponse.EntityView.Data] = []

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

      /// Container to hold value(s), successive in time, for one Feature from the
      /// request.
      public struct Data: Codable, Equatable, GoogleCloudWkt._AnyPackable,
        Sendable
      {
        public var data: OneOf_Data? = nil

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

        private enum CodingKeys: Swift.String, CodingKey {
          case value = "value"
          case values = "values"
        }

        public init(from decoder: Decoder) throws {
          let container = try decoder.container(keyedBy: CodingKeys.self)

          var data: OneOf_Data? = nil
          let dataCheckAndSet = {
            if data != nil {
              throw DecodingError.dataCorrupted(
                DecodingError.Context(
                  codingPath: decoder.codingPath,
                  debugDescription: "Multiple values set for oneof 'data'"))
            }
            data = $0
          }
          if let value = try container.decodeIfPresent(FeatureValue?.self, forKey: .value) {
            try dataCheckAndSet(.value(value))
          }
          if let values = try container.decodeIfPresent(FeatureValueList?.self, forKey: .values) {
            try dataCheckAndSet(.values(values))
          }
          self.data = data
        }

        public func encode(to encoder: Encoder) throws {
          var container = encoder.container(keyedBy: CodingKeys.self)

          if let choice = self.data {
            switch choice {
            case .value(let value):
              try container.encode(value, forKey: .value)
            case .values(let value):
              try container.encode(value, forKey: .values)
            }
          }
        }

        public enum OneOf_Data: Codable, Equatable, Sendable {
          /// Feature value if a single value is requested.
          indirect case value(FeatureValue?)
          /// Feature values list if values, successive in time, are requested.
          /// If the requested number of values is greater than the number of
          /// existing Feature values, nonexistent values are omitted instead of
          /// being returned as empty.
          indirect case values(FeatureValueList?)
        }

        public static var _anyTypeUrl: Swift.String {
          return
            "type.googleapis.com/google.cloud.aiplatform.v1.ReadFeatureValuesResponse.EntityView.Data"
        }
        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.ReadFeatureValuesResponse.EntityView"
      }
      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.ReadFeatureValuesResponse"
    }
    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
