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

  /// FeatureView is representation of values that the FeatureOnlineStore will
  /// serve based on its syncConfig.
  public struct FeatureView: Codable, Equatable, GoogleCloudWkt._AnyPackable,
    Sendable
  {
    /// Identifier. Name of the FeatureView. Format:
    /// `projects/{project}/locations/{location}/featureOnlineStores/{feature_online_store}/featureViews/{feature_view}`
    public var name: Swift.String = Swift.String()

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

    /// Output only. Timestamp when this FeatureView was last updated.
    public var updateTime: GoogleCloudWkt.Timestamp? = nil

    /// Optional. Used to perform consistent read-modify-write updates. If not set,
    /// a blind "overwrite" update happens.
    public var etag: Swift.String = Swift.String()

    /// Optional. The labels with user-defined metadata to organize your
    /// FeatureViews.
    ///
    /// Label keys and values can be no longer than 64 characters
    /// (Unicode codepoints), can only contain lowercase letters, numeric
    /// characters, underscores and dashes. International characters are allowed.
    ///
    /// See https://goo.gl/xmQnxf for more information on and examples of labels.
    /// No more than 64 user labels can be associated with one
    /// FeatureOnlineStore(System labels are excluded)." System reserved label keys
    /// are prefixed with "aiplatform.googleapis.com/" and are immutable.
    public var labels: [Swift.String: Swift.String] = [:]

    /// Configures when data is to be synced/updated for this FeatureView. At the
    /// end of the sync the latest featureValues for each entityId of this
    /// FeatureView are made ready for online serving.
    public var syncConfig: FeatureView.SyncConfig? = nil

    /// Optional. Configuration for index preparation for vector search. It
    /// contains the required configurations to create an index from source data,
    /// so that approximate nearest neighbor (a.k.a ANN) algorithms search can be
    /// performed during online serving.
    public var indexConfig: FeatureView.IndexConfig? = nil

    /// Optional. Configuration for FeatureView created under Optimized
    /// FeatureOnlineStore.
    public var optimizedConfig: FeatureView.OptimizedConfig? = nil

    /// Optional. Service agent type used during data sync. By default, the Vertex
    /// AI Service Agent is used. When using an IAM Policy to isolate this
    /// FeatureView within a project, a separate service account should be
    /// provisioned by setting this field to `SERVICE_AGENT_TYPE_FEATURE_VIEW`.
    /// This will generate a separate service account to access the BigQuery source
    /// table.
    public var serviceAgentType: FeatureView.ServiceAgentType = FeatureView.ServiceAgentType()

    /// Output only. A Service Account unique to this FeatureView. The role
    /// bigquery.dataViewer should be granted to this service account to allow
    /// Vertex AI Feature Store to sync data to the online store.
    public var serviceAccountEmail: Swift.String = Swift.String()

    /// Output only. Reserved for future use.
    public var satisfiesPzs: Swift.Bool = Swift.Bool()

    /// Output only. Reserved for future use.
    public var satisfiesPzi: Swift.Bool = Swift.Bool()

    /// Metadata containing information about the Cloud Bigtable.
    public var bigtableMetadata: FeatureView.BigtableMetadata? = nil

    public var source: OneOf_Source? = nil

    /// Initialize a new instance of `FeatureView`.
    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 = FeatureView().with { $0.bigQuerySource = ... }
    /// ```
    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 bigQuerySource = "bigQuerySource"
      case featureRegistrySource = "featureRegistrySource"
      case vertexRagSource = "vertexRagSource"
      case name = "name"
      case createTime = "createTime"
      case updateTime = "updateTime"
      case etag = "etag"
      case labels = "labels"
      case syncConfig = "syncConfig"
      case indexConfig = "indexConfig"
      case optimizedConfig = "optimizedConfig"
      case serviceAgentType = "serviceAgentType"
      case serviceAccountEmail = "serviceAccountEmail"
      case satisfiesPzs = "satisfiesPzs"
      case satisfiesPzi = "satisfiesPzi"
      case bigtableMetadata = "bigtableMetadata"
    }

    public init(from decoder: Decoder) throws {
      let container = try decoder.container(keyedBy: CodingKeys.self)
      self.name = try container.decode(Swift.String.self, forKey: .name)
      self.createTime = try container.decodeIfPresent(
        GoogleCloudWkt.Timestamp.self, forKey: .createTime)
      self.updateTime = try container.decodeIfPresent(
        GoogleCloudWkt.Timestamp.self, forKey: .updateTime)
      self.etag = try container.decode(Swift.String.self, forKey: .etag)
      self.labels = try container.decode([Swift.String: Swift.String].self, forKey: .labels)
      self.syncConfig = try container.decodeIfPresent(
        FeatureView.SyncConfig.self, forKey: .syncConfig)
      self.indexConfig = try container.decodeIfPresent(
        FeatureView.IndexConfig.self, forKey: .indexConfig)
      self.optimizedConfig = try container.decodeIfPresent(
        FeatureView.OptimizedConfig.self, forKey: .optimizedConfig)
      self.serviceAgentType = try container.decode(
        FeatureView.ServiceAgentType.self, forKey: .serviceAgentType)
      self.serviceAccountEmail = try container.decode(
        Swift.String.self, forKey: .serviceAccountEmail)
      self.satisfiesPzs = try container.decode(Swift.Bool.self, forKey: .satisfiesPzs)
      self.satisfiesPzi = try container.decode(Swift.Bool.self, forKey: .satisfiesPzi)
      self.bigtableMetadata = try container.decodeIfPresent(
        FeatureView.BigtableMetadata.self, forKey: .bigtableMetadata)

      var source: OneOf_Source? = nil
      let sourceCheckAndSet = {
        if source != nil {
          throw DecodingError.dataCorrupted(
            DecodingError.Context(
              codingPath: decoder.codingPath,
              debugDescription: "Multiple values set for oneof 'source'"))
        }
        source = $0
      }
      if let bigQuerySource = try container.decodeIfPresent(
        FeatureView.BigQuerySource?.self, forKey: .bigQuerySource)
      {
        try sourceCheckAndSet(.bigQuerySource(bigQuerySource))
      }
      if let featureRegistrySource = try container.decodeIfPresent(
        FeatureView.FeatureRegistrySource?.self, forKey: .featureRegistrySource)
      {
        try sourceCheckAndSet(.featureRegistrySource(featureRegistrySource))
      }
      if let vertexRagSource = try container.decodeIfPresent(
        FeatureView.VertexRagSource?.self, forKey: .vertexRagSource)
      {
        try sourceCheckAndSet(.vertexRagSource(vertexRagSource))
      }
      self.source = source
    }

    public func encode(to encoder: Encoder) throws {
      var container = encoder.container(keyedBy: CodingKeys.self)
      try container.encode(self.name, forKey: .name)
      try container.encode(self.createTime, forKey: .createTime)
      try container.encode(self.updateTime, forKey: .updateTime)
      try container.encode(self.etag, forKey: .etag)
      try container.encode(self.labels, forKey: .labels)
      try container.encode(self.syncConfig, forKey: .syncConfig)
      try container.encode(self.indexConfig, forKey: .indexConfig)
      try container.encode(self.optimizedConfig, forKey: .optimizedConfig)
      try container.encode(self.serviceAgentType, forKey: .serviceAgentType)
      try container.encode(self.serviceAccountEmail, forKey: .serviceAccountEmail)
      try container.encode(self.satisfiesPzs, forKey: .satisfiesPzs)
      try container.encode(self.satisfiesPzi, forKey: .satisfiesPzi)
      try container.encode(self.bigtableMetadata, forKey: .bigtableMetadata)

      if let choice = self.source {
        switch choice {
        case .bigQuerySource(let value):
          try container.encode(value, forKey: .bigQuerySource)
        case .featureRegistrySource(let value):
          try container.encode(value, forKey: .featureRegistrySource)
        case .vertexRagSource(let value):
          try container.encode(value, forKey: .vertexRagSource)
        }
      }
    }

    public struct BigQuerySource: Codable, Equatable, GoogleCloudWkt._AnyPackable,
      Sendable
    {
      /// Required. The BigQuery view URI that will be materialized on each sync
      /// trigger based on FeatureView.SyncConfig.
      public var uri: Swift.String = Swift.String()

      /// Required. Columns to construct entity_id / row keys.
      public var entityIdColumns: [Swift.String] = []

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

    /// Configuration for Sync. Only one option is set.
    public struct SyncConfig: Codable, Equatable, GoogleCloudWkt._AnyPackable,
      Sendable
    {
      /// Cron schedule (https://en.wikipedia.org/wiki/Cron) to launch scheduled
      /// runs. To explicitly set a timezone to the cron tab, apply a prefix in
      /// the cron tab: "CRON_TZ=${IANA_TIME_ZONE}" or "TZ=${IANA_TIME_ZONE}".
      /// The ${IANA_TIME_ZONE} may only be a valid string from IANA time zone
      /// database. For example, "CRON_TZ=America/New_York 1 * * * *", or
      /// "TZ=America/New_York 1 * * * *".
      public var cron: Swift.String = Swift.String()

      /// Optional. If true, syncs the FeatureView in a continuous manner to Online
      /// Store.
      public var continuous: Swift.Bool = Swift.Bool()

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

    /// Configuration for vector indexing.
    public struct IndexConfig: Codable, Equatable, GoogleCloudWkt._AnyPackable,
      Sendable
    {
      /// Optional. Column of embedding. This column contains the source data to
      /// create index for vector search. embedding_column must be set when using
      /// vector search.
      public var embeddingColumn: Swift.String = Swift.String()

      /// Optional. Columns of features that're used to filter vector search
      /// results.
      public var filterColumns: [Swift.String] = []

      /// Optional. Column of crowding. This column contains crowding attribute
      /// which is a constraint on a neighbor list produced by
      /// [FeatureOnlineStoreService.SearchNearestEntities][google.cloud.aiplatform.v1.FeatureOnlineStoreService.SearchNearestEntities]
      /// to diversify search results. If
      /// [NearestNeighborQuery.per_crowding_attribute_neighbor_count][google.cloud.aiplatform.v1.NearestNeighborQuery.per_crowding_attribute_neighbor_count]
      /// is set to K in
      /// [SearchNearestEntitiesRequest][google.cloud.aiplatform.v1.SearchNearestEntitiesRequest],
      /// it's guaranteed that no more than K entities of the same crowding
      /// attribute are returned in the response.
      ///
      /// [google.cloud.aiplatform.v1.FeatureOnlineStoreService.SearchNearestEntities]: <doc:FeatureOnlineStoreService/searchNearestEntities(request:)>
      /// [google.cloud.aiplatform.v1.NearestNeighborQuery.per_crowding_attribute_neighbor_count]: <doc:NearestNeighborQuery/perCrowdingAttributeNeighborCount>
      /// [google.cloud.aiplatform.v1.SearchNearestEntitiesRequest]: <doc:SearchNearestEntitiesRequest>
      public var crowdingColumn: Swift.String = Swift.String()

      /// Optional. The number of dimensions of the input embedding.
      public var embeddingDimension: Swift.Int32? = nil

      /// Optional. The distance measure used in nearest neighbor search.
      public var distanceMeasureType: FeatureView.IndexConfig.DistanceMeasureType = FeatureView
        .IndexConfig.DistanceMeasureType()

      /// The configuration with regard to the algorithms used for efficient
      /// search.
      public var algorithmConfig: OneOf_AlgorithmConfig? = nil

      /// Initialize a new instance of `IndexConfig`.
      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 = IndexConfig().with { $0.treeAhConfig = ... }
      /// ```
      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 treeAhConfig = "treeAhConfig"
        case bruteForceConfig = "bruteForceConfig"
        case embeddingColumn = "embeddingColumn"
        case filterColumns = "filterColumns"
        case crowdingColumn = "crowdingColumn"
        case embeddingDimension = "embeddingDimension"
        case distanceMeasureType = "distanceMeasureType"
      }

      public init(from decoder: Decoder) throws {
        let container = try decoder.container(keyedBy: CodingKeys.self)
        self.embeddingColumn = try container.decode(Swift.String.self, forKey: .embeddingColumn)
        self.filterColumns = try container.decode([Swift.String].self, forKey: .filterColumns)
        self.crowdingColumn = try container.decode(Swift.String.self, forKey: .crowdingColumn)
        self.embeddingDimension = try container.decodeIfPresent(
          Swift.Int32.self, forKey: .embeddingDimension)
        self.distanceMeasureType = try container.decode(
          FeatureView.IndexConfig.DistanceMeasureType.self, forKey: .distanceMeasureType)

        var algorithmConfig: OneOf_AlgorithmConfig? = nil
        let algorithmConfigCheckAndSet = {
          if algorithmConfig != nil {
            throw DecodingError.dataCorrupted(
              DecodingError.Context(
                codingPath: decoder.codingPath,
                debugDescription: "Multiple values set for oneof 'algorithmConfig'"))
          }
          algorithmConfig = $0
        }
        if let treeAhConfig = try container.decodeIfPresent(
          FeatureView.IndexConfig.TreeAHConfig?.self, forKey: .treeAhConfig)
        {
          try algorithmConfigCheckAndSet(.treeAhConfig(treeAhConfig))
        }
        if let bruteForceConfig = try container.decodeIfPresent(
          FeatureView.IndexConfig.BruteForceConfig?.self, forKey: .bruteForceConfig)
        {
          try algorithmConfigCheckAndSet(.bruteForceConfig(bruteForceConfig))
        }
        self.algorithmConfig = algorithmConfig
      }

      public func encode(to encoder: Encoder) throws {
        var container = encoder.container(keyedBy: CodingKeys.self)
        try container.encode(self.embeddingColumn, forKey: .embeddingColumn)
        try container.encode(self.filterColumns, forKey: .filterColumns)
        try container.encode(self.crowdingColumn, forKey: .crowdingColumn)
        try container.encode(self.embeddingDimension, forKey: .embeddingDimension)
        try container.encode(self.distanceMeasureType, forKey: .distanceMeasureType)

        if let choice = self.algorithmConfig {
          switch choice {
          case .treeAhConfig(let value):
            try container.encode(value, forKey: .treeAhConfig)
          case .bruteForceConfig(let value):
            try container.encode(value, forKey: .bruteForceConfig)
          }
        }
      }

      /// Configuration options for using brute force search.
      public struct BruteForceConfig: Codable, Equatable, GoogleCloudWkt._AnyPackable,
        Sendable
      {
        /// Initialize a new instance of `BruteForceConfig`.
        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 = BruteForceConfig().with { $0.<placeholder> = ... }
        /// ```
        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.FeatureView.IndexConfig.BruteForceConfig"
        }
        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)
        }
      }

      /// Configuration options for the tree-AH algorithm.
      public struct TreeAHConfig: Codable, Equatable, GoogleCloudWkt._AnyPackable,
        Sendable
      {
        /// Optional. Number of embeddings on each leaf node. The default value is
        /// 1000 if not set.
        public var leafNodeEmbeddingCount: Swift.Int64? = nil

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

      /// The distance measure used in nearest neighbor search.
      public enum DistanceMeasureType: Codable, Equatable, Sendable {
        /// Should not be set.
        case unspecified
        /// Euclidean (L_2) Distance.
        case squaredL2Distance
        /// Cosine Distance. Defined as 1 - cosine similarity.
        ///
        /// We strongly suggest using DOT_PRODUCT_DISTANCE + UNIT_L2_NORM instead
        /// of COSINE distance. Our algorithms have been more optimized for
        /// DOT_PRODUCT distance which, when combined with UNIT_L2_NORM, is
        /// mathematically equivalent to COSINE distance and results in the same
        /// ranking.
        case cosineDistance
        /// Dot Product Distance. Defined as a negative of the dot product.
        case dotProductDistance
        /// Encodes an unknown integer value.
        ///
        /// The most common cause for an unknown values is for the service to send
        /// a value unknown to the library. We recommend you update your library to
        /// the latest version.
        case unknownIntValue(Int)
        /// Encodes an unknown string value.
        ///
        /// The most common cause for an unknown values is for the service to send
        /// a value unknown to the library. We recommend you update your library to
        /// the latest version.
        case unknownStringValue(String)

        public init() {
          self = .unspecified
        }

        /// Returns the integer value associated with the enumeration.
        ///
        /// If the enumeration was initialized with an unknown string value, this returns `nil`.
        public var intValue: Int? {
          switch self {
          case .unspecified: return 0
          case .squaredL2Distance: return 1
          case .cosineDistance: return 2
          case .dotProductDistance: return 3
          case .unknownIntValue(let v): return v
          case .unknownStringValue: return nil
          }
        }

        /// Returns the string value (or name) associated with the enumeration.
        ///
        /// If the enumeration was initialized with an unknown integer value, this returns `nil`.
        public var stringValue: Swift.String? {
          switch self {
          case .unspecified: return "DISTANCE_MEASURE_TYPE_UNSPECIFIED"
          case .squaredL2Distance: return "SQUARED_L2_DISTANCE"
          case .cosineDistance: return "COSINE_DISTANCE"
          case .dotProductDistance: return "DOT_PRODUCT_DISTANCE"
          case .unknownIntValue: return nil
          case .unknownStringValue(let v): return v
          }
        }

        /// Initialize from a string value.
        ///
        /// If the value is unknown, this initializes to [`unknownStringValue`](doc:DistanceMeasureType/unknownStringValue(_:)).
        public init(stringValue: Swift.String) {
          switch stringValue {
          case "DISTANCE_MEASURE_TYPE_UNSPECIFIED": self = .unspecified
          case "SQUARED_L2_DISTANCE": self = .squaredL2Distance
          case "COSINE_DISTANCE": self = .cosineDistance
          case "DOT_PRODUCT_DISTANCE": self = .dotProductDistance
          default: self = .unknownStringValue(stringValue)
          }
        }

        /// Initialize from an integer value.
        ///
        /// If the value is unknown, this initializes to [`unknownIntValue`](doc:DistanceMeasureType/unknownIntValue(_:)).
        public init(intValue: Int) {
          switch intValue {
          case 0: self = .unspecified
          case 1: self = .squaredL2Distance
          case 2: self = .cosineDistance
          case 3: self = .dotProductDistance
          default: self = .unknownIntValue(intValue)
          }
        }

        public init(from decoder: Decoder) throws {
          let container = try decoder.singleValueContainer()
          if let v = try? container.decode(Int.self) {
            self.init(intValue: v)
            return
          }
          if let s = try? container.decode(String.self) {
            if let v = Int(s) {
              self.init(intValue: v)
            } else {
              self.init(stringValue: s)
            }
            return
          }
          throw DecodingError.dataCorruptedError(
            in: container, debugDescription: "Expected enum value, must be integer or string.")
        }

        public func encode(to encoder: Encoder) throws {
          var container = encoder.singleValueContainer()
          switch self {
          case .unspecified: return try container.encode(0)
          case .squaredL2Distance: return try container.encode(1)
          case .cosineDistance: return try container.encode(2)
          case .dotProductDistance: return try container.encode(3)
          case .unknownIntValue(let v): return try container.encode(v)
          case .unknownStringValue(let v): return try container.encode(v)
          }
        }
      }

      /// The configuration with regard to the algorithms used for efficient
      /// search.
      public enum OneOf_AlgorithmConfig: Codable, Equatable, Sendable {
        /// Optional. Configuration options for the tree-AH algorithm (Shallow tree
        /// + Asymmetric Hashing). Please refer to this paper for more details:
        /// https://arxiv.org/abs/1908.10396
        indirect case treeAhConfig(FeatureView.IndexConfig.TreeAHConfig?)
        /// Optional. Configuration options for using brute force search, which
        /// simply implements the standard linear search in the database for each
        /// query. It is primarily meant for benchmarking and to generate the
        /// ground truth for approximate search.
        indirect case bruteForceConfig(FeatureView.IndexConfig.BruteForceConfig?)
      }

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

    /// A Feature Registry source for features that need to be synced to Online
    /// Store.
    public struct FeatureRegistrySource: Codable, Equatable, GoogleCloudWkt._AnyPackable,
      Sendable
    {
      /// Required. List of features that need to be synced to Online Store.
      public var featureGroups: [FeatureView.FeatureRegistrySource.FeatureGroup] = []

      /// Optional. The project number of the parent project of the Feature Groups.
      public var projectNumber: Swift.Int64? = nil

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

      /// Features belonging to a single feature group that will be
      /// synced to Online Store.
      public struct FeatureGroup: Codable, Equatable, GoogleCloudWkt._AnyPackable,
        Sendable
      {
        /// Required. Identifier of the feature group.
        public var featureGroupId: Swift.String = Swift.String()

        /// Required. Identifiers of features under the feature group.
        public var featureIds: [Swift.String] = []

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

    /// A Vertex Rag source for features that need to be synced to Online
    /// Store.
    public struct VertexRagSource: Codable, Equatable, GoogleCloudWkt._AnyPackable,
      Sendable
    {
      /// Required. The BigQuery view/table URI that will be materialized on each
      /// manual sync trigger. The table/view is expected to have the following
      /// columns and types at least:
      ///  - `corpus_id` (STRING, NULLABLE/REQUIRED)
      ///  - `file_id` (STRING, NULLABLE/REQUIRED)
      ///  - `chunk_id` (STRING, NULLABLE/REQUIRED)
      ///  - `chunk_data_type` (STRING, NULLABLE/REQUIRED)
      ///  - `chunk_data` (STRING, NULLABLE/REQUIRED)
      ///  - `embeddings` (FLOAT, REPEATED)
      ///  - `file_original_uri` (STRING, NULLABLE/REQUIRED)
      public var uri: Swift.String = Swift.String()

      /// Optional. The RAG corpus id corresponding to this FeatureView.
      public var ragCorpusId: Swift.Int64 = Swift.Int64()

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

    /// Configuration for FeatureViews created in Optimized FeatureOnlineStore.
    public struct OptimizedConfig: Codable, Equatable, GoogleCloudWkt._AnyPackable,
      Sendable
    {
      /// Optional. A description of resources that the FeatureView uses, which to
      /// large degree are decided by Vertex AI, and optionally allows only a
      /// modest additional configuration. If min_replica_count is not set, the
      /// default value is 2. If max_replica_count is not set, the default value
      /// is 6. The max allowed replica count is 1000.
      public var automaticResources: AutomaticResources? = nil

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

    /// Metadata for the Cloud Bigtable that supports directly interacting Bigtable
    /// instances.
    public struct BigtableMetadata: Codable, Equatable, GoogleCloudWkt._AnyPackable,
      Sendable
    {
      /// The Bigtable App Profile to use for reading from Bigtable.
      public var readAppProfile: Swift.String = Swift.String()

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

    /// Service agent type used during data sync.
    public enum ServiceAgentType: Codable, Equatable, Sendable {
      /// By default, the project-level Vertex AI Service Agent is enabled.
      case unspecified
      /// Indicates the project-level Vertex AI Service Agent
      /// (https://cloud.google.com/vertex-ai/docs/general/access-control#service-agents)
      /// will be used during sync jobs.
      case project
      /// Enable a FeatureView service account to be created by Vertex AI and
      /// output in the field `service_account_email`. This service account will
      /// be used to read from the source BigQuery table during sync.
      case featureView
      /// Encodes an unknown integer value.
      ///
      /// The most common cause for an unknown values is for the service to send
      /// a value unknown to the library. We recommend you update your library to
      /// the latest version.
      case unknownIntValue(Int)
      /// Encodes an unknown string value.
      ///
      /// The most common cause for an unknown values is for the service to send
      /// a value unknown to the library. We recommend you update your library to
      /// the latest version.
      case unknownStringValue(String)

      public init() {
        self = .unspecified
      }

      /// Returns the integer value associated with the enumeration.
      ///
      /// If the enumeration was initialized with an unknown string value, this returns `nil`.
      public var intValue: Int? {
        switch self {
        case .unspecified: return 0
        case .project: return 1
        case .featureView: return 2
        case .unknownIntValue(let v): return v
        case .unknownStringValue: return nil
        }
      }

      /// Returns the string value (or name) associated with the enumeration.
      ///
      /// If the enumeration was initialized with an unknown integer value, this returns `nil`.
      public var stringValue: Swift.String? {
        switch self {
        case .unspecified: return "SERVICE_AGENT_TYPE_UNSPECIFIED"
        case .project: return "SERVICE_AGENT_TYPE_PROJECT"
        case .featureView: return "SERVICE_AGENT_TYPE_FEATURE_VIEW"
        case .unknownIntValue: return nil
        case .unknownStringValue(let v): return v
        }
      }

      /// Initialize from a string value.
      ///
      /// If the value is unknown, this initializes to [`unknownStringValue`](doc:ServiceAgentType/unknownStringValue(_:)).
      public init(stringValue: Swift.String) {
        switch stringValue {
        case "SERVICE_AGENT_TYPE_UNSPECIFIED": self = .unspecified
        case "SERVICE_AGENT_TYPE_PROJECT": self = .project
        case "SERVICE_AGENT_TYPE_FEATURE_VIEW": self = .featureView
        default: self = .unknownStringValue(stringValue)
        }
      }

      /// Initialize from an integer value.
      ///
      /// If the value is unknown, this initializes to [`unknownIntValue`](doc:ServiceAgentType/unknownIntValue(_:)).
      public init(intValue: Int) {
        switch intValue {
        case 0: self = .unspecified
        case 1: self = .project
        case 2: self = .featureView
        default: self = .unknownIntValue(intValue)
        }
      }

      public init(from decoder: Decoder) throws {
        let container = try decoder.singleValueContainer()
        if let v = try? container.decode(Int.self) {
          self.init(intValue: v)
          return
        }
        if let s = try? container.decode(String.self) {
          if let v = Int(s) {
            self.init(intValue: v)
          } else {
            self.init(stringValue: s)
          }
          return
        }
        throw DecodingError.dataCorruptedError(
          in: container, debugDescription: "Expected enum value, must be integer or string.")
      }

      public func encode(to encoder: Encoder) throws {
        var container = encoder.singleValueContainer()
        switch self {
        case .unspecified: return try container.encode(0)
        case .project: return try container.encode(1)
        case .featureView: return try container.encode(2)
        case .unknownIntValue(let v): return try container.encode(v)
        case .unknownStringValue(let v): return try container.encode(v)
        }
      }
    }

    public enum OneOf_Source: Codable, Equatable, Sendable {
      /// Optional. Configures how data is supposed to be extracted from a BigQuery
      /// source to be loaded onto the FeatureOnlineStore.
      indirect case bigQuerySource(FeatureView.BigQuerySource?)
      /// Optional. Configures the features from a Feature Registry source that
      /// need to be loaded onto the FeatureOnlineStore.
      indirect case featureRegistrySource(FeatureView.FeatureRegistrySource?)
      /// Optional. The Vertex RAG Source that the FeatureView is linked to.
      indirect case vertexRagSource(FeatureView.VertexRagSource?)
    }

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