// 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.

import Foundation

/// Metadata automatically ingested from Google Cloud resources like BigQuery
/// tables or Pub/Sub topics always uses enum values from `EntryType` as the type
/// of entry.
///
/// Other sources of metadata like Hive or Oracle databases can identify the type
/// by either using one of the enum values from `EntryType` (for example,
/// `FILESET` for a Cloud Storage fileset) or specifying a custom value using
/// the [`Entry`](#resource:-entry) field `user_specified_type`. For more
/// information, see
/// [Surface files from Cloud Storage with fileset
/// entries](/data-catalog/docs/how-to/filesets) or [Create custom entries for
/// your data sources](/data-catalog/docs/how-to/custom-entries).
public enum EntryType: Codable, Equatable, Sendable {
  /// Default unknown type.
  case unspecified
  /// The entry type that has a GoogleSQL schema, including
  /// logical views.
  case table
  /// An entry type for streaming entries. For example, a Pub/Sub topic.
  case dataStream
  /// An entry type for a set of files or objects. For example, a
  /// Cloud Storage fileset.
  case fileset
  /// The type of models.
  ///
  /// For more information, see [Supported models in BigQuery
  /// ML](/bigquery/docs/bqml-introduction#supported_models).
  case model
  /// A group of servers that work together. For example, a Kafka cluster.
  case cluster
  /// A database.
  case database
  /// Connection to a data source. For example, a BigQuery
  /// connection.
  case dataSourceConnection
  /// Routine, for example, a BigQuery routine.
  case routine
  /// A Dataplex lake.
  case lake
  /// A Dataplex zone.
  case zone
  /// A service, for example, a Dataproc Metastore service.
  case service
  /// Schema within a relational database.
  case databaseSchema
  /// A Dashboard, for example from Looker.
  case dashboard
  /// A Looker Explore.
  ///
  /// For more information, see [Looker Explore API]
  /// (https://developers.looker.com/api/explorer/4.0/methods/LookmlModel/lookml_model_explore).
  case explore
  /// A Looker Look.
  ///
  /// For more information, see [Looker Look API]
  /// (https://developers.looker.com/api/explorer/4.0/methods/Look).
  case look
  /// Feature Online Store resource in Vertex AI Feature Store.
  case featureOnlineStore
  /// Feature View resource in Vertex AI Feature Store.
  case featureView
  /// Feature Group resource in Vertex AI Feature Store.
  case featureGroup
  /// 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 .table: return 2
    case .dataStream: return 3
    case .fileset: return 4
    case .model: return 5
    case .cluster: return 6
    case .database: return 7
    case .dataSourceConnection: return 8
    case .routine: return 9
    case .lake: return 10
    case .zone: return 11
    case .service: return 14
    case .databaseSchema: return 15
    case .dashboard: return 16
    case .explore: return 17
    case .look: return 18
    case .featureOnlineStore: return 19
    case .featureView: return 20
    case .featureGroup: return 21
    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 "ENTRY_TYPE_UNSPECIFIED"
    case .table: return "TABLE"
    case .dataStream: return "DATA_STREAM"
    case .fileset: return "FILESET"
    case .model: return "MODEL"
    case .cluster: return "CLUSTER"
    case .database: return "DATABASE"
    case .dataSourceConnection: return "DATA_SOURCE_CONNECTION"
    case .routine: return "ROUTINE"
    case .lake: return "LAKE"
    case .zone: return "ZONE"
    case .service: return "SERVICE"
    case .databaseSchema: return "DATABASE_SCHEMA"
    case .dashboard: return "DASHBOARD"
    case .explore: return "EXPLORE"
    case .look: return "LOOK"
    case .featureOnlineStore: return "FEATURE_ONLINE_STORE"
    case .featureView: return "FEATURE_VIEW"
    case .featureGroup: return "FEATURE_GROUP"
    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:EntryType/unknownStringValue(_:)).
  public init(stringValue: Swift.String) {
    switch stringValue {
    case "ENTRY_TYPE_UNSPECIFIED": self = .unspecified
    case "TABLE": self = .table
    case "MODEL": self = .model
    case "DATA_STREAM": self = .dataStream
    case "FILESET": self = .fileset
    case "CLUSTER": self = .cluster
    case "DATABASE": self = .database
    case "DATA_SOURCE_CONNECTION": self = .dataSourceConnection
    case "ROUTINE": self = .routine
    case "LAKE": self = .lake
    case "ZONE": self = .zone
    case "SERVICE": self = .service
    case "DATABASE_SCHEMA": self = .databaseSchema
    case "DASHBOARD": self = .dashboard
    case "EXPLORE": self = .explore
    case "LOOK": self = .look
    case "FEATURE_ONLINE_STORE": self = .featureOnlineStore
    case "FEATURE_VIEW": self = .featureView
    case "FEATURE_GROUP": self = .featureGroup
    default: self = .unknownStringValue(stringValue)
    }
  }

  /// Initialize from an integer value.
  ///
  /// If the value is unknown, this initializes to [`unknownIntValue`](doc:EntryType/unknownIntValue(_:)).
  public init(intValue: Int) {
    switch intValue {
    case 0: self = .unspecified
    case 2: self = .table
    case 3: self = .dataStream
    case 4: self = .fileset
    case 5: self = .model
    case 6: self = .cluster
    case 7: self = .database
    case 8: self = .dataSourceConnection
    case 9: self = .routine
    case 10: self = .lake
    case 11: self = .zone
    case 14: self = .service
    case 15: self = .databaseSchema
    case 16: self = .dashboard
    case 17: self = .explore
    case 18: self = .look
    case 19: self = .featureOnlineStore
    case 20: self = .featureView
    case 21: self = .featureGroup
    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 .table: return try container.encode(2)
    case .dataStream: return try container.encode(3)
    case .fileset: return try container.encode(4)
    case .model: return try container.encode(5)
    case .cluster: return try container.encode(6)
    case .database: return try container.encode(7)
    case .dataSourceConnection: return try container.encode(8)
    case .routine: return try container.encode(9)
    case .lake: return try container.encode(10)
    case .zone: return try container.encode(11)
    case .service: return try container.encode(14)
    case .databaseSchema: return try container.encode(15)
    case .dashboard: return try container.encode(16)
    case .explore: return try container.encode(17)
    case .look: return try container.encode(18)
    case .featureOnlineStore: return try container.encode(19)
    case .featureView: return try container.encode(20)
    case .featureGroup: return try container.encode(21)
    case .unknownIntValue(let v): return try container.encode(v)
    case .unknownStringValue(let v): return try container.encode(v)
    }
  }
}
