// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
import Foundation
import azureSwiftRuntime
internal struct LogSettingsData : LogSettingsProtocol {
    public var category: String?
    public var enabled: Bool
    public var retentionPolicy: RetentionPolicyProtocol?

        enum CodingKeys: String, CodingKey {case category = "category"
        case enabled = "enabled"
        case retentionPolicy = "retentionPolicy"
        }

  public init(enabled: Bool)  {
    self.enabled = enabled
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.category) {
        self.category = try container.decode(String?.self, forKey: .category)
    }
    self.enabled = try container.decode(Bool.self, forKey: .enabled)
    if container.contains(.retentionPolicy) {
        self.retentionPolicy = try container.decode(RetentionPolicyData?.self, forKey: .retentionPolicy)
    }
    if var pageDecoder = decoder as? PageDecoder  {
      if pageDecoder.isPagedData,
        let nextLinkName = pageDecoder.nextLinkName {
          pageDecoder.nextLink = try UnknownCodingKey.decodeStringForKey(decoder: decoder, keyForDecode: nextLinkName)
      }
    }
  }

  public func encode(to encoder: Encoder) throws {
    var container = encoder.container(keyedBy: CodingKeys.self)
    if self.category != nil {try container.encode(self.category, forKey: .category)}
    try container.encode(self.enabled, forKey: .enabled)
    if self.retentionPolicy != nil {try container.encode(self.retentionPolicy as! RetentionPolicyData?, forKey: .retentionPolicy)}
  }
}

extension DataFactory {
  public static func createLogSettingsProtocol(enabled: Bool) -> LogSettingsProtocol {
    return LogSettingsData(enabled: enabled)
  }
}


// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
import Foundation
import azureSwiftRuntime
internal struct ManagementEventAggregationConditionData : ManagementEventAggregationConditionProtocol {
    public var _operator: ConditionOperatorEnum?
    public var threshold: Double?
    public var windowSize: String?

        enum CodingKeys: String, CodingKey {case _operator = "operator"
        case threshold = "threshold"
        case windowSize = "windowSize"
        }

  public init()  {
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(._operator) {
        self._operator = try container.decode(ConditionOperatorEnum?.self, forKey: ._operator)
    }
    if container.contains(.threshold) {
        self.threshold = try container.decode(Double?.self, forKey: .threshold)
    }
    if container.contains(.windowSize) {
        self.windowSize = try container.decode(String?.self, forKey: .windowSize)
    }
    if var pageDecoder = decoder as? PageDecoder  {
      if pageDecoder.isPagedData,
        let nextLinkName = pageDecoder.nextLinkName {
          pageDecoder.nextLink = try UnknownCodingKey.decodeStringForKey(decoder: decoder, keyForDecode: nextLinkName)
      }
    }
  }

  public func encode(to encoder: Encoder) throws {
    var container = encoder.container(keyedBy: CodingKeys.self)
    if self._operator != nil {try container.encode(self._operator, forKey: ._operator)}
    if self.threshold != nil {try container.encode(self.threshold, forKey: .threshold)}
    if self.windowSize != nil {try container.encode(self.windowSize, forKey: .windowSize)}
  }
}

extension DataFactory {
  public static func createManagementEventAggregationConditionProtocol() -> ManagementEventAggregationConditionProtocol {
    return ManagementEventAggregationConditionData()
  }
}


// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
import Foundation
import azureSwiftRuntime
internal struct ManagementEventRuleConditionData : ManagementEventRuleConditionProtocol, RuleConditionProtocol {
    public var dataSource: RuleDataSourceProtocol?
    public var aggregation: ManagementEventAggregationConditionProtocol?

        enum CodingKeys: String, CodingKey {case dataSource = "dataSource"
        case aggregation = "aggregation"
        }

  public init()  {
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.dataSource) {
        self.dataSource = try container.decode(RuleDataSourceData?.self, forKey: .dataSource)
    }
    if container.contains(.aggregation) {
        self.aggregation = try container.decode(ManagementEventAggregationConditionData?.self, forKey: .aggregation)
    }
    if var pageDecoder = decoder as? PageDecoder  {
      if pageDecoder.isPagedData,
        let nextLinkName = pageDecoder.nextLinkName {
          pageDecoder.nextLink = try UnknownCodingKey.decodeStringForKey(decoder: decoder, keyForDecode: nextLinkName)
      }
    }
  }

  public func encode(to encoder: Encoder) throws {
    var container = encoder.container(keyedBy: CodingKeys.self)
    if self.dataSource != nil {try container.encode(self.dataSource as! RuleDataSourceData?, forKey: .dataSource)}
    if self.aggregation != nil {try container.encode(self.aggregation as! ManagementEventAggregationConditionData?, forKey: .aggregation)}
  }
}

extension DataFactory {
  public static func createManagementEventRuleConditionProtocol() -> ManagementEventRuleConditionProtocol {
    return ManagementEventRuleConditionData()
  }
}


// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
import Foundation
import azureSwiftRuntime
internal struct MetadataValueData : MetadataValueProtocol {
    public var name: LocalizableStringProtocol?
    public var value: String?

        enum CodingKeys: String, CodingKey {case name = "name"
        case value = "value"
        }

  public init()  {
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.name) {
        self.name = try container.decode(LocalizableStringData?.self, forKey: .name)
    }
    if container.contains(.value) {
        self.value = try container.decode(String?.self, forKey: .value)
    }
    if var pageDecoder = decoder as? PageDecoder  {
      if pageDecoder.isPagedData,
        let nextLinkName = pageDecoder.nextLinkName {
          pageDecoder.nextLink = try UnknownCodingKey.decodeStringForKey(decoder: decoder, keyForDecode: nextLinkName)
      }
    }
  }

  public func encode(to encoder: Encoder) throws {
    var container = encoder.container(keyedBy: CodingKeys.self)
    if self.name != nil {try container.encode(self.name as! LocalizableStringData?, forKey: .name)}
    if self.value != nil {try container.encode(self.value, forKey: .value)}
  }
}

extension DataFactory {
  public static func createMetadataValueProtocol() -> MetadataValueProtocol {
    return MetadataValueData()
  }
}


// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
import Foundation
import azureSwiftRuntime
internal struct MetricAvailabilityData : MetricAvailabilityProtocol {
    public var timeGrain: String?
    public var retention: String?

        enum CodingKeys: String, CodingKey {case timeGrain = "timeGrain"
        case retention = "retention"
        }

  public init()  {
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.timeGrain) {
        self.timeGrain = try container.decode(String?.self, forKey: .timeGrain)
    }
    if container.contains(.retention) {
        self.retention = try container.decode(String?.self, forKey: .retention)
    }
    if var pageDecoder = decoder as? PageDecoder  {
      if pageDecoder.isPagedData,
        let nextLinkName = pageDecoder.nextLinkName {
          pageDecoder.nextLink = try UnknownCodingKey.decodeStringForKey(decoder: decoder, keyForDecode: nextLinkName)
      }
    }
  }

  public func encode(to encoder: Encoder) throws {
    var container = encoder.container(keyedBy: CodingKeys.self)
    if self.timeGrain != nil {try container.encode(self.timeGrain, forKey: .timeGrain)}
    if self.retention != nil {try container.encode(self.retention, forKey: .retention)}
  }
}

extension DataFactory {
  public static func createMetricAvailabilityProtocol() -> MetricAvailabilityProtocol {
    return MetricAvailabilityData()
  }
}


// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
import Foundation
import azureSwiftRuntime
internal struct MetricData : MetricProtocol {
    public var id: String
    public var type: String
    public var name: LocalizableStringProtocol
    public var unit: UnitEnum
    public var timeseries: [TimeSeriesElementProtocol]

        enum CodingKeys: String, CodingKey {case id = "id"
        case type = "type"
        case name = "name"
        case unit = "unit"
        case timeseries = "timeseries"
        }

  public init(id: String, type: String, name: LocalizableStringProtocol, unit: UnitEnum, timeseries: [TimeSeriesElementProtocol])  {
    self.id = id
    self.type = type
    self.name = name
    self.unit = unit
    self.timeseries = timeseries
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      self.id = try container.decode(String.self, forKey: .id)
    self.type = try container.decode(String.self, forKey: .type)
    self.name = try container.decode(LocalizableStringData.self, forKey: .name)
    self.unit = try container.decode(UnitEnum.self, forKey: .unit)
    self.timeseries = try container.decode([TimeSeriesElementData].self, forKey: .timeseries)
    if var pageDecoder = decoder as? PageDecoder  {
      if pageDecoder.isPagedData,
        let nextLinkName = pageDecoder.nextLinkName {
          pageDecoder.nextLink = try UnknownCodingKey.decodeStringForKey(decoder: decoder, keyForDecode: nextLinkName)
      }
    }
  }

  public func encode(to encoder: Encoder) throws {
    var container = encoder.container(keyedBy: CodingKeys.self)
    try container.encode(self.id, forKey: .id)
    try container.encode(self.type, forKey: .type)
    try container.encode(self.name as! LocalizableStringData, forKey: .name)
    try container.encode(self.unit, forKey: .unit)
    try container.encode(self.timeseries as! [TimeSeriesElementData], forKey: .timeseries)
  }
}

extension DataFactory {
  public static func createMetricProtocol(id: String, type: String, name: LocalizableStringProtocol, unit: UnitEnum, timeseries: [TimeSeriesElementProtocol]) -> MetricProtocol {
    return MetricData(id: id, type: type, name: name, unit: unit, timeseries: timeseries)
  }
}


// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
import Foundation
import azureSwiftRuntime
internal struct MetricDefinitionCollectionData : MetricDefinitionCollectionProtocol {
    public var value: [MetricDefinitionProtocol]

        enum CodingKeys: String, CodingKey {case value = "value"
        }

  public init(value: [MetricDefinitionProtocol])  {
    self.value = value
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      self.value = try container.decode([MetricDefinitionData].self, forKey: .value)
    if var pageDecoder = decoder as? PageDecoder  {
      if pageDecoder.isPagedData,
        let nextLinkName = pageDecoder.nextLinkName {
          pageDecoder.nextLink = try UnknownCodingKey.decodeStringForKey(decoder: decoder, keyForDecode: nextLinkName)
      }
    }
  }

  public func encode(to encoder: Encoder) throws {
    var container = encoder.container(keyedBy: CodingKeys.self)
    try container.encode(self.value as! [MetricDefinitionData], forKey: .value)
  }
}

extension DataFactory {
  public static func createMetricDefinitionCollectionProtocol(value: [MetricDefinitionProtocol]) -> MetricDefinitionCollectionProtocol {
    return MetricDefinitionCollectionData(value: value)
  }
}


// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
import Foundation
import azureSwiftRuntime
internal struct MetricDefinitionData : MetricDefinitionProtocol {
    public var isDimensionRequired: Bool?
    public var resourceId: String?
    public var namespace: String?
    public var name: LocalizableStringProtocol?
    public var unit: UnitEnum?
    public var primaryAggregationType: AggregationTypeEnum?
    public var supportedAggregationTypes: [AggregationTypeEnum?]?
    public var metricAvailabilities: [MetricAvailabilityProtocol?]?
    public var id: String?
    public var dimensions: [LocalizableStringProtocol?]?

        enum CodingKeys: String, CodingKey {case isDimensionRequired = "isDimensionRequired"
        case resourceId = "resourceId"
        case namespace = "namespace"
        case name = "name"
        case unit = "unit"
        case primaryAggregationType = "primaryAggregationType"
        case supportedAggregationTypes = "supportedAggregationTypes"
        case metricAvailabilities = "metricAvailabilities"
        case id = "id"
        case dimensions = "dimensions"
        }

  public init()  {
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.isDimensionRequired) {
        self.isDimensionRequired = try container.decode(Bool?.self, forKey: .isDimensionRequired)
    }
    if container.contains(.resourceId) {
        self.resourceId = try container.decode(String?.self, forKey: .resourceId)
    }
    if container.contains(.namespace) {
        self.namespace = try container.decode(String?.self, forKey: .namespace)
    }
    if container.contains(.name) {
        self.name = try container.decode(LocalizableStringData?.self, forKey: .name)
    }
    if container.contains(.unit) {
        self.unit = try container.decode(UnitEnum?.self, forKey: .unit)
    }
    if container.contains(.primaryAggregationType) {
        self.primaryAggregationType = try container.decode(AggregationTypeEnum?.self, forKey: .primaryAggregationType)
    }
    if container.contains(.supportedAggregationTypes) {
        self.supportedAggregationTypes = try container.decode([AggregationTypeEnum?]?.self, forKey: .supportedAggregationTypes)
    }
    if container.contains(.metricAvailabilities) {
        self.metricAvailabilities = try container.decode([MetricAvailabilityData?]?.self, forKey: .metricAvailabilities)
    }
    if container.contains(.id) {
        self.id = try container.decode(String?.self, forKey: .id)
    }
    if container.contains(.dimensions) {
        self.dimensions = try container.decode([LocalizableStringData?]?.self, forKey: .dimensions)
    }
    if var pageDecoder = decoder as? PageDecoder  {
      if pageDecoder.isPagedData,
        let nextLinkName = pageDecoder.nextLinkName {
          pageDecoder.nextLink = try UnknownCodingKey.decodeStringForKey(decoder: decoder, keyForDecode: nextLinkName)
      }
    }
  }

  public func encode(to encoder: Encoder) throws {
    var container = encoder.container(keyedBy: CodingKeys.self)
    if self.isDimensionRequired != nil {try container.encode(self.isDimensionRequired, forKey: .isDimensionRequired)}
    if self.resourceId != nil {try container.encode(self.resourceId, forKey: .resourceId)}
    if self.namespace != nil {try container.encode(self.namespace, forKey: .namespace)}
    if self.name != nil {try container.encode(self.name as! LocalizableStringData?, forKey: .name)}
    if self.unit != nil {try container.encode(self.unit, forKey: .unit)}
    if self.primaryAggregationType != nil {try container.encode(self.primaryAggregationType, forKey: .primaryAggregationType)}
    if self.supportedAggregationTypes != nil {try container.encode(self.supportedAggregationTypes as! [AggregationTypeEnum?]?, forKey: .supportedAggregationTypes)}
    if self.metricAvailabilities != nil {try container.encode(self.metricAvailabilities as! [MetricAvailabilityData?]?, forKey: .metricAvailabilities)}
    if self.id != nil {try container.encode(self.id, forKey: .id)}
    if self.dimensions != nil {try container.encode(self.dimensions as! [LocalizableStringData?]?, forKey: .dimensions)}
  }
}

extension DataFactory {
  public static func createMetricDefinitionProtocol() -> MetricDefinitionProtocol {
    return MetricDefinitionData()
  }
}


// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
import Foundation
import azureSwiftRuntime
internal struct MetricSettingsData : MetricSettingsProtocol {
    public var timeGrain: String?
    public var category: String?
    public var enabled: Bool
    public var retentionPolicy: RetentionPolicyProtocol?

        enum CodingKeys: String, CodingKey {case timeGrain = "timeGrain"
        case category = "category"
        case enabled = "enabled"
        case retentionPolicy = "retentionPolicy"
        }

  public init(enabled: Bool)  {
    self.enabled = enabled
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.timeGrain) {
        self.timeGrain = try container.decode(String?.self, forKey: .timeGrain)
    }
    if container.contains(.category) {
        self.category = try container.decode(String?.self, forKey: .category)
    }
    self.enabled = try container.decode(Bool.self, forKey: .enabled)
    if container.contains(.retentionPolicy) {
        self.retentionPolicy = try container.decode(RetentionPolicyData?.self, forKey: .retentionPolicy)
    }
    if var pageDecoder = decoder as? PageDecoder  {
      if pageDecoder.isPagedData,
        let nextLinkName = pageDecoder.nextLinkName {
          pageDecoder.nextLink = try UnknownCodingKey.decodeStringForKey(decoder: decoder, keyForDecode: nextLinkName)
      }
    }
  }

  public func encode(to encoder: Encoder) throws {
    var container = encoder.container(keyedBy: CodingKeys.self)
    if self.timeGrain != nil {try container.encode(self.timeGrain, forKey: .timeGrain)}
    if self.category != nil {try container.encode(self.category, forKey: .category)}
    try container.encode(self.enabled, forKey: .enabled)
    if self.retentionPolicy != nil {try container.encode(self.retentionPolicy as! RetentionPolicyData?, forKey: .retentionPolicy)}
  }
}

extension DataFactory {
  public static func createMetricSettingsProtocol(enabled: Bool) -> MetricSettingsProtocol {
    return MetricSettingsData(enabled: enabled)
  }
}


// MetricStatisticType enumerates the values for metric statistic type.

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
public enum MetricStatisticTypeEnum: String, Codable
{
// MetricStatisticTypeAverage specifies the metric statistic type average state for metric statistic type.
    case MetricStatisticTypeAverage = "Average"
// MetricStatisticTypeMax specifies the metric statistic type max state for metric statistic type.
    case MetricStatisticTypeMax = "Max"
// MetricStatisticTypeMin specifies the metric statistic type min state for metric statistic type.
    case MetricStatisticTypeMin = "Min"
// MetricStatisticTypeSum specifies the metric statistic type sum state for metric statistic type.
    case MetricStatisticTypeSum = "Sum"
}


// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
import Foundation
import azureSwiftRuntime
internal struct MetricTriggerData : MetricTriggerProtocol {
    public var metricName: String
    public var metricResourceUri: String
    public var timeGrain: String
    public var statistic: MetricStatisticTypeEnum
    public var timeWindow: String
    public var timeAggregation: TimeAggregationTypeEnum
    public var _operator: ComparisonOperationTypeEnum
    public var threshold: Double

        enum CodingKeys: String, CodingKey {case metricName = "metricName"
        case metricResourceUri = "metricResourceUri"
        case timeGrain = "timeGrain"
        case statistic = "statistic"
        case timeWindow = "timeWindow"
        case timeAggregation = "timeAggregation"
        case _operator = "operator"
        case threshold = "threshold"
        }

  public init(metricName: String, metricResourceUri: String, timeGrain: String, statistic: MetricStatisticTypeEnum, timeWindow: String, timeAggregation: TimeAggregationTypeEnum, _operator: ComparisonOperationTypeEnum, threshold: Double)  {
    self.metricName = metricName
    self.metricResourceUri = metricResourceUri
    self.timeGrain = timeGrain
    self.statistic = statistic
    self.timeWindow = timeWindow
    self.timeAggregation = timeAggregation
    self._operator = _operator
    self.threshold = threshold
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      self.metricName = try container.decode(String.self, forKey: .metricName)
    self.metricResourceUri = try container.decode(String.self, forKey: .metricResourceUri)
    self.timeGrain = try container.decode(String.self, forKey: .timeGrain)
    self.statistic = try container.decode(MetricStatisticTypeEnum.self, forKey: .statistic)
    self.timeWindow = try container.decode(String.self, forKey: .timeWindow)
    self.timeAggregation = try container.decode(TimeAggregationTypeEnum.self, forKey: .timeAggregation)
    self._operator = try container.decode(ComparisonOperationTypeEnum.self, forKey: ._operator)
    self.threshold = try container.decode(Double.self, forKey: .threshold)
    if var pageDecoder = decoder as? PageDecoder  {
      if pageDecoder.isPagedData,
        let nextLinkName = pageDecoder.nextLinkName {
          pageDecoder.nextLink = try UnknownCodingKey.decodeStringForKey(decoder: decoder, keyForDecode: nextLinkName)
      }
    }
  }

  public func encode(to encoder: Encoder) throws {
    var container = encoder.container(keyedBy: CodingKeys.self)
    try container.encode(self.metricName, forKey: .metricName)
    try container.encode(self.metricResourceUri, forKey: .metricResourceUri)
    try container.encode(self.timeGrain, forKey: .timeGrain)
    try container.encode(self.statistic, forKey: .statistic)
    try container.encode(self.timeWindow, forKey: .timeWindow)
    try container.encode(self.timeAggregation, forKey: .timeAggregation)
    try container.encode(self._operator, forKey: ._operator)
    try container.encode(self.threshold, forKey: .threshold)
  }
}

extension DataFactory {
  public static func createMetricTriggerProtocol(metricName: String, metricResourceUri: String, timeGrain: String, statistic: MetricStatisticTypeEnum, timeWindow: String, timeAggregation: TimeAggregationTypeEnum, _operator: ComparisonOperationTypeEnum, threshold: Double) -> MetricTriggerProtocol {
    return MetricTriggerData(metricName: metricName, metricResourceUri: metricResourceUri, timeGrain: timeGrain, statistic: statistic, timeWindow: timeWindow, timeAggregation: timeAggregation, _operator: _operator, threshold: threshold)
  }
}


// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
import Foundation
import azureSwiftRuntime
internal struct MetricValueData : MetricValueProtocol {
    public var timeStamp: Date
    public var average: Double?
    public var minimum: Double?
    public var maximum: Double?
    public var total: Double?
    public var count: Int64?

        enum CodingKeys: String, CodingKey {case timeStamp = "timeStamp"
        case average = "average"
        case minimum = "minimum"
        case maximum = "maximum"
        case total = "total"
        case count = "count"
        }

  public init(timeStamp: Date)  {
    self.timeStamp = timeStamp
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
          self.timeStamp = DateConverter.fromString(dateStr: (try container.decode(String?.self, forKey: .timeStamp)), format: .dateTime)!
    if container.contains(.average) {
        self.average = try container.decode(Double?.self, forKey: .average)
    }
    if container.contains(.minimum) {
        self.minimum = try container.decode(Double?.self, forKey: .minimum)
    }
    if container.contains(.maximum) {
        self.maximum = try container.decode(Double?.self, forKey: .maximum)
    }
    if container.contains(.total) {
        self.total = try container.decode(Double?.self, forKey: .total)
    }
    if container.contains(.count) {
        self.count = try container.decode(Int64?.self, forKey: .count)
    }
    if var pageDecoder = decoder as? PageDecoder  {
      if pageDecoder.isPagedData,
        let nextLinkName = pageDecoder.nextLinkName {
          pageDecoder.nextLink = try UnknownCodingKey.decodeStringForKey(decoder: decoder, keyForDecode: nextLinkName)
      }
    }
  }

  public func encode(to encoder: Encoder) throws {
    var container = encoder.container(keyedBy: CodingKeys.self)
    try container.encode(DateConverter.toString(date: self.timeStamp, format: .dateTime), forKey: .timeStamp)
    if self.average != nil {try container.encode(self.average, forKey: .average)}
    if self.minimum != nil {try container.encode(self.minimum, forKey: .minimum)}
    if self.maximum != nil {try container.encode(self.maximum, forKey: .maximum)}
    if self.total != nil {try container.encode(self.total, forKey: .total)}
    if self.count != nil {try container.encode(self.count, forKey: .count)}
  }
}

extension DataFactory {
  public static func createMetricValueProtocol(timeStamp: Date) -> MetricValueProtocol {
    return MetricValueData(timeStamp: timeStamp)
  }
}


// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
import Foundation
import azureSwiftRuntime
internal struct OperationData : OperationProtocol {
    public var name: String?
    public var display: OperationDisplayProtocol?

        enum CodingKeys: String, CodingKey {case name = "name"
        case display = "display"
        }

  public init()  {
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.name) {
        self.name = try container.decode(String?.self, forKey: .name)
    }
    if container.contains(.display) {
        self.display = try container.decode(OperationDisplayData?.self, forKey: .display)
    }
    if var pageDecoder = decoder as? PageDecoder  {
      if pageDecoder.isPagedData,
        let nextLinkName = pageDecoder.nextLinkName {
          pageDecoder.nextLink = try UnknownCodingKey.decodeStringForKey(decoder: decoder, keyForDecode: nextLinkName)
      }
    }
  }

  public func encode(to encoder: Encoder) throws {
    var container = encoder.container(keyedBy: CodingKeys.self)
    if self.name != nil {try container.encode(self.name, forKey: .name)}
    if self.display != nil {try container.encode(self.display as! OperationDisplayData?, forKey: .display)}
  }
}

extension DataFactory {
  public static func createOperationProtocol() -> OperationProtocol {
    return OperationData()
  }
}


// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
import Foundation
import azureSwiftRuntime
internal struct OperationDisplayData : OperationDisplayProtocol {
    public var provider: String?
    public var resource: String?
    public var operation: String?

        enum CodingKeys: String, CodingKey {case provider = "provider"
        case resource = "resource"
        case operation = "operation"
        }

  public init()  {
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.provider) {
        self.provider = try container.decode(String?.self, forKey: .provider)
    }
    if container.contains(.resource) {
        self.resource = try container.decode(String?.self, forKey: .resource)
    }
    if container.contains(.operation) {
        self.operation = try container.decode(String?.self, forKey: .operation)
    }
    if var pageDecoder = decoder as? PageDecoder  {
      if pageDecoder.isPagedData,
        let nextLinkName = pageDecoder.nextLinkName {
          pageDecoder.nextLink = try UnknownCodingKey.decodeStringForKey(decoder: decoder, keyForDecode: nextLinkName)
      }
    }
  }

  public func encode(to encoder: Encoder) throws {
    var container = encoder.container(keyedBy: CodingKeys.self)
    if self.provider != nil {try container.encode(self.provider, forKey: .provider)}
    if self.resource != nil {try container.encode(self.resource, forKey: .resource)}
    if self.operation != nil {try container.encode(self.operation, forKey: .operation)}
  }
}

extension DataFactory {
  public static func createOperationDisplayProtocol() -> OperationDisplayProtocol {
    return OperationDisplayData()
  }
}


// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
import Foundation
import azureSwiftRuntime
internal struct OperationListResultData : OperationListResultProtocol {
    public var value: [OperationProtocol?]?
    public var _nextLink: String?

        enum CodingKeys: String, CodingKey {case value = "value"
        case _nextLink = "nextLink"
        }

  public init()  {
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.value) {
        self.value = try container.decode([OperationData?]?.self, forKey: .value)
    }
    if container.contains(._nextLink) {
        self._nextLink = try container.decode(String?.self, forKey: ._nextLink)
    }
    if var pageDecoder = decoder as? PageDecoder  {
      if pageDecoder.isPagedData,
        let nextLinkName = pageDecoder.nextLinkName {
          pageDecoder.nextLink = try UnknownCodingKey.decodeStringForKey(decoder: decoder, keyForDecode: nextLinkName)
      }
    }
  }

  public func encode(to encoder: Encoder) throws {
    var container = encoder.container(keyedBy: CodingKeys.self)
    if self.value != nil {try container.encode(self.value as! [OperationData?]?, forKey: .value)}
    if self._nextLink != nil {try container.encode(self._nextLink, forKey: ._nextLink)}
  }
}

extension DataFactory {
  public static func createOperationListResultProtocol() -> OperationListResultProtocol {
    return OperationListResultData()
  }
}


// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
import Foundation
import azureSwiftRuntime
internal struct ProxyOnlyResourceData : ProxyOnlyResourceProtocol {
    public var id: String?
    public var name: String?
    public var type: String?

        enum CodingKeys: String, CodingKey {case id = "id"
        case name = "name"
        case type = "type"
        }

  public init()  {
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.id) {
        self.id = try container.decode(String?.self, forKey: .id)
    }
    if container.contains(.name) {
        self.name = try container.decode(String?.self, forKey: .name)
    }
    if container.contains(.type) {
        self.type = try container.decode(String?.self, forKey: .type)
    }
    if var pageDecoder = decoder as? PageDecoder  {
      if pageDecoder.isPagedData,
        let nextLinkName = pageDecoder.nextLinkName {
          pageDecoder.nextLink = try UnknownCodingKey.decodeStringForKey(decoder: decoder, keyForDecode: nextLinkName)
      }
    }
  }

  public func encode(to encoder: Encoder) throws {
    var container = encoder.container(keyedBy: CodingKeys.self)
    if self.id != nil {try container.encode(self.id, forKey: .id)}
    if self.name != nil {try container.encode(self.name, forKey: .name)}
    if self.type != nil {try container.encode(self.type, forKey: .type)}
  }
}

extension DataFactory {
  public static func createProxyOnlyResourceProtocol() -> ProxyOnlyResourceProtocol {
    return ProxyOnlyResourceData()
  }
}


// ReceiverStatus enumerates the values for receiver status.

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
public enum ReceiverStatusEnum: String, Codable
{
// Disabled specifies the disabled state for receiver status.
    case Disabled = "Disabled"
// Enabled specifies the enabled state for receiver status.
    case Enabled = "Enabled"
// NotSpecified specifies the not specified state for receiver status.
    case NotSpecified = "NotSpecified"
}


// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
import Foundation
import azureSwiftRuntime
internal struct RecurrenceData : RecurrenceProtocol {
    public var frequency: RecurrenceFrequencyEnum
    public var schedule: RecurrentScheduleProtocol

        enum CodingKeys: String, CodingKey {case frequency = "frequency"
        case schedule = "schedule"
        }

  public init(frequency: RecurrenceFrequencyEnum, schedule: RecurrentScheduleProtocol)  {
    self.frequency = frequency
    self.schedule = schedule
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      self.frequency = try container.decode(RecurrenceFrequencyEnum.self, forKey: .frequency)
    self.schedule = try container.decode(RecurrentScheduleData.self, forKey: .schedule)
    if var pageDecoder = decoder as? PageDecoder  {
      if pageDecoder.isPagedData,
        let nextLinkName = pageDecoder.nextLinkName {
          pageDecoder.nextLink = try UnknownCodingKey.decodeStringForKey(decoder: decoder, keyForDecode: nextLinkName)
      }
    }
  }

  public func encode(to encoder: Encoder) throws {
    var container = encoder.container(keyedBy: CodingKeys.self)
    try container.encode(self.frequency, forKey: .frequency)
    try container.encode(self.schedule as! RecurrentScheduleData, forKey: .schedule)
  }
}

extension DataFactory {
  public static func createRecurrenceProtocol(frequency: RecurrenceFrequencyEnum, schedule: RecurrentScheduleProtocol) -> RecurrenceProtocol {
    return RecurrenceData(frequency: frequency, schedule: schedule)
  }
}


// RecurrenceFrequency enumerates the values for recurrence frequency.

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
public enum RecurrenceFrequencyEnum: String, Codable
{
// RecurrenceFrequencyDay specifies the recurrence frequency day state for recurrence frequency.
    case RecurrenceFrequencyDay = "Day"
// RecurrenceFrequencyHour specifies the recurrence frequency hour state for recurrence frequency.
    case RecurrenceFrequencyHour = "Hour"
// RecurrenceFrequencyMinute specifies the recurrence frequency minute state for recurrence frequency.
    case RecurrenceFrequencyMinute = "Minute"
// RecurrenceFrequencyMonth specifies the recurrence frequency month state for recurrence frequency.
    case RecurrenceFrequencyMonth = "Month"
// RecurrenceFrequencyNone specifies the recurrence frequency none state for recurrence frequency.
    case RecurrenceFrequencyNone = "None"
// RecurrenceFrequencySecond specifies the recurrence frequency second state for recurrence frequency.
    case RecurrenceFrequencySecond = "Second"
// RecurrenceFrequencyWeek specifies the recurrence frequency week state for recurrence frequency.
    case RecurrenceFrequencyWeek = "Week"
// RecurrenceFrequencyYear specifies the recurrence frequency year state for recurrence frequency.
    case RecurrenceFrequencyYear = "Year"
}


// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
import Foundation
import azureSwiftRuntime
internal struct RecurrentScheduleData : RecurrentScheduleProtocol {
    public var timeZone: String
    public var days: [String]
    public var hours: [Int32]
    public var minutes: [Int32]

        enum CodingKeys: String, CodingKey {case timeZone = "timeZone"
        case days = "days"
        case hours = "hours"
        case minutes = "minutes"
        }

  public init(timeZone: String, days: [String], hours: [Int32], minutes: [Int32])  {
    self.timeZone = timeZone
    self.days = days
    self.hours = hours
    self.minutes = minutes
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      self.timeZone = try container.decode(String.self, forKey: .timeZone)
    self.days = try container.decode([String].self, forKey: .days)
    self.hours = try container.decode([Int32].self, forKey: .hours)
    self.minutes = try container.decode([Int32].self, forKey: .minutes)
    if var pageDecoder = decoder as? PageDecoder  {
      if pageDecoder.isPagedData,
        let nextLinkName = pageDecoder.nextLinkName {
          pageDecoder.nextLink = try UnknownCodingKey.decodeStringForKey(decoder: decoder, keyForDecode: nextLinkName)
      }
    }
  }

  public func encode(to encoder: Encoder) throws {
    var container = encoder.container(keyedBy: CodingKeys.self)
    try container.encode(self.timeZone, forKey: .timeZone)
    try container.encode(self.days as! [String], forKey: .days)
    try container.encode(self.hours as! [Int32], forKey: .hours)
    try container.encode(self.minutes as! [Int32], forKey: .minutes)
  }
}

extension DataFactory {
  public static func createRecurrentScheduleProtocol(timeZone: String, days: [String], hours: [Int32], minutes: [Int32]) -> RecurrentScheduleProtocol {
    return RecurrentScheduleData(timeZone: timeZone, days: days, hours: hours, minutes: minutes)
  }
}


// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
import Foundation
import azureSwiftRuntime
internal struct ResourceData : ResourceProtocol {
    public var id: String?
    public var name: String?
    public var type: String?
    public var location: String
    public var tags: [String:String]?

        enum CodingKeys: String, CodingKey {case id = "id"
        case name = "name"
        case type = "type"
        case location = "location"
        case tags = "tags"
        }

  public init(location: String)  {
    self.location = location
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.id) {
        self.id = try container.decode(String?.self, forKey: .id)
    }
    if container.contains(.name) {
        self.name = try container.decode(String?.self, forKey: .name)
    }
    if container.contains(.type) {
        self.type = try container.decode(String?.self, forKey: .type)
    }
    self.location = try container.decode(String.self, forKey: .location)
    if container.contains(.tags) {
        self.tags = try container.decode([String:String]?.self, forKey: .tags)
    }
    if var pageDecoder = decoder as? PageDecoder  {
      if pageDecoder.isPagedData,
        let nextLinkName = pageDecoder.nextLinkName {
          pageDecoder.nextLink = try UnknownCodingKey.decodeStringForKey(decoder: decoder, keyForDecode: nextLinkName)
      }
    }
  }

  public func encode(to encoder: Encoder) throws {
    var container = encoder.container(keyedBy: CodingKeys.self)
    if self.id != nil {try container.encode(self.id, forKey: .id)}
    if self.name != nil {try container.encode(self.name, forKey: .name)}
    if self.type != nil {try container.encode(self.type, forKey: .type)}
    try container.encode(self.location, forKey: .location)
    if self.tags != nil {try container.encode(self.tags, forKey: .tags)}
  }
}

extension DataFactory {
  public static func createResourceProtocol(location: String) -> ResourceProtocol {
    return ResourceData(location: location)
  }
}


// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
import Foundation
import azureSwiftRuntime
internal struct ResponseData : ResponseProtocol {
    public var cost: Double?
    public var timespan: String
    public var interval: String?
    public var namespace: String?
    public var resourceregion: String?
    public var value: [MetricProtocol]

        enum CodingKeys: String, CodingKey {case cost = "cost"
        case timespan = "timespan"
        case interval = "interval"
        case namespace = "namespace"
        case resourceregion = "resourceregion"
        case value = "value"
        }

  public init(timespan: String, value: [MetricProtocol])  {
    self.timespan = timespan
    self.value = value
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.cost) {
        self.cost = try container.decode(Double?.self, forKey: .cost)
    }
    self.timespan = try container.decode(String.self, forKey: .timespan)
    if container.contains(.interval) {
        self.interval = try container.decode(String?.self, forKey: .interval)
    }
    if container.contains(.namespace) {
        self.namespace = try container.decode(String?.self, forKey: .namespace)
    }
    if container.contains(.resourceregion) {
        self.resourceregion = try container.decode(String?.self, forKey: .resourceregion)
    }
    self.value = try container.decode([MetricData].self, forKey: .value)
    if var pageDecoder = decoder as? PageDecoder  {
      if pageDecoder.isPagedData,
        let nextLinkName = pageDecoder.nextLinkName {
          pageDecoder.nextLink = try UnknownCodingKey.decodeStringForKey(decoder: decoder, keyForDecode: nextLinkName)
      }
    }
  }

  public func encode(to encoder: Encoder) throws {
    var container = encoder.container(keyedBy: CodingKeys.self)
    if self.cost != nil {try container.encode(self.cost, forKey: .cost)}
    try container.encode(self.timespan, forKey: .timespan)
    if self.interval != nil {try container.encode(self.interval, forKey: .interval)}
    if self.namespace != nil {try container.encode(self.namespace, forKey: .namespace)}
    if self.resourceregion != nil {try container.encode(self.resourceregion, forKey: .resourceregion)}
    try container.encode(self.value as! [MetricData], forKey: .value)
  }
}

extension DataFactory {
  public static func createResponseProtocol(timespan: String, value: [MetricProtocol]) -> ResponseProtocol {
    return ResponseData(timespan: timespan, value: value)
  }
}


// ResultType enumerates the values for result type.

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
public enum ResultTypeEnum: String, Codable
{
// Data specifies the data state for result type.
    case Data = "Data"
// Metadata specifies the metadata state for result type.
    case Metadata = "Metadata"
}


// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
import Foundation
import azureSwiftRuntime
internal struct RetentionPolicyData : RetentionPolicyProtocol {
    public var enabled: Bool
    public var days: Int32

        enum CodingKeys: String, CodingKey {case enabled = "enabled"
        case days = "days"
        }

  public init(enabled: Bool, days: Int32)  {
    self.enabled = enabled
    self.days = days
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      self.enabled = try container.decode(Bool.self, forKey: .enabled)
    self.days = try container.decode(Int32.self, forKey: .days)
    if var pageDecoder = decoder as? PageDecoder  {
      if pageDecoder.isPagedData,
        let nextLinkName = pageDecoder.nextLinkName {
          pageDecoder.nextLink = try UnknownCodingKey.decodeStringForKey(decoder: decoder, keyForDecode: nextLinkName)
      }
    }
  }

  public func encode(to encoder: Encoder) throws {
    var container = encoder.container(keyedBy: CodingKeys.self)
    try container.encode(self.enabled, forKey: .enabled)
    try container.encode(self.days, forKey: .days)
  }
}

extension DataFactory {
  public static func createRetentionPolicyProtocol(enabled: Bool, days: Int32) -> RetentionPolicyProtocol {
    return RetentionPolicyData(enabled: enabled, days: days)
  }
}


// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
import Foundation
import azureSwiftRuntime
internal struct RuleActionData : RuleActionProtocol {

  public init()  {
  }

  public init(from decoder: Decoder) throws {
    if var pageDecoder = decoder as? PageDecoder  {
      if pageDecoder.isPagedData,
        let nextLinkName = pageDecoder.nextLinkName {
          pageDecoder.nextLink = try UnknownCodingKey.decodeStringForKey(decoder: decoder, keyForDecode: nextLinkName)
      }
    }
  }

  public func encode(to encoder: Encoder) throws {
  }
}

extension DataFactory {
  public static func createRuleActionProtocol() -> RuleActionProtocol {
    return RuleActionData()
  }
}


// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
import Foundation
import azureSwiftRuntime
internal struct RuleConditionData : RuleConditionProtocol {
    public var dataSource: RuleDataSourceProtocol?

        enum CodingKeys: String, CodingKey {case dataSource = "dataSource"
        }

  public init()  {
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.dataSource) {
        self.dataSource = try container.decode(RuleDataSourceData?.self, forKey: .dataSource)
    }
    if var pageDecoder = decoder as? PageDecoder  {
      if pageDecoder.isPagedData,
        let nextLinkName = pageDecoder.nextLinkName {
          pageDecoder.nextLink = try UnknownCodingKey.decodeStringForKey(decoder: decoder, keyForDecode: nextLinkName)
      }
    }
  }

  public func encode(to encoder: Encoder) throws {
    var container = encoder.container(keyedBy: CodingKeys.self)
    if self.dataSource != nil {try container.encode(self.dataSource as! RuleDataSourceData?, forKey: .dataSource)}
  }
}

extension DataFactory {
  public static func createRuleConditionProtocol() -> RuleConditionProtocol {
    return RuleConditionData()
  }
}


// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
import Foundation
import azureSwiftRuntime
internal struct RuleDataSourceData : RuleDataSourceProtocol {
    public var resourceUri: String?

        enum CodingKeys: String, CodingKey {case resourceUri = "resourceUri"
        }

  public init()  {
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.resourceUri) {
        self.resourceUri = try container.decode(String?.self, forKey: .resourceUri)
    }
    if var pageDecoder = decoder as? PageDecoder  {
      if pageDecoder.isPagedData,
        let nextLinkName = pageDecoder.nextLinkName {
          pageDecoder.nextLink = try UnknownCodingKey.decodeStringForKey(decoder: decoder, keyForDecode: nextLinkName)
      }
    }
  }

  public func encode(to encoder: Encoder) throws {
    var container = encoder.container(keyedBy: CodingKeys.self)
    if self.resourceUri != nil {try container.encode(self.resourceUri, forKey: .resourceUri)}
  }
}

extension DataFactory {
  public static func createRuleDataSourceProtocol() -> RuleDataSourceProtocol {
    return RuleDataSourceData()
  }
}


// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
import Foundation
import azureSwiftRuntime
internal struct RuleEmailActionData : RuleEmailActionProtocol, RuleActionProtocol {
    public var sendToServiceOwners: Bool?
    public var customEmails: [String]?

        enum CodingKeys: String, CodingKey {case sendToServiceOwners = "sendToServiceOwners"
        case customEmails = "customEmails"
        }

  public init()  {
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.sendToServiceOwners) {
        self.sendToServiceOwners = try container.decode(Bool?.self, forKey: .sendToServiceOwners)
    }
    if container.contains(.customEmails) {
        self.customEmails = try container.decode([String]?.self, forKey: .customEmails)
    }
    if var pageDecoder = decoder as? PageDecoder  {
      if pageDecoder.isPagedData,
        let nextLinkName = pageDecoder.nextLinkName {
          pageDecoder.nextLink = try UnknownCodingKey.decodeStringForKey(decoder: decoder, keyForDecode: nextLinkName)
      }
    }
  }

  public func encode(to encoder: Encoder) throws {
    var container = encoder.container(keyedBy: CodingKeys.self)
    if self.sendToServiceOwners != nil {try container.encode(self.sendToServiceOwners, forKey: .sendToServiceOwners)}
    if self.customEmails != nil {try container.encode(self.customEmails as! [String]?, forKey: .customEmails)}
  }
}

extension DataFactory {
  public static func createRuleEmailActionProtocol() -> RuleEmailActionProtocol {
    return RuleEmailActionData()
  }
}


// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
import Foundation
import azureSwiftRuntime
internal struct RuleManagementEventClaimsDataSourceData : RuleManagementEventClaimsDataSourceProtocol {
    public var emailAddress: String?

        enum CodingKeys: String, CodingKey {case emailAddress = "emailAddress"
        }

  public init()  {
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.emailAddress) {
        self.emailAddress = try container.decode(String?.self, forKey: .emailAddress)
    }
    if var pageDecoder = decoder as? PageDecoder  {
      if pageDecoder.isPagedData,
        let nextLinkName = pageDecoder.nextLinkName {
          pageDecoder.nextLink = try UnknownCodingKey.decodeStringForKey(decoder: decoder, keyForDecode: nextLinkName)
      }
    }
  }

  public func encode(to encoder: Encoder) throws {
    var container = encoder.container(keyedBy: CodingKeys.self)
    if self.emailAddress != nil {try container.encode(self.emailAddress, forKey: .emailAddress)}
  }
}

extension DataFactory {
  public static func createRuleManagementEventClaimsDataSourceProtocol() -> RuleManagementEventClaimsDataSourceProtocol {
    return RuleManagementEventClaimsDataSourceData()
  }
}


// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
import Foundation
import azureSwiftRuntime
internal struct RuleManagementEventDataSourceData : RuleManagementEventDataSourceProtocol, RuleDataSourceProtocol {
    public var resourceUri: String?
    public var eventName: String?
    public var eventSource: String?
    public var level: String?
    public var operationName: String?
    public var resourceGroupName: String?
    public var resourceProviderName: String?
    public var status: String?
    public var subStatus: String?
    public var claims: RuleManagementEventClaimsDataSourceProtocol?

        enum CodingKeys: String, CodingKey {case resourceUri = "resourceUri"
        case eventName = "eventName"
        case eventSource = "eventSource"
        case level = "level"
        case operationName = "operationName"
        case resourceGroupName = "resourceGroupName"
        case resourceProviderName = "resourceProviderName"
        case status = "status"
        case subStatus = "subStatus"
        case claims = "claims"
        }

  public init()  {
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.resourceUri) {
        self.resourceUri = try container.decode(String?.self, forKey: .resourceUri)
    }
    if container.contains(.eventName) {
        self.eventName = try container.decode(String?.self, forKey: .eventName)
    }
    if container.contains(.eventSource) {
        self.eventSource = try container.decode(String?.self, forKey: .eventSource)
    }
    if container.contains(.level) {
        self.level = try container.decode(String?.self, forKey: .level)
    }
    if container.contains(.operationName) {
        self.operationName = try container.decode(String?.self, forKey: .operationName)
    }
    if container.contains(.resourceGroupName) {
        self.resourceGroupName = try container.decode(String?.self, forKey: .resourceGroupName)
    }
    if container.contains(.resourceProviderName) {
        self.resourceProviderName = try container.decode(String?.self, forKey: .resourceProviderName)
    }
    if container.contains(.status) {
        self.status = try container.decode(String?.self, forKey: .status)
    }
    if container.contains(.subStatus) {
        self.subStatus = try container.decode(String?.self, forKey: .subStatus)
    }
    if container.contains(.claims) {
        self.claims = try container.decode(RuleManagementEventClaimsDataSourceData?.self, forKey: .claims)
    }
    if var pageDecoder = decoder as? PageDecoder  {
      if pageDecoder.isPagedData,
        let nextLinkName = pageDecoder.nextLinkName {
          pageDecoder.nextLink = try UnknownCodingKey.decodeStringForKey(decoder: decoder, keyForDecode: nextLinkName)
      }
    }
  }

  public func encode(to encoder: Encoder) throws {
    var container = encoder.container(keyedBy: CodingKeys.self)
    if self.resourceUri != nil {try container.encode(self.resourceUri, forKey: .resourceUri)}
    if self.eventName != nil {try container.encode(self.eventName, forKey: .eventName)}
    if self.eventSource != nil {try container.encode(self.eventSource, forKey: .eventSource)}
    if self.level != nil {try container.encode(self.level, forKey: .level)}
    if self.operationName != nil {try container.encode(self.operationName, forKey: .operationName)}
    if self.resourceGroupName != nil {try container.encode(self.resourceGroupName, forKey: .resourceGroupName)}
    if self.resourceProviderName != nil {try container.encode(self.resourceProviderName, forKey: .resourceProviderName)}
    if self.status != nil {try container.encode(self.status, forKey: .status)}
    if self.subStatus != nil {try container.encode(self.subStatus, forKey: .subStatus)}
    if self.claims != nil {try container.encode(self.claims as! RuleManagementEventClaimsDataSourceData?, forKey: .claims)}
  }
}

extension DataFactory {
  public static func createRuleManagementEventDataSourceProtocol() -> RuleManagementEventDataSourceProtocol {
    return RuleManagementEventDataSourceData()
  }
}


// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
import Foundation
import azureSwiftRuntime
internal struct RuleMetricDataSourceData : RuleMetricDataSourceProtocol, RuleDataSourceProtocol {
    public var resourceUri: String?
    public var metricName: String?

        enum CodingKeys: String, CodingKey {case resourceUri = "resourceUri"
        case metricName = "metricName"
        }

  public init()  {
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.resourceUri) {
        self.resourceUri = try container.decode(String?.self, forKey: .resourceUri)
    }
    if container.contains(.metricName) {
        self.metricName = try container.decode(String?.self, forKey: .metricName)
    }
    if var pageDecoder = decoder as? PageDecoder  {
      if pageDecoder.isPagedData,
        let nextLinkName = pageDecoder.nextLinkName {
          pageDecoder.nextLink = try UnknownCodingKey.decodeStringForKey(decoder: decoder, keyForDecode: nextLinkName)
      }
    }
  }

  public func encode(to encoder: Encoder) throws {
    var container = encoder.container(keyedBy: CodingKeys.self)
    if self.resourceUri != nil {try container.encode(self.resourceUri, forKey: .resourceUri)}
    if self.metricName != nil {try container.encode(self.metricName, forKey: .metricName)}
  }
}

extension DataFactory {
  public static func createRuleMetricDataSourceProtocol() -> RuleMetricDataSourceProtocol {
    return RuleMetricDataSourceData()
  }
}


// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
import Foundation
import azureSwiftRuntime
internal struct RuleWebhookActionData : RuleWebhookActionProtocol, RuleActionProtocol {
    public var serviceUri: String?
    public var properties: [String:String]?

        enum CodingKeys: String, CodingKey {case serviceUri = "serviceUri"
        case properties = "properties"
        }

  public init()  {
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.serviceUri) {
        self.serviceUri = try container.decode(String?.self, forKey: .serviceUri)
    }
    if container.contains(.properties) {
        self.properties = try container.decode([String:String]?.self, forKey: .properties)
    }
    if var pageDecoder = decoder as? PageDecoder  {
      if pageDecoder.isPagedData,
        let nextLinkName = pageDecoder.nextLinkName {
          pageDecoder.nextLink = try UnknownCodingKey.decodeStringForKey(decoder: decoder, keyForDecode: nextLinkName)
      }
    }
  }

  public func encode(to encoder: Encoder) throws {
    var container = encoder.container(keyedBy: CodingKeys.self)
    if self.serviceUri != nil {try container.encode(self.serviceUri, forKey: .serviceUri)}
    if self.properties != nil {try container.encode(self.properties, forKey: .properties)}
  }
}

extension DataFactory {
  public static func createRuleWebhookActionProtocol() -> RuleWebhookActionProtocol {
    return RuleWebhookActionData()
  }
}


// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
import Foundation
import azureSwiftRuntime
internal struct ScaleActionData : ScaleActionProtocol {
    public var direction: ScaleDirectionEnum
    public var type: ScaleTypeEnum
    public var value: String?
    public var cooldown: String

        enum CodingKeys: String, CodingKey {case direction = "direction"
        case type = "type"
        case value = "value"
        case cooldown = "cooldown"
        }

  public init(direction: ScaleDirectionEnum, type: ScaleTypeEnum, cooldown: String)  {
    self.direction = direction
    self.type = type
    self.cooldown = cooldown
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      self.direction = try container.decode(ScaleDirectionEnum.self, forKey: .direction)
    self.type = try container.decode(ScaleTypeEnum.self, forKey: .type)
    if container.contains(.value) {
        self.value = try container.decode(String?.self, forKey: .value)
    }
    self.cooldown = try container.decode(String.self, forKey: .cooldown)
    if var pageDecoder = decoder as? PageDecoder  {
      if pageDecoder.isPagedData,
        let nextLinkName = pageDecoder.nextLinkName {
          pageDecoder.nextLink = try UnknownCodingKey.decodeStringForKey(decoder: decoder, keyForDecode: nextLinkName)
      }
    }
  }

  public func encode(to encoder: Encoder) throws {
    var container = encoder.container(keyedBy: CodingKeys.self)
    try container.encode(self.direction, forKey: .direction)
    try container.encode(self.type, forKey: .type)
    if self.value != nil {try container.encode(self.value, forKey: .value)}
    try container.encode(self.cooldown, forKey: .cooldown)
  }
}

extension DataFactory {
  public static func createScaleActionProtocol(direction: ScaleDirectionEnum, type: ScaleTypeEnum, cooldown: String) -> ScaleActionProtocol {
    return ScaleActionData(direction: direction, type: type, cooldown: cooldown)
  }
}


// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
import Foundation
import azureSwiftRuntime
internal struct ScaleCapacityData : ScaleCapacityProtocol {
    public var minimum: String
    public var maximum: String
    public var _default: String

        enum CodingKeys: String, CodingKey {case minimum = "minimum"
        case maximum = "maximum"
        case _default = "default"
        }

  public init(minimum: String, maximum: String, _default: String)  {
    self.minimum = minimum
    self.maximum = maximum
    self._default = _default
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      self.minimum = try container.decode(String.self, forKey: .minimum)
    self.maximum = try container.decode(String.self, forKey: .maximum)
    self._default = try container.decode(String.self, forKey: ._default)
    if var pageDecoder = decoder as? PageDecoder  {
      if pageDecoder.isPagedData,
        let nextLinkName = pageDecoder.nextLinkName {
          pageDecoder.nextLink = try UnknownCodingKey.decodeStringForKey(decoder: decoder, keyForDecode: nextLinkName)
      }
    }
  }

  public func encode(to encoder: Encoder) throws {
    var container = encoder.container(keyedBy: CodingKeys.self)
    try container.encode(self.minimum, forKey: .minimum)
    try container.encode(self.maximum, forKey: .maximum)
    try container.encode(self._default, forKey: ._default)
  }
}

extension DataFactory {
  public static func createScaleCapacityProtocol(minimum: String, maximum: String, _default: String) -> ScaleCapacityProtocol {
    return ScaleCapacityData(minimum: minimum, maximum: maximum, _default: _default)
  }
}


// ScaleDirection enumerates the values for scale direction.

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
public enum ScaleDirectionEnum: String, Codable
{
// ScaleDirectionDecrease specifies the scale direction decrease state for scale direction.
    case ScaleDirectionDecrease = "Decrease"
// ScaleDirectionIncrease specifies the scale direction increase state for scale direction.
    case ScaleDirectionIncrease = "Increase"
// ScaleDirectionNone specifies the scale direction none state for scale direction.
    case ScaleDirectionNone = "None"
}


// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
import Foundation
import azureSwiftRuntime
internal struct ScaleRuleData : ScaleRuleProtocol {
    public var metricTrigger: MetricTriggerProtocol
    public var scaleAction: ScaleActionProtocol

        enum CodingKeys: String, CodingKey {case metricTrigger = "metricTrigger"
        case scaleAction = "scaleAction"
        }

  public init(metricTrigger: MetricTriggerProtocol, scaleAction: ScaleActionProtocol)  {
    self.metricTrigger = metricTrigger
    self.scaleAction = scaleAction
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      self.metricTrigger = try container.decode(MetricTriggerData.self, forKey: .metricTrigger)
    self.scaleAction = try container.decode(ScaleActionData.self, forKey: .scaleAction)
    if var pageDecoder = decoder as? PageDecoder  {
      if pageDecoder.isPagedData,
        let nextLinkName = pageDecoder.nextLinkName {
          pageDecoder.nextLink = try UnknownCodingKey.decodeStringForKey(decoder: decoder, keyForDecode: nextLinkName)
      }
    }
  }

  public func encode(to encoder: Encoder) throws {
    var container = encoder.container(keyedBy: CodingKeys.self)
    try container.encode(self.metricTrigger as! MetricTriggerData, forKey: .metricTrigger)
    try container.encode(self.scaleAction as! ScaleActionData, forKey: .scaleAction)
  }
}

extension DataFactory {
  public static func createScaleRuleProtocol(metricTrigger: MetricTriggerProtocol, scaleAction: ScaleActionProtocol) -> ScaleRuleProtocol {
    return ScaleRuleData(metricTrigger: metricTrigger, scaleAction: scaleAction)
  }
}


// ScaleType enumerates the values for scale type.

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
public enum ScaleTypeEnum: String, Codable
{
// ChangeCount specifies the change count state for scale type.
    case ChangeCount = "ChangeCount"
// ExactCount specifies the exact count state for scale type.
    case ExactCount = "ExactCount"
// PercentChangeCount specifies the percent change count state for scale type.
    case PercentChangeCount = "PercentChangeCount"
}


// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
import Foundation
import azureSwiftRuntime
internal struct SenderAuthorizationData : SenderAuthorizationProtocol {
    public var action: String?
    public var role: String?
    public var scope: String?

        enum CodingKeys: String, CodingKey {case action = "action"
        case role = "role"
        case scope = "scope"
        }

  public init()  {
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.action) {
        self.action = try container.decode(String?.self, forKey: .action)
    }
    if container.contains(.role) {
        self.role = try container.decode(String?.self, forKey: .role)
    }
    if container.contains(.scope) {
        self.scope = try container.decode(String?.self, forKey: .scope)
    }
    if var pageDecoder = decoder as? PageDecoder  {
      if pageDecoder.isPagedData,
        let nextLinkName = pageDecoder.nextLinkName {
          pageDecoder.nextLink = try UnknownCodingKey.decodeStringForKey(decoder: decoder, keyForDecode: nextLinkName)
      }
    }
  }

  public func encode(to encoder: Encoder) throws {
    var container = encoder.container(keyedBy: CodingKeys.self)
    if self.action != nil {try container.encode(self.action, forKey: .action)}
    if self.role != nil {try container.encode(self.role, forKey: .role)}
    if self.scope != nil {try container.encode(self.scope, forKey: .scope)}
  }
}

extension DataFactory {
  public static func createSenderAuthorizationProtocol() -> SenderAuthorizationProtocol {
    return SenderAuthorizationData()
  }
}


// Sensitivity enumerates the values for sensitivity.

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
public enum SensitivityEnum: String, Codable
{
// High specifies the high state for sensitivity.
    case High = "High"
// Low specifies the low state for sensitivity.
    case Low = "Low"
// Medium specifies the medium state for sensitivity.
    case Medium = "Medium"
}


// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
import Foundation
import azureSwiftRuntime
internal struct SmsReceiverData : SmsReceiverProtocol {
    public var name: String
    public var countryCode: String
    public var phoneNumber: String
    public var status: ReceiverStatusEnum?

        enum CodingKeys: String, CodingKey {case name = "name"
        case countryCode = "countryCode"
        case phoneNumber = "phoneNumber"
        case status = "status"
        }

  public init(name: String, countryCode: String, phoneNumber: String)  {
    self.name = name
    self.countryCode = countryCode
    self.phoneNumber = phoneNumber
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      self.name = try container.decode(String.self, forKey: .name)
    self.countryCode = try container.decode(String.self, forKey: .countryCode)
    self.phoneNumber = try container.decode(String.self, forKey: .phoneNumber)
    if container.contains(.status) {
        self.status = try container.decode(ReceiverStatusEnum?.self, forKey: .status)
    }
    if var pageDecoder = decoder as? PageDecoder  {
      if pageDecoder.isPagedData,
        let nextLinkName = pageDecoder.nextLinkName {
          pageDecoder.nextLink = try UnknownCodingKey.decodeStringForKey(decoder: decoder, keyForDecode: nextLinkName)
      }
    }
  }

  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.countryCode, forKey: .countryCode)
    try container.encode(self.phoneNumber, forKey: .phoneNumber)
    if self.status != nil {try container.encode(self.status, forKey: .status)}
  }
}

extension DataFactory {
  public static func createSmsReceiverProtocol(name: String, countryCode: String, phoneNumber: String) -> SmsReceiverProtocol {
    return SmsReceiverData(name: name, countryCode: countryCode, phoneNumber: phoneNumber)
  }
}


// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
import Foundation
import azureSwiftRuntime
internal struct ThresholdRuleConditionData : ThresholdRuleConditionProtocol, RuleConditionProtocol {
    public var dataSource: RuleDataSourceProtocol?
    public var _operator: ConditionOperatorEnum
    public var threshold: Double
    public var windowSize: String?
    public var timeAggregation: TimeAggregationOperatorEnum?

        enum CodingKeys: String, CodingKey {case dataSource = "dataSource"
        case _operator = "operator"
        case threshold = "threshold"
        case windowSize = "windowSize"
        case timeAggregation = "timeAggregation"
        }

  public init(_operator: ConditionOperatorEnum, threshold: Double)  {
    self._operator = _operator
    self.threshold = threshold
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.dataSource) {
        self.dataSource = try container.decode(RuleDataSourceData?.self, forKey: .dataSource)
    }
    self._operator = try container.decode(ConditionOperatorEnum.self, forKey: ._operator)
    self.threshold = try container.decode(Double.self, forKey: .threshold)
    if container.contains(.windowSize) {
        self.windowSize = try container.decode(String?.self, forKey: .windowSize)
    }
    if container.contains(.timeAggregation) {
        self.timeAggregation = try container.decode(TimeAggregationOperatorEnum?.self, forKey: .timeAggregation)
    }
    if var pageDecoder = decoder as? PageDecoder  {
      if pageDecoder.isPagedData,
        let nextLinkName = pageDecoder.nextLinkName {
          pageDecoder.nextLink = try UnknownCodingKey.decodeStringForKey(decoder: decoder, keyForDecode: nextLinkName)
      }
    }
  }

  public func encode(to encoder: Encoder) throws {
    var container = encoder.container(keyedBy: CodingKeys.self)
    if self.dataSource != nil {try container.encode(self.dataSource as! RuleDataSourceData?, forKey: .dataSource)}
    try container.encode(self._operator, forKey: ._operator)
    try container.encode(self.threshold, forKey: .threshold)
    if self.windowSize != nil {try container.encode(self.windowSize, forKey: .windowSize)}
    if self.timeAggregation != nil {try container.encode(self.timeAggregation, forKey: .timeAggregation)}
  }
}

extension DataFactory {
  public static func createThresholdRuleConditionProtocol(_operator: ConditionOperatorEnum, threshold: Double) -> ThresholdRuleConditionProtocol {
    return ThresholdRuleConditionData(_operator: _operator, threshold: threshold)
  }
}


// TimeAggregationOperator enumerates the values for time aggregation operator.

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
public enum TimeAggregationOperatorEnum: String, Codable
{
// TimeAggregationOperatorAverage specifies the time aggregation operator average state for time aggregation operator.
    case TimeAggregationOperatorAverage = "Average"
// TimeAggregationOperatorLast specifies the time aggregation operator last state for time aggregation operator.
    case TimeAggregationOperatorLast = "Last"
// TimeAggregationOperatorMaximum specifies the time aggregation operator maximum state for time aggregation operator.
    case TimeAggregationOperatorMaximum = "Maximum"
// TimeAggregationOperatorMinimum specifies the time aggregation operator minimum state for time aggregation operator.
    case TimeAggregationOperatorMinimum = "Minimum"
// TimeAggregationOperatorTotal specifies the time aggregation operator total state for time aggregation operator.
    case TimeAggregationOperatorTotal = "Total"
}


// TimeAggregationType enumerates the values for time aggregation type.

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
public enum TimeAggregationTypeEnum: String, Codable
{
// TimeAggregationTypeAverage specifies the time aggregation type average state for time aggregation type.
    case TimeAggregationTypeAverage = "Average"
// TimeAggregationTypeCount specifies the time aggregation type count state for time aggregation type.
    case TimeAggregationTypeCount = "Count"
// TimeAggregationTypeMaximum specifies the time aggregation type maximum state for time aggregation type.
    case TimeAggregationTypeMaximum = "Maximum"
// TimeAggregationTypeMinimum specifies the time aggregation type minimum state for time aggregation type.
    case TimeAggregationTypeMinimum = "Minimum"
// TimeAggregationTypeTotal specifies the time aggregation type total state for time aggregation type.
    case TimeAggregationTypeTotal = "Total"
}


// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
import Foundation
import azureSwiftRuntime
internal struct TimeSeriesElementData : TimeSeriesElementProtocol {
    public var metadatavalues: [MetadataValueProtocol?]?
    public var data: [MetricValueProtocol?]?

        enum CodingKeys: String, CodingKey {case metadatavalues = "metadatavalues"
        case data = "data"
        }

  public init()  {
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.metadatavalues) {
        self.metadatavalues = try container.decode([MetadataValueData?]?.self, forKey: .metadatavalues)
    }
    if container.contains(.data) {
        self.data = try container.decode([MetricValueData?]?.self, forKey: .data)
    }
    if var pageDecoder = decoder as? PageDecoder  {
      if pageDecoder.isPagedData,
        let nextLinkName = pageDecoder.nextLinkName {
          pageDecoder.nextLink = try UnknownCodingKey.decodeStringForKey(decoder: decoder, keyForDecode: nextLinkName)
      }
    }
  }

  public func encode(to encoder: Encoder) throws {
    var container = encoder.container(keyedBy: CodingKeys.self)
    if self.metadatavalues != nil {try container.encode(self.metadatavalues as! [MetadataValueData?]?, forKey: .metadatavalues)}
    if self.data != nil {try container.encode(self.data as! [MetricValueData?]?, forKey: .data)}
  }
}

extension DataFactory {
  public static func createTimeSeriesElementProtocol() -> TimeSeriesElementProtocol {
    return TimeSeriesElementData()
  }
}


// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
import Foundation
import azureSwiftRuntime
internal struct TimeSeriesInformationData : TimeSeriesInformationProtocol {
    public var sensitivities: [String]
    public var values: [Double]
    public var timestamps: [Date]?

        enum CodingKeys: String, CodingKey {case sensitivities = "sensitivities"
        case values = "values"
        case timestamps = "timestamps"
        }

  public init(sensitivities: [String], values: [Double])  {
    self.sensitivities = sensitivities
    self.values = values
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      self.sensitivities = try container.decode([String].self, forKey: .sensitivities)
    self.values = try container.decode([Double].self, forKey: .values)
    if container.contains(.timestamps) {
        self.timestamps = try container.decode([Date]?.self, forKey: .timestamps)
    }
    if var pageDecoder = decoder as? PageDecoder  {
      if pageDecoder.isPagedData,
        let nextLinkName = pageDecoder.nextLinkName {
          pageDecoder.nextLink = try UnknownCodingKey.decodeStringForKey(decoder: decoder, keyForDecode: nextLinkName)
      }
    }
  }

  public func encode(to encoder: Encoder) throws {
    var container = encoder.container(keyedBy: CodingKeys.self)
    try container.encode(self.sensitivities as! [String], forKey: .sensitivities)
    try container.encode(self.values as! [Double], forKey: .values)
    if self.timestamps != nil {try container.encode(self.timestamps as! [Date]?, forKey: .timestamps)}
  }
}

extension DataFactory {
  public static func createTimeSeriesInformationProtocol(sensitivities: [String], values: [Double]) -> TimeSeriesInformationProtocol {
    return TimeSeriesInformationData(sensitivities: sensitivities, values: values)
  }
}


// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
import Foundation
import azureSwiftRuntime
internal struct TimeWindowData : TimeWindowProtocol {
    public var timeZone: String?
    public var start: Date
    public var end: Date

        enum CodingKeys: String, CodingKey {case timeZone = "timeZone"
        case start = "start"
        case end = "end"
        }

  public init(start: Date, end: Date)  {
    self.start = start
    self.end = end
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.timeZone) {
        self.timeZone = try container.decode(String?.self, forKey: .timeZone)
    }
        self.start = DateConverter.fromString(dateStr: (try container.decode(String?.self, forKey: .start)), format: .dateTime)!
        self.end = DateConverter.fromString(dateStr: (try container.decode(String?.self, forKey: .end)), format: .dateTime)!
    if var pageDecoder = decoder as? PageDecoder  {
      if pageDecoder.isPagedData,
        let nextLinkName = pageDecoder.nextLinkName {
          pageDecoder.nextLink = try UnknownCodingKey.decodeStringForKey(decoder: decoder, keyForDecode: nextLinkName)
      }
    }
  }

  public func encode(to encoder: Encoder) throws {
    var container = encoder.container(keyedBy: CodingKeys.self)
    if self.timeZone != nil {try container.encode(self.timeZone, forKey: .timeZone)}
    try container.encode(DateConverter.toString(date: self.start, format: .dateTime), forKey: .start)
    try container.encode(DateConverter.toString(date: self.end, format: .dateTime), forKey: .end)
  }
}

extension DataFactory {
  public static func createTimeWindowProtocol(start: Date, end: Date) -> TimeWindowProtocol {
    return TimeWindowData(start: start, end: end)
  }
}


// Unit enumerates the values for unit.

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
public enum UnitEnum: String, Codable
{
// UnitBytes specifies the unit bytes state for unit.
    case UnitBytes = "Bytes"
// UnitByteSeconds specifies the unit byte seconds state for unit.
    case UnitByteSeconds = "ByteSeconds"
// UnitBytesPerSecond specifies the unit bytes per second state for unit.
    case UnitBytesPerSecond = "BytesPerSecond"
// UnitCount specifies the unit count state for unit.
    case UnitCount = "Count"
// UnitCountPerSecond specifies the unit count per second state for unit.
    case UnitCountPerSecond = "CountPerSecond"
// UnitMilliSeconds specifies the unit milli seconds state for unit.
    case UnitMilliSeconds = "MilliSeconds"
// UnitPercent specifies the unit percent state for unit.
    case UnitPercent = "Percent"
// UnitSeconds specifies the unit seconds state for unit.
    case UnitSeconds = "Seconds"
// UnitUnspecified specifies the unit unspecified state for unit.
    case UnitUnspecified = "Unspecified"
}


// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
import Foundation
import azureSwiftRuntime
internal struct WebhookNotificationData : WebhookNotificationProtocol {
    public var serviceUri: String?
    public var properties: [String:String]?

        enum CodingKeys: String, CodingKey {case serviceUri = "serviceUri"
        case properties = "properties"
        }

  public init()  {
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.serviceUri) {
        self.serviceUri = try container.decode(String?.self, forKey: .serviceUri)
    }
    if container.contains(.properties) {
        self.properties = try container.decode([String:String]?.self, forKey: .properties)
    }
    if var pageDecoder = decoder as? PageDecoder  {
      if pageDecoder.isPagedData,
        let nextLinkName = pageDecoder.nextLinkName {
          pageDecoder.nextLink = try UnknownCodingKey.decodeStringForKey(decoder: decoder, keyForDecode: nextLinkName)
      }
    }
  }

  public func encode(to encoder: Encoder) throws {
    var container = encoder.container(keyedBy: CodingKeys.self)
    if self.serviceUri != nil {try container.encode(self.serviceUri, forKey: .serviceUri)}
    if self.properties != nil {try container.encode(self.properties, forKey: .properties)}
  }
}

extension DataFactory {
  public static func createWebhookNotificationProtocol() -> WebhookNotificationProtocol {
    return WebhookNotificationData()
  }
}


// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
import Foundation
import azureSwiftRuntime
internal struct WebhookReceiverData : WebhookReceiverProtocol {
    public var name: String
    public var serviceUri: String

        enum CodingKeys: String, CodingKey {case name = "name"
        case serviceUri = "serviceUri"
        }

  public init(name: String, serviceUri: String)  {
    self.name = name
    self.serviceUri = serviceUri
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      self.name = try container.decode(String.self, forKey: .name)
    self.serviceUri = try container.decode(String.self, forKey: .serviceUri)
    if var pageDecoder = decoder as? PageDecoder  {
      if pageDecoder.isPagedData,
        let nextLinkName = pageDecoder.nextLinkName {
          pageDecoder.nextLink = try UnknownCodingKey.decodeStringForKey(decoder: decoder, keyForDecode: nextLinkName)
      }
    }
  }

  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.serviceUri, forKey: .serviceUri)
  }
}

extension DataFactory {
  public static func createWebhookReceiverProtocol(name: String, serviceUri: String) -> WebhookReceiverProtocol {
    return WebhookReceiverData(name: name, serviceUri: serviceUri)
  }
}


// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
import Foundation
// ActionGroupListProtocol is a list of action groups.
public protocol ActionGroupListProtocol : Codable {
     var value: [ActionGroupResourceProtocol?]? { get set }
     var _nextLink: String? { get set }
}


// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
import Foundation
// ActionGroupPatchBodyProtocol is an action group object for the body of patch operations.
public protocol ActionGroupPatchBodyProtocol : Codable {
     var tags: [String:String]? { get set }
     var properties: ActionGroupPatchProtocol? { get set }
}


// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
import Foundation
// ActionGroupPatchProtocol is an Azure action group for patch operations.
public protocol ActionGroupPatchProtocol : Codable {
     var enabled: Bool? { get set }
}


// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
import Foundation
// ActionGroupProtocol is an Azure action group.
public protocol ActionGroupProtocol : Codable {
     var groupShortName: String { get set }
     var enabled: Bool { get set }
     var emailReceivers: [EmailReceiverProtocol?]? { get set }
     var smsReceivers: [SmsReceiverProtocol?]? { get set }
     var webhookReceivers: [WebhookReceiverProtocol?]? { get set }
     var itsmReceivers: [ItsmReceiverProtocol?]? { get set }
     var azureAppPushReceivers: [AzureAppPushReceiverProtocol?]? { get set }
     var automationRunbookReceivers: [AutomationRunbookReceiverProtocol?]? { get set }
}


// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
import Foundation
// ActionGroupResourceProtocol is an action group resource.
public protocol ActionGroupResourceProtocol : ResourceProtocol {
     var properties: ActionGroupProtocol? { get set }
}


// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
import Foundation
// ActivityLogAlertActionGroupProtocol is a pointer to an Azure Action Group.
public protocol ActivityLogAlertActionGroupProtocol : Codable {
     var actionGroupId: String { get set }
     var webhookProperties: [String:String]? { get set }
}


// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
import Foundation
// ActivityLogAlertActionListProtocol is a list of activity log alert actions.
public protocol ActivityLogAlertActionListProtocol : Codable {
     var actionGroups: [ActivityLogAlertActionGroupProtocol?]? { get set }
}


// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
import Foundation
// ActivityLogAlertAllOfConditionProtocol is an Activity Log alert condition that is met when all its member conditions
// are met.
public protocol ActivityLogAlertAllOfConditionProtocol : Codable {
     var allOf: [ActivityLogAlertLeafConditionProtocol] { get set }
}


// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
import Foundation
// ActivityLogAlertLeafConditionProtocol is an Activity Log alert condition that is met by comparing an activity log
// field and value.
public protocol ActivityLogAlertLeafConditionProtocol : Codable {
     var field: String { get set }
     var equals: String { get set }
}


// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
import Foundation
// ActivityLogAlertListProtocol is a list of activity log alerts.
public protocol ActivityLogAlertListProtocol : Codable {
     var value: [ActivityLogAlertResourceProtocol?]? { get set }
     var _nextLink: String? { get set }
}


// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
import Foundation
// ActivityLogAlertPatchBodyProtocol is an activity log alert object for the body of patch operations.
public protocol ActivityLogAlertPatchBodyProtocol : Codable {
     var tags: [String:String]? { get set }
     var properties: ActivityLogAlertPatchProtocol? { get set }
}


// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
import Foundation
// ActivityLogAlertPatchProtocol is an Azure activity log alert for patch operations.
public protocol ActivityLogAlertPatchProtocol : Codable {
     var enabled: Bool? { get set }
}


// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
import Foundation
// ActivityLogAlertProtocol is an Azure activity log alert.
public protocol ActivityLogAlertProtocol : Codable {
     var scopes: [String] { get set }
     var enabled: Bool? { get set }
     var condition: ActivityLogAlertAllOfConditionProtocol { get set }
     var actions: ActivityLogAlertActionListProtocol { get set }
     var description: String? { get set }
}


// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
import Foundation
// ActivityLogAlertResourceProtocol is an activity log alert resource.
public protocol ActivityLogAlertResourceProtocol : ResourceProtocol {
     var properties: ActivityLogAlertProtocol? { get set }
}


// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
import Foundation
// AlertRuleProtocol is an alert rule.
public protocol AlertRuleProtocol : Codable {
     var name: String { get set }
     var description: String? { get set }
     var isEnabled: Bool { get set }
     var condition: RuleConditionProtocol { get set }
     var actions: [RuleActionProtocol?]? { get set }
     var lastUpdatedTime: Date? { get set }
}


// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
import Foundation
// AlertRuleResourceCollectionProtocol is represents a collection of alert rule resources.
public protocol AlertRuleResourceCollectionProtocol : Codable {
     var value: [AlertRuleResourceProtocol?]? { get set }
}


// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
import Foundation
// AlertRuleResourcePatchProtocol is the alert rule object for patch operations.
public protocol AlertRuleResourcePatchProtocol : Codable {
     var tags: [String:String]? { get set }
     var properties: AlertRuleProtocol? { get set }
}


// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
import Foundation
// AlertRuleResourceProtocol is the alert rule resource.
public protocol AlertRuleResourceProtocol : ResourceProtocol {
     var properties: AlertRuleProtocol { get set }
}


// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
import Foundation
// AutomationRunbookReceiverProtocol is the Azure Automation Runbook notification receiver.
public protocol AutomationRunbookReceiverProtocol : Codable {
     var automationAccountId: String { get set }
     var runbookName: String { get set }
     var webhookResourceId: String { get set }
     var isGlobalRunbook: Bool { get set }
     var name: String? { get set }
     var serviceUri: String? { get set }
}


// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
import Foundation
// AutoscaleNotificationProtocol is autoscale notification.
public protocol AutoscaleNotificationProtocol : Codable {
     var operation: String { get set }
     var email: EmailNotificationProtocol? { get set }
     var webhooks: [WebhookNotificationProtocol?]? { get set }
}


// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
import Foundation
// AutoscaleProfileProtocol is autoscale profile.
public protocol AutoscaleProfileProtocol : Codable {
     var name: String { get set }
     var capacity: ScaleCapacityProtocol { get set }
     var rules: [ScaleRuleProtocol] { get set }
     var fixedDate: TimeWindowProtocol? { get set }
     var recurrence: RecurrenceProtocol? { get set }
}