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

/// LINT.IfChange(data_sources)
public enum DataSource: Codable, Equatable, Sendable {
  case unspecified
  case udm
  case entity
  case ingestionMetrics
  /// RULE_DETECTIONS is used for detections datasource.
  case ruleDetections
  /// RULESETS is used for ruleset with detections datasource.
  case rulesets
  /// GLOBAL is used for standard time range filter.
  case global
  /// IOC_MATCHES is used for ioc_matches datasource.
  case iocMatches
  /// RULES is used for rules datasource.
  case rules
  /// SOAR Cases - identified as `case`.
  case soarCases
  /// SOAR Playbooks - identified as `playbook`.
  case soarPlaybooks
  /// SOAR Case History - identified as `case_history`.
  case soarCaseHistory
  /// DATA_TABLE is used for data tables source.
  case dataTable
  /// INVESTIGATION is used as the data source for triage agent investigations.
  /// Identified as `gemini_investigation`.
  case investigation
  /// INVESTIGATION_FEEDBACK is used as the data source for user feedback on
  /// triage agent investigations. Identified as `gemini_investigation_feedback`.
  case investigationFeedback
  /// 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 .udm: return 1
    case .entity: return 2
    case .ingestionMetrics: return 3
    case .ruleDetections: return 4
    case .rulesets: return 5
    case .global: return 6
    case .iocMatches: return 7
    case .rules: return 8
    case .soarCases: return 9
    case .soarPlaybooks: return 10
    case .soarCaseHistory: return 11
    case .dataTable: return 12
    case .investigation: return 13
    case .investigationFeedback: return 14
    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 "DATA_SOURCE_UNSPECIFIED"
    case .udm: return "UDM"
    case .entity: return "ENTITY"
    case .ingestionMetrics: return "INGESTION_METRICS"
    case .ruleDetections: return "RULE_DETECTIONS"
    case .rulesets: return "RULESETS"
    case .global: return "GLOBAL"
    case .iocMatches: return "IOC_MATCHES"
    case .rules: return "RULES"
    case .soarCases: return "SOAR_CASES"
    case .soarPlaybooks: return "SOAR_PLAYBOOKS"
    case .soarCaseHistory: return "SOAR_CASE_HISTORY"
    case .dataTable: return "DATA_TABLE"
    case .investigation: return "INVESTIGATION"
    case .investigationFeedback: return "INVESTIGATION_FEEDBACK"
    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:DataSource/unknownStringValue(_:)).
  public init(stringValue: Swift.String) {
    switch stringValue {
    case "DATA_SOURCE_UNSPECIFIED": self = .unspecified
    case "UDM": self = .udm
    case "ENTITY": self = .entity
    case "INGESTION_METRICS": self = .ingestionMetrics
    case "RULE_DETECTIONS": self = .ruleDetections
    case "RULESETS": self = .rulesets
    case "GLOBAL": self = .global
    case "IOC_MATCHES": self = .iocMatches
    case "RULES": self = .rules
    case "SOAR_CASES": self = .soarCases
    case "SOAR_PLAYBOOKS": self = .soarPlaybooks
    case "SOAR_CASE_HISTORY": self = .soarCaseHistory
    case "DATA_TABLE": self = .dataTable
    case "INVESTIGATION": self = .investigation
    case "INVESTIGATION_FEEDBACK": self = .investigationFeedback
    default: self = .unknownStringValue(stringValue)
    }
  }

  /// Initialize from an integer value.
  ///
  /// If the value is unknown, this initializes to [`unknownIntValue`](doc:DataSource/unknownIntValue(_:)).
  public init(intValue: Int) {
    switch intValue {
    case 0: self = .unspecified
    case 1: self = .udm
    case 2: self = .entity
    case 3: self = .ingestionMetrics
    case 4: self = .ruleDetections
    case 5: self = .rulesets
    case 6: self = .global
    case 7: self = .iocMatches
    case 8: self = .rules
    case 9: self = .soarCases
    case 10: self = .soarPlaybooks
    case 11: self = .soarCaseHistory
    case 12: self = .dataTable
    case 13: self = .investigation
    case 14: self = .investigationFeedback
    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 .udm: return try container.encode(1)
    case .entity: return try container.encode(2)
    case .ingestionMetrics: return try container.encode(3)
    case .ruleDetections: return try container.encode(4)
    case .rulesets: return try container.encode(5)
    case .global: return try container.encode(6)
    case .iocMatches: return try container.encode(7)
    case .rules: return try container.encode(8)
    case .soarCases: return try container.encode(9)
    case .soarPlaybooks: return try container.encode(10)
    case .soarCaseHistory: return try container.encode(11)
    case .dataTable: return try container.encode(12)
    case .investigation: return try container.encode(13)
    case .investigationFeedback: return try container.encode(14)
    case .unknownIntValue(let v): return try container.encode(v)
    case .unknownStringValue(let v): return try container.encode(v)
    }
  }
}
