// 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 SBNamespaceData : SBNamespaceProtocol, TrackedResourceProtocol, ResourceProtocol {
    public var id: String?
    public var name: String?
    public var type: String?
    public var location: String
    public var tags: [String:String]?
    public var sku: SBSkuProtocol?
    public var properties: SBNamespacePropertiesProtocol?

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

  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 container.contains(.sku) {
        self.sku = try container.decode(SBSkuData?.self, forKey: .sku)
    }
    if container.contains(.properties) {
        self.properties = try container.decode(SBNamespacePropertiesData?.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.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)}
    if self.sku != nil {try container.encode(self.sku as! SBSkuData?, forKey: .sku)}
    if self.properties != nil {try container.encode(self.properties as! SBNamespacePropertiesData?, forKey: .properties)}
  }
}

extension DataFactory {
  public static func createSBNamespaceProtocol(location: String) -> SBNamespaceProtocol {
    return SBNamespaceData(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 SBNamespaceListResultData : SBNamespaceListResultProtocol {
    public var value: [SBNamespaceProtocol?]?
    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([SBNamespaceData?]?.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! [SBNamespaceData?]?, forKey: .value)}
    if self._nextLink != nil {try container.encode(self._nextLink, forKey: ._nextLink)}
  }
}

extension DataFactory {
  public static func createSBNamespaceListResultProtocol() -> SBNamespaceListResultProtocol {
    return SBNamespaceListResultData()
  }
}


// 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 SBNamespacePropertiesData : SBNamespacePropertiesProtocol {
    public var provisioningState: String?
    public var createdAt: Date?
    public var updatedAt: Date?
    public var serviceBusEndpoint: String?
    public var metricId: String?

        enum CodingKeys: String, CodingKey {case provisioningState = "provisioningState"
        case createdAt = "createdAt"
        case updatedAt = "updatedAt"
        case serviceBusEndpoint = "serviceBusEndpoint"
        case metricId = "metricId"
        }

  public init()  {
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.provisioningState) {
        self.provisioningState = try container.decode(String?.self, forKey: .provisioningState)
    }
    if container.contains(.createdAt) {
        self.createdAt = DateConverter.fromString(dateStr: (try container.decode(String?.self, forKey: .createdAt)), format: .dateTime)
    }
    if container.contains(.updatedAt) {
        self.updatedAt = DateConverter.fromString(dateStr: (try container.decode(String?.self, forKey: .updatedAt)), format: .dateTime)
    }
    if container.contains(.serviceBusEndpoint) {
        self.serviceBusEndpoint = try container.decode(String?.self, forKey: .serviceBusEndpoint)
    }
    if container.contains(.metricId) {
        self.metricId = try container.decode(String?.self, forKey: .metricId)
    }
    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.provisioningState != nil {try container.encode(self.provisioningState, forKey: .provisioningState)}
    if self.createdAt != nil {
        try container.encode(DateConverter.toString(date: self.createdAt!, format: .dateTime), forKey: .createdAt)
    }
    if self.updatedAt != nil {
        try container.encode(DateConverter.toString(date: self.updatedAt!, format: .dateTime), forKey: .updatedAt)
    }
    if self.serviceBusEndpoint != nil {try container.encode(self.serviceBusEndpoint, forKey: .serviceBusEndpoint)}
    if self.metricId != nil {try container.encode(self.metricId, forKey: .metricId)}
  }
}

extension DataFactory {
  public static func createSBNamespacePropertiesProtocol() -> SBNamespacePropertiesProtocol {
    return SBNamespacePropertiesData()
  }
}


// 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 SBNamespaceUpdateParametersData : SBNamespaceUpdateParametersProtocol, ResourceNamespacePatchProtocol, ResourceProtocol {
    public var id: String?
    public var name: String?
    public var type: String?
    public var location: String?
    public var tags: [String:String]?
    public var sku: SBSkuProtocol?
    public var properties: SBNamespacePropertiesProtocol?

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

  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 container.contains(.location) {
        self.location = try container.decode(String?.self, forKey: .location)
    }
    if container.contains(.tags) {
        self.tags = try container.decode([String:String]?.self, forKey: .tags)
    }
    if container.contains(.sku) {
        self.sku = try container.decode(SBSkuData?.self, forKey: .sku)
    }
    if container.contains(.properties) {
        self.properties = try container.decode(SBNamespacePropertiesData?.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.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)}
    if self.location != nil {try container.encode(self.location, forKey: .location)}
    if self.tags != nil {try container.encode(self.tags, forKey: .tags)}
    if self.sku != nil {try container.encode(self.sku as! SBSkuData?, forKey: .sku)}
    if self.properties != nil {try container.encode(self.properties as! SBNamespacePropertiesData?, forKey: .properties)}
  }
}

extension DataFactory {
  public static func createSBNamespaceUpdateParametersProtocol() -> SBNamespaceUpdateParametersProtocol {
    return SBNamespaceUpdateParametersData()
  }
}


// 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 SBQueueData : SBQueueProtocol, ResourceProtocol {
    public var id: String?
    public var name: String?
    public var type: String?
    public var properties: SBQueuePropertiesProtocol?

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

  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 container.contains(.properties) {
        self.properties = try container.decode(SBQueuePropertiesData?.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.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)}
    if self.properties != nil {try container.encode(self.properties as! SBQueuePropertiesData?, forKey: .properties)}
  }
}

extension DataFactory {
  public static func createSBQueueProtocol() -> SBQueueProtocol {
    return SBQueueData()
  }
}


// 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 SBQueueListResultData : SBQueueListResultProtocol {
    public var value: [SBQueueProtocol?]?
    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([SBQueueData?]?.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! [SBQueueData?]?, forKey: .value)}
    if self._nextLink != nil {try container.encode(self._nextLink, forKey: ._nextLink)}
  }
}

extension DataFactory {
  public static func createSBQueueListResultProtocol() -> SBQueueListResultProtocol {
    return SBQueueListResultData()
  }
}


// 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 SBQueuePropertiesData : SBQueuePropertiesProtocol {
    public var countDetails: MessageCountDetailsProtocol?
    public var createdAt: Date?
    public var updatedAt: Date?
    public var accessedAt: Date?
    public var sizeInBytes: Int64?
    public var messageCount: Int64?
    public var lockDuration: String?
    public var maxSizeInMegabytes: Int32?
    public var requiresDuplicateDetection: Bool?
    public var requiresSession: Bool?
    public var defaultMessageTimeToLive: String?
    public var deadLetteringOnMessageExpiration: Bool?
    public var duplicateDetectionHistoryTimeWindow: String?
    public var maxDeliveryCount: Int32?
    public var status: EntityStatusEnum?
    public var enableBatchedOperations: Bool?
    public var autoDeleteOnIdle: String?
    public var enablePartitioning: Bool?
    public var enableExpress: Bool?
    public var forwardTo: String?
    public var forwardDeadLetteredMessagesTo: String?

        enum CodingKeys: String, CodingKey {case countDetails = "countDetails"
        case createdAt = "createdAt"
        case updatedAt = "updatedAt"
        case accessedAt = "accessedAt"
        case sizeInBytes = "sizeInBytes"
        case messageCount = "messageCount"
        case lockDuration = "lockDuration"
        case maxSizeInMegabytes = "maxSizeInMegabytes"
        case requiresDuplicateDetection = "requiresDuplicateDetection"
        case requiresSession = "requiresSession"
        case defaultMessageTimeToLive = "defaultMessageTimeToLive"
        case deadLetteringOnMessageExpiration = "deadLetteringOnMessageExpiration"
        case duplicateDetectionHistoryTimeWindow = "duplicateDetectionHistoryTimeWindow"
        case maxDeliveryCount = "maxDeliveryCount"
        case status = "status"
        case enableBatchedOperations = "enableBatchedOperations"
        case autoDeleteOnIdle = "autoDeleteOnIdle"
        case enablePartitioning = "enablePartitioning"
        case enableExpress = "enableExpress"
        case forwardTo = "forwardTo"
        case forwardDeadLetteredMessagesTo = "forwardDeadLetteredMessagesTo"
        }

  public init()  {
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.countDetails) {
        self.countDetails = try container.decode(MessageCountDetailsData?.self, forKey: .countDetails)
    }
    if container.contains(.createdAt) {
        self.createdAt = DateConverter.fromString(dateStr: (try container.decode(String?.self, forKey: .createdAt)), format: .dateTime)
    }
    if container.contains(.updatedAt) {
        self.updatedAt = DateConverter.fromString(dateStr: (try container.decode(String?.self, forKey: .updatedAt)), format: .dateTime)
    }
    if container.contains(.accessedAt) {
        self.accessedAt = DateConverter.fromString(dateStr: (try container.decode(String?.self, forKey: .accessedAt)), format: .dateTime)
    }
    if container.contains(.sizeInBytes) {
        self.sizeInBytes = try container.decode(Int64?.self, forKey: .sizeInBytes)
    }
    if container.contains(.messageCount) {
        self.messageCount = try container.decode(Int64?.self, forKey: .messageCount)
    }
    if container.contains(.lockDuration) {
        self.lockDuration = try container.decode(String?.self, forKey: .lockDuration)
    }
    if container.contains(.maxSizeInMegabytes) {
        self.maxSizeInMegabytes = try container.decode(Int32?.self, forKey: .maxSizeInMegabytes)
    }
    if container.contains(.requiresDuplicateDetection) {
        self.requiresDuplicateDetection = try container.decode(Bool?.self, forKey: .requiresDuplicateDetection)
    }
    if container.contains(.requiresSession) {
        self.requiresSession = try container.decode(Bool?.self, forKey: .requiresSession)
    }
    if container.contains(.defaultMessageTimeToLive) {
        self.defaultMessageTimeToLive = try container.decode(String?.self, forKey: .defaultMessageTimeToLive)
    }
    if container.contains(.deadLetteringOnMessageExpiration) {
        self.deadLetteringOnMessageExpiration = try container.decode(Bool?.self, forKey: .deadLetteringOnMessageExpiration)
    }
    if container.contains(.duplicateDetectionHistoryTimeWindow) {
        self.duplicateDetectionHistoryTimeWindow = try container.decode(String?.self, forKey: .duplicateDetectionHistoryTimeWindow)
    }
    if container.contains(.maxDeliveryCount) {
        self.maxDeliveryCount = try container.decode(Int32?.self, forKey: .maxDeliveryCount)
    }
    if container.contains(.status) {
        self.status = try container.decode(EntityStatusEnum?.self, forKey: .status)
    }
    if container.contains(.enableBatchedOperations) {
        self.enableBatchedOperations = try container.decode(Bool?.self, forKey: .enableBatchedOperations)
    }
    if container.contains(.autoDeleteOnIdle) {
        self.autoDeleteOnIdle = try container.decode(String?.self, forKey: .autoDeleteOnIdle)
    }
    if container.contains(.enablePartitioning) {
        self.enablePartitioning = try container.decode(Bool?.self, forKey: .enablePartitioning)
    }
    if container.contains(.enableExpress) {
        self.enableExpress = try container.decode(Bool?.self, forKey: .enableExpress)
    }
    if container.contains(.forwardTo) {
        self.forwardTo = try container.decode(String?.self, forKey: .forwardTo)
    }
    if container.contains(.forwardDeadLetteredMessagesTo) {
        self.forwardDeadLetteredMessagesTo = try container.decode(String?.self, forKey: .forwardDeadLetteredMessagesTo)
    }
    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.countDetails != nil {try container.encode(self.countDetails as! MessageCountDetailsData?, forKey: .countDetails)}
    if self.createdAt != nil {
        try container.encode(DateConverter.toString(date: self.createdAt!, format: .dateTime), forKey: .createdAt)
    }
    if self.updatedAt != nil {
        try container.encode(DateConverter.toString(date: self.updatedAt!, format: .dateTime), forKey: .updatedAt)
    }
    if self.accessedAt != nil {
        try container.encode(DateConverter.toString(date: self.accessedAt!, format: .dateTime), forKey: .accessedAt)
    }
    if self.sizeInBytes != nil {try container.encode(self.sizeInBytes, forKey: .sizeInBytes)}
    if self.messageCount != nil {try container.encode(self.messageCount, forKey: .messageCount)}
    if self.lockDuration != nil {try container.encode(self.lockDuration, forKey: .lockDuration)}
    if self.maxSizeInMegabytes != nil {try container.encode(self.maxSizeInMegabytes, forKey: .maxSizeInMegabytes)}
    if self.requiresDuplicateDetection != nil {try container.encode(self.requiresDuplicateDetection, forKey: .requiresDuplicateDetection)}
    if self.requiresSession != nil {try container.encode(self.requiresSession, forKey: .requiresSession)}
    if self.defaultMessageTimeToLive != nil {try container.encode(self.defaultMessageTimeToLive, forKey: .defaultMessageTimeToLive)}
    if self.deadLetteringOnMessageExpiration != nil {try container.encode(self.deadLetteringOnMessageExpiration, forKey: .deadLetteringOnMessageExpiration)}
    if self.duplicateDetectionHistoryTimeWindow != nil {try container.encode(self.duplicateDetectionHistoryTimeWindow, forKey: .duplicateDetectionHistoryTimeWindow)}
    if self.maxDeliveryCount != nil {try container.encode(self.maxDeliveryCount, forKey: .maxDeliveryCount)}
    if self.status != nil {try container.encode(self.status, forKey: .status)}
    if self.enableBatchedOperations != nil {try container.encode(self.enableBatchedOperations, forKey: .enableBatchedOperations)}
    if self.autoDeleteOnIdle != nil {try container.encode(self.autoDeleteOnIdle, forKey: .autoDeleteOnIdle)}
    if self.enablePartitioning != nil {try container.encode(self.enablePartitioning, forKey: .enablePartitioning)}
    if self.enableExpress != nil {try container.encode(self.enableExpress, forKey: .enableExpress)}
    if self.forwardTo != nil {try container.encode(self.forwardTo, forKey: .forwardTo)}
    if self.forwardDeadLetteredMessagesTo != nil {try container.encode(self.forwardDeadLetteredMessagesTo, forKey: .forwardDeadLetteredMessagesTo)}
  }
}

extension DataFactory {
  public static func createSBQueuePropertiesProtocol() -> SBQueuePropertiesProtocol {
    return SBQueuePropertiesData()
  }
}


// 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 SBSkuData : SBSkuProtocol {
    public var name: SkuNameEnum
    public var tier: SkuTierEnum?
    public var capacity: Int32?

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

  public init(name: SkuNameEnum)  {
    self.name = name
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      self.name = try container.decode(SkuNameEnum.self, forKey: .name)
    if container.contains(.tier) {
        self.tier = try container.decode(SkuTierEnum?.self, forKey: .tier)
    }
    if container.contains(.capacity) {
        self.capacity = try container.decode(Int32?.self, forKey: .capacity)
    }
    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)
    if self.tier != nil {try container.encode(self.tier, forKey: .tier)}
    if self.capacity != nil {try container.encode(self.capacity, forKey: .capacity)}
  }
}

extension DataFactory {
  public static func createSBSkuProtocol(name: SkuNameEnum) -> SBSkuProtocol {
    return SBSkuData(name: name)
  }
}


// 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 SBSubscriptionData : SBSubscriptionProtocol, ResourceProtocol {
    public var id: String?
    public var name: String?
    public var type: String?
    public var properties: SBSubscriptionPropertiesProtocol?

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

  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 container.contains(.properties) {
        self.properties = try container.decode(SBSubscriptionPropertiesData?.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.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)}
    if self.properties != nil {try container.encode(self.properties as! SBSubscriptionPropertiesData?, forKey: .properties)}
  }
}

extension DataFactory {
  public static func createSBSubscriptionProtocol() -> SBSubscriptionProtocol {
    return SBSubscriptionData()
  }
}


// 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 SBSubscriptionListResultData : SBSubscriptionListResultProtocol {
    public var value: [SBSubscriptionProtocol?]?
    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([SBSubscriptionData?]?.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! [SBSubscriptionData?]?, forKey: .value)}
    if self._nextLink != nil {try container.encode(self._nextLink, forKey: ._nextLink)}
  }
}

extension DataFactory {
  public static func createSBSubscriptionListResultProtocol() -> SBSubscriptionListResultProtocol {
    return SBSubscriptionListResultData()
  }
}


// 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 SBSubscriptionPropertiesData : SBSubscriptionPropertiesProtocol {
    public var messageCount: Int64?
    public var createdAt: Date?
    public var accessedAt: Date?
    public var updatedAt: Date?
    public var countDetails: MessageCountDetailsProtocol?
    public var lockDuration: String?
    public var requiresSession: Bool?
    public var defaultMessageTimeToLive: String?
    public var deadLetteringOnFilterEvaluationExceptions: Bool?
    public var deadLetteringOnMessageExpiration: Bool?
    public var duplicateDetectionHistoryTimeWindow: String?
    public var maxDeliveryCount: Int32?
    public var status: EntityStatusEnum?
    public var enableBatchedOperations: Bool?
    public var autoDeleteOnIdle: String?
    public var forwardTo: String?
    public var forwardDeadLetteredMessagesTo: String?

        enum CodingKeys: String, CodingKey {case messageCount = "messageCount"
        case createdAt = "createdAt"
        case accessedAt = "accessedAt"
        case updatedAt = "updatedAt"
        case countDetails = "countDetails"
        case lockDuration = "lockDuration"
        case requiresSession = "requiresSession"
        case defaultMessageTimeToLive = "defaultMessageTimeToLive"
        case deadLetteringOnFilterEvaluationExceptions = "deadLetteringOnFilterEvaluationExceptions"
        case deadLetteringOnMessageExpiration = "deadLetteringOnMessageExpiration"
        case duplicateDetectionHistoryTimeWindow = "duplicateDetectionHistoryTimeWindow"
        case maxDeliveryCount = "maxDeliveryCount"
        case status = "status"
        case enableBatchedOperations = "enableBatchedOperations"
        case autoDeleteOnIdle = "autoDeleteOnIdle"
        case forwardTo = "forwardTo"
        case forwardDeadLetteredMessagesTo = "forwardDeadLetteredMessagesTo"
        }

  public init()  {
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.messageCount) {
        self.messageCount = try container.decode(Int64?.self, forKey: .messageCount)
    }
    if container.contains(.createdAt) {
        self.createdAt = DateConverter.fromString(dateStr: (try container.decode(String?.self, forKey: .createdAt)), format: .dateTime)
    }
    if container.contains(.accessedAt) {
        self.accessedAt = DateConverter.fromString(dateStr: (try container.decode(String?.self, forKey: .accessedAt)), format: .dateTime)
    }
    if container.contains(.updatedAt) {
        self.updatedAt = DateConverter.fromString(dateStr: (try container.decode(String?.self, forKey: .updatedAt)), format: .dateTime)
    }
    if container.contains(.countDetails) {
        self.countDetails = try container.decode(MessageCountDetailsData?.self, forKey: .countDetails)
    }
    if container.contains(.lockDuration) {
        self.lockDuration = try container.decode(String?.self, forKey: .lockDuration)
    }
    if container.contains(.requiresSession) {
        self.requiresSession = try container.decode(Bool?.self, forKey: .requiresSession)
    }
    if container.contains(.defaultMessageTimeToLive) {
        self.defaultMessageTimeToLive = try container.decode(String?.self, forKey: .defaultMessageTimeToLive)
    }
    if container.contains(.deadLetteringOnFilterEvaluationExceptions) {
        self.deadLetteringOnFilterEvaluationExceptions = try container.decode(Bool?.self, forKey: .deadLetteringOnFilterEvaluationExceptions)
    }
    if container.contains(.deadLetteringOnMessageExpiration) {
        self.deadLetteringOnMessageExpiration = try container.decode(Bool?.self, forKey: .deadLetteringOnMessageExpiration)
    }
    if container.contains(.duplicateDetectionHistoryTimeWindow) {
        self.duplicateDetectionHistoryTimeWindow = try container.decode(String?.self, forKey: .duplicateDetectionHistoryTimeWindow)
    }
    if container.contains(.maxDeliveryCount) {
        self.maxDeliveryCount = try container.decode(Int32?.self, forKey: .maxDeliveryCount)
    }
    if container.contains(.status) {
        self.status = try container.decode(EntityStatusEnum?.self, forKey: .status)
    }
    if container.contains(.enableBatchedOperations) {
        self.enableBatchedOperations = try container.decode(Bool?.self, forKey: .enableBatchedOperations)
    }
    if container.contains(.autoDeleteOnIdle) {
        self.autoDeleteOnIdle = try container.decode(String?.self, forKey: .autoDeleteOnIdle)
    }
    if container.contains(.forwardTo) {
        self.forwardTo = try container.decode(String?.self, forKey: .forwardTo)
    }
    if container.contains(.forwardDeadLetteredMessagesTo) {
        self.forwardDeadLetteredMessagesTo = try container.decode(String?.self, forKey: .forwardDeadLetteredMessagesTo)
    }
    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.messageCount != nil {try container.encode(self.messageCount, forKey: .messageCount)}
    if self.createdAt != nil {
        try container.encode(DateConverter.toString(date: self.createdAt!, format: .dateTime), forKey: .createdAt)
    }
    if self.accessedAt != nil {
        try container.encode(DateConverter.toString(date: self.accessedAt!, format: .dateTime), forKey: .accessedAt)
    }
    if self.updatedAt != nil {
        try container.encode(DateConverter.toString(date: self.updatedAt!, format: .dateTime), forKey: .updatedAt)
    }
    if self.countDetails != nil {try container.encode(self.countDetails as! MessageCountDetailsData?, forKey: .countDetails)}
    if self.lockDuration != nil {try container.encode(self.lockDuration, forKey: .lockDuration)}
    if self.requiresSession != nil {try container.encode(self.requiresSession, forKey: .requiresSession)}
    if self.defaultMessageTimeToLive != nil {try container.encode(self.defaultMessageTimeToLive, forKey: .defaultMessageTimeToLive)}
    if self.deadLetteringOnFilterEvaluationExceptions != nil {try container.encode(self.deadLetteringOnFilterEvaluationExceptions, forKey: .deadLetteringOnFilterEvaluationExceptions)}
    if self.deadLetteringOnMessageExpiration != nil {try container.encode(self.deadLetteringOnMessageExpiration, forKey: .deadLetteringOnMessageExpiration)}
    if self.duplicateDetectionHistoryTimeWindow != nil {try container.encode(self.duplicateDetectionHistoryTimeWindow, forKey: .duplicateDetectionHistoryTimeWindow)}
    if self.maxDeliveryCount != nil {try container.encode(self.maxDeliveryCount, forKey: .maxDeliveryCount)}
    if self.status != nil {try container.encode(self.status, forKey: .status)}
    if self.enableBatchedOperations != nil {try container.encode(self.enableBatchedOperations, forKey: .enableBatchedOperations)}
    if self.autoDeleteOnIdle != nil {try container.encode(self.autoDeleteOnIdle, forKey: .autoDeleteOnIdle)}
    if self.forwardTo != nil {try container.encode(self.forwardTo, forKey: .forwardTo)}
    if self.forwardDeadLetteredMessagesTo != nil {try container.encode(self.forwardDeadLetteredMessagesTo, forKey: .forwardDeadLetteredMessagesTo)}
  }
}

extension DataFactory {
  public static func createSBSubscriptionPropertiesProtocol() -> SBSubscriptionPropertiesProtocol {
    return SBSubscriptionPropertiesData()
  }
}


// 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 SBTopicData : SBTopicProtocol, ResourceProtocol {
    public var id: String?
    public var name: String?
    public var type: String?
    public var properties: SBTopicPropertiesProtocol?

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

  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 container.contains(.properties) {
        self.properties = try container.decode(SBTopicPropertiesData?.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.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)}
    if self.properties != nil {try container.encode(self.properties as! SBTopicPropertiesData?, forKey: .properties)}
  }
}

extension DataFactory {
  public static func createSBTopicProtocol() -> SBTopicProtocol {
    return SBTopicData()
  }
}


// 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 SBTopicListResultData : SBTopicListResultProtocol {
    public var value: [SBTopicProtocol?]?
    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([SBTopicData?]?.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! [SBTopicData?]?, forKey: .value)}
    if self._nextLink != nil {try container.encode(self._nextLink, forKey: ._nextLink)}
  }
}

extension DataFactory {
  public static func createSBTopicListResultProtocol() -> SBTopicListResultProtocol {
    return SBTopicListResultData()
  }
}


// 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 SBTopicPropertiesData : SBTopicPropertiesProtocol {
    public var sizeInBytes: Int64?
    public var createdAt: Date?
    public var updatedAt: Date?
    public var accessedAt: Date?
    public var subscriptionCount: Int32?
    public var countDetails: MessageCountDetailsProtocol?
    public var defaultMessageTimeToLive: String?
    public var maxSizeInMegabytes: Int32?
    public var requiresDuplicateDetection: Bool?
    public var duplicateDetectionHistoryTimeWindow: String?
    public var enableBatchedOperations: Bool?
    public var status: EntityStatusEnum?
    public var supportOrdering: Bool?
    public var autoDeleteOnIdle: String?
    public var enablePartitioning: Bool?
    public var enableExpress: Bool?

        enum CodingKeys: String, CodingKey {case sizeInBytes = "sizeInBytes"
        case createdAt = "createdAt"
        case updatedAt = "updatedAt"
        case accessedAt = "accessedAt"
        case subscriptionCount = "subscriptionCount"
        case countDetails = "countDetails"
        case defaultMessageTimeToLive = "defaultMessageTimeToLive"
        case maxSizeInMegabytes = "maxSizeInMegabytes"
        case requiresDuplicateDetection = "requiresDuplicateDetection"
        case duplicateDetectionHistoryTimeWindow = "duplicateDetectionHistoryTimeWindow"
        case enableBatchedOperations = "enableBatchedOperations"
        case status = "status"
        case supportOrdering = "supportOrdering"
        case autoDeleteOnIdle = "autoDeleteOnIdle"
        case enablePartitioning = "enablePartitioning"
        case enableExpress = "enableExpress"
        }

  public init()  {
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.sizeInBytes) {
        self.sizeInBytes = try container.decode(Int64?.self, forKey: .sizeInBytes)
    }
    if container.contains(.createdAt) {
        self.createdAt = DateConverter.fromString(dateStr: (try container.decode(String?.self, forKey: .createdAt)), format: .dateTime)
    }
    if container.contains(.updatedAt) {
        self.updatedAt = DateConverter.fromString(dateStr: (try container.decode(String?.self, forKey: .updatedAt)), format: .dateTime)
    }
    if container.contains(.accessedAt) {
        self.accessedAt = DateConverter.fromString(dateStr: (try container.decode(String?.self, forKey: .accessedAt)), format: .dateTime)
    }
    if container.contains(.subscriptionCount) {
        self.subscriptionCount = try container.decode(Int32?.self, forKey: .subscriptionCount)
    }
    if container.contains(.countDetails) {
        self.countDetails = try container.decode(MessageCountDetailsData?.self, forKey: .countDetails)
    }
    if container.contains(.defaultMessageTimeToLive) {
        self.defaultMessageTimeToLive = try container.decode(String?.self, forKey: .defaultMessageTimeToLive)
    }
    if container.contains(.maxSizeInMegabytes) {
        self.maxSizeInMegabytes = try container.decode(Int32?.self, forKey: .maxSizeInMegabytes)
    }
    if container.contains(.requiresDuplicateDetection) {
        self.requiresDuplicateDetection = try container.decode(Bool?.self, forKey: .requiresDuplicateDetection)
    }
    if container.contains(.duplicateDetectionHistoryTimeWindow) {
        self.duplicateDetectionHistoryTimeWindow = try container.decode(String?.self, forKey: .duplicateDetectionHistoryTimeWindow)
    }
    if container.contains(.enableBatchedOperations) {
        self.enableBatchedOperations = try container.decode(Bool?.self, forKey: .enableBatchedOperations)
    }
    if container.contains(.status) {
        self.status = try container.decode(EntityStatusEnum?.self, forKey: .status)
    }
    if container.contains(.supportOrdering) {
        self.supportOrdering = try container.decode(Bool?.self, forKey: .supportOrdering)
    }
    if container.contains(.autoDeleteOnIdle) {
        self.autoDeleteOnIdle = try container.decode(String?.self, forKey: .autoDeleteOnIdle)
    }
    if container.contains(.enablePartitioning) {
        self.enablePartitioning = try container.decode(Bool?.self, forKey: .enablePartitioning)
    }
    if container.contains(.enableExpress) {
        self.enableExpress = try container.decode(Bool?.self, forKey: .enableExpress)
    }
    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.sizeInBytes != nil {try container.encode(self.sizeInBytes, forKey: .sizeInBytes)}
    if self.createdAt != nil {
        try container.encode(DateConverter.toString(date: self.createdAt!, format: .dateTime), forKey: .createdAt)
    }
    if self.updatedAt != nil {
        try container.encode(DateConverter.toString(date: self.updatedAt!, format: .dateTime), forKey: .updatedAt)
    }
    if self.accessedAt != nil {
        try container.encode(DateConverter.toString(date: self.accessedAt!, format: .dateTime), forKey: .accessedAt)
    }
    if self.subscriptionCount != nil {try container.encode(self.subscriptionCount, forKey: .subscriptionCount)}
    if self.countDetails != nil {try container.encode(self.countDetails as! MessageCountDetailsData?, forKey: .countDetails)}
    if self.defaultMessageTimeToLive != nil {try container.encode(self.defaultMessageTimeToLive, forKey: .defaultMessageTimeToLive)}
    if self.maxSizeInMegabytes != nil {try container.encode(self.maxSizeInMegabytes, forKey: .maxSizeInMegabytes)}
    if self.requiresDuplicateDetection != nil {try container.encode(self.requiresDuplicateDetection, forKey: .requiresDuplicateDetection)}
    if self.duplicateDetectionHistoryTimeWindow != nil {try container.encode(self.duplicateDetectionHistoryTimeWindow, forKey: .duplicateDetectionHistoryTimeWindow)}
    if self.enableBatchedOperations != nil {try container.encode(self.enableBatchedOperations, forKey: .enableBatchedOperations)}
    if self.status != nil {try container.encode(self.status, forKey: .status)}
    if self.supportOrdering != nil {try container.encode(self.supportOrdering, forKey: .supportOrdering)}
    if self.autoDeleteOnIdle != nil {try container.encode(self.autoDeleteOnIdle, forKey: .autoDeleteOnIdle)}
    if self.enablePartitioning != nil {try container.encode(self.enablePartitioning, forKey: .enablePartitioning)}
    if self.enableExpress != nil {try container.encode(self.enableExpress, forKey: .enableExpress)}
  }
}

extension DataFactory {
  public static func createSBTopicPropertiesProtocol() -> SBTopicPropertiesProtocol {
    return SBTopicPropertiesData()
  }
}


// SkuName enumerates the values for sku name.

// 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 SkuNameEnum: String, Codable
{
// Basic specifies the basic state for sku name.
    case Basic = "Basic"
// Premium specifies the premium state for sku name.
    case Premium = "Premium"
// Standard specifies the standard state for sku name.
    case Standard = "Standard"
}


// SkuTier enumerates the values for sku tier.

// 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 SkuTierEnum: String, Codable
{
// SkuTierBasic specifies the sku tier basic state for sku tier.
    case SkuTierBasic = "Basic"
// SkuTierPremium specifies the sku tier premium state for sku tier.
    case SkuTierPremium = "Premium"
// SkuTierStandard specifies the sku tier standard state for sku tier.
    case SkuTierStandard = "Standard"
}


// 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 SqlFilterData : SqlFilterProtocol {
    public var sqlExpression: String?
    public var compatibilityLevel: Int32?
    public var requiresPreprocessing: Bool?

        enum CodingKeys: String, CodingKey {case sqlExpression = "sqlExpression"
        case compatibilityLevel = "compatibilityLevel"
        case requiresPreprocessing = "requiresPreprocessing"
        }

  public init()  {
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.sqlExpression) {
        self.sqlExpression = try container.decode(String?.self, forKey: .sqlExpression)
    }
    if container.contains(.compatibilityLevel) {
        self.compatibilityLevel = try container.decode(Int32?.self, forKey: .compatibilityLevel)
    }
    if container.contains(.requiresPreprocessing) {
        self.requiresPreprocessing = try container.decode(Bool?.self, forKey: .requiresPreprocessing)
    }
    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.sqlExpression != nil {try container.encode(self.sqlExpression, forKey: .sqlExpression)}
    if self.compatibilityLevel != nil {try container.encode(self.compatibilityLevel, forKey: .compatibilityLevel)}
    if self.requiresPreprocessing != nil {try container.encode(self.requiresPreprocessing, forKey: .requiresPreprocessing)}
  }
}

extension DataFactory {
  public static func createSqlFilterProtocol() -> SqlFilterProtocol {
    return SqlFilterData()
  }
}


// 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 SqlRuleActionData : SqlRuleActionProtocol, ActionProtocol {
    public var sqlExpression: String?
    public var compatibilityLevel: Int32?
    public var requiresPreprocessing: Bool?

        enum CodingKeys: String, CodingKey {case sqlExpression = "sqlExpression"
        case compatibilityLevel = "compatibilityLevel"
        case requiresPreprocessing = "requiresPreprocessing"
        }

  public init()  {
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.sqlExpression) {
        self.sqlExpression = try container.decode(String?.self, forKey: .sqlExpression)
    }
    if container.contains(.compatibilityLevel) {
        self.compatibilityLevel = try container.decode(Int32?.self, forKey: .compatibilityLevel)
    }
    if container.contains(.requiresPreprocessing) {
        self.requiresPreprocessing = try container.decode(Bool?.self, forKey: .requiresPreprocessing)
    }
    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.sqlExpression != nil {try container.encode(self.sqlExpression, forKey: .sqlExpression)}
    if self.compatibilityLevel != nil {try container.encode(self.compatibilityLevel, forKey: .compatibilityLevel)}
    if self.requiresPreprocessing != nil {try container.encode(self.requiresPreprocessing, forKey: .requiresPreprocessing)}
  }
}

extension DataFactory {
  public static func createSqlRuleActionProtocol() -> SqlRuleActionProtocol {
    return SqlRuleActionData()
  }
}


// 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 TrackedResourceData : TrackedResourceProtocol, 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 createTrackedResourceProtocol(location: String) -> TrackedResourceProtocol {
    return TrackedResourceData(location: location)
  }
}


// UnavailableReason enumerates the values for unavailable reason.

// 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 UnavailableReasonEnum: String, Codable
{
// InvalidName specifies the invalid name state for unavailable reason.
    case InvalidName = "InvalidName"
// NameInLockdown specifies the name in lockdown state for unavailable reason.
    case NameInLockdown = "NameInLockdown"
// NameInUse specifies the name in use state for unavailable reason.
    case NameInUse = "NameInUse"
// None specifies the none state for unavailable reason.
    case None = "None"
// SubscriptionIsDisabled specifies the subscription is disabled state for unavailable reason.
    case SubscriptionIsDisabled = "SubscriptionIsDisabled"
// TooManyNamespaceInCurrentSubscription specifies the too many namespace in current subscription state for unavailable
// reason.
    case TooManyNamespaceInCurrentSubscription = "TooManyNamespaceInCurrentSubscription"
}


// 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
// AccessKeysProtocol is namespace/ServiceBus Connection String
public protocol AccessKeysProtocol : Codable {
     var primaryConnectionString: String? { get set }
     var secondaryConnectionString: String? { get set }
     var aliasPrimaryConnectionString: String? { get set }
     var aliasSecondaryConnectionString: String? { get set }
     var primaryKey: String? { get set }
     var secondaryKey: String? { get set }
     var keyName: 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
// ActionProtocol is represents the filter actions which are allowed for the transformation of a message that have been
// matched by a filter expression.
public protocol ActionProtocol : Codable {
     var sqlExpression: String? { get set }
     var compatibilityLevel: Int32? { get set }
     var requiresPreprocessing: 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
// ArmDisasterRecoveryListResultProtocol is the result of the List Alias(Disaster Recovery configuration) operation.
public protocol ArmDisasterRecoveryListResultProtocol : Codable {
     var value: [ArmDisasterRecoveryProtocol?]? { 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
// ArmDisasterRecoveryPropertiesProtocol is properties required to the Create Or Update Alias(Disaster Recovery
// configurations)
public protocol ArmDisasterRecoveryPropertiesProtocol : Codable {
     var provisioningState: ProvisioningStateDREnum? { get set }
     var partnerNamespace: String? { get set }
     var alternateName: String? { get set }
     var role: RoleDisasterRecoveryEnum? { 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
// ArmDisasterRecoveryProtocol is single item in List or Get Alias(Disaster Recovery configuration) operation
public protocol ArmDisasterRecoveryProtocol : ResourceProtocol {
     var properties: ArmDisasterRecoveryPropertiesProtocol? { 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
// AuthorizationRulePropertiesProtocol is authorizationRule properties.
public protocol AuthorizationRulePropertiesProtocol : Codable {
     var rights: [AccessRightsEnum] { 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
// CaptureDescriptionProtocol is properties to configure capture description for eventhub
public protocol CaptureDescriptionProtocol : Codable {
     var enabled: Bool? { get set }
     var encoding: EncodingCaptureDescriptionEnum? { get set }
     var intervalInSeconds: Int32? { get set }
     var sizeLimitInBytes: Int32? { get set }
     var destination: DestinationProtocol? { 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
// CheckNameAvailabilityProtocol is description of a Check Name availability request properties.
public protocol CheckNameAvailabilityProtocol : Codable {
     var name: 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
// CheckNameAvailabilityResultProtocol is description of a Check Name availability request properties.
public protocol CheckNameAvailabilityResultProtocol : Codable {
     var message: String? { get set }
     var nameAvailable: Bool? { get set }
     var reason: UnavailableReasonEnum? { 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
// CorrelationFilterProtocol is represents the correlation filter expression.
public protocol CorrelationFilterProtocol : Codable {
     var correlationId: String? { get set }
     var messageId: String? { get set }
     var to: String? { get set }
     var replyTo: String? { get set }
     var label: String? { get set }
     var sessionId: String? { get set }
     var replyToSessionId: String? { get set }
     var contentType: String? { get set }
     var requiresPreprocessing: 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
// DestinationPropertiesProtocol is properties describing the storage account, blob container and acrchive name format
// for capture destination
public protocol DestinationPropertiesProtocol : Codable {
     var storageAccountResourceId: String? { get set }
     var blobContainer: String? { get set }
     var archiveNameFormat: 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
// DestinationProtocol is capture storage details for capture description
public protocol DestinationProtocol : Codable {
     var name: String? { get set }
     var properties: DestinationPropertiesProtocol? { 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
// ErrorResponseProtocol is error reponse indicates ServiceBus service is not able to process the incoming request. The
// reason is provided in the error message.
public protocol ErrorResponseProtocol : Codable {
     var code: String? { get set }
     var message: 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
// EventHubListResultProtocol is the result of the List EventHubs operation.
public protocol EventHubListResultProtocol : Codable {
     var value: [EventhubProtocol?]? { 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
// EventhubPropertiesProtocol is properties supplied to the Create Or Update Event Hub operation.
public protocol EventhubPropertiesProtocol : Codable {
     var partitionIds: [String]? { get set }
     var createdAt: Date? { get set }
     var updatedAt: Date? { get set }
     var messageRetentionInDays: Int64? { get set }
     var partitionCount: Int64? { get set }
     var status: EntityStatusEnum? { get set }
     var captureDescription: CaptureDescriptionProtocol? { 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
// EventhubProtocol is single item in List or Get Event Hub operation
public protocol EventhubProtocol : ResourceProtocol {
     var properties: EventhubPropertiesProtocol? { 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
// MessageCountDetailsProtocol is message Count Details.
public protocol MessageCountDetailsProtocol : Codable {
     var activeMessageCount: Int64? { get set }
     var deadLetterMessageCount: Int64? { get set }
     var scheduledMessageCount: Int64? { get set }
     var transferMessageCount: Int64? { get set }
     var transferDeadLetterMessageCount: Int64? { 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
// OperationDisplayProtocol is the object that represents the operation.
public protocol OperationDisplayProtocol : Codable {
     var provider: String? { get set }
     var resource: String? { get set }
     var operation: 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
// OperationListResultProtocol is result of the request to list ServiceBus operations. It contains a list of operations
// and a URL link to get the next set of results.
public protocol OperationListResultProtocol : Codable {
     var value: [OperationProtocol?]? { 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
// OperationProtocol is a ServiceBus REST API operation
public protocol OperationProtocol : Codable {
     var name: String? { get set }
     var display: OperationDisplayProtocol? { 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
// PremiumMessagingRegionsListResultProtocol is the response of the List PremiumMessagingRegions operation.
public protocol PremiumMessagingRegionsListResultProtocol : Codable {
     var value: [PremiumMessagingRegionsProtocol?]? { 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
// PremiumMessagingRegionsPropertiesProtocol is
public protocol PremiumMessagingRegionsPropertiesProtocol : Codable {
     var code: String? { get set }
     var fullName: 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
// PremiumMessagingRegionsProtocol is premium Messaging Region
public protocol PremiumMessagingRegionsProtocol : ResourceNamespacePatchProtocol {
     var properties: PremiumMessagingRegionsPropertiesProtocol? { 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
// RegenerateAccessKeyParametersProtocol is parameters supplied to the Regenerate Authorization Rule operation,
// specifies which key neeeds to be reset.
public protocol RegenerateAccessKeyParametersProtocol : Codable {
     var keyType: KeyTypeEnum { get set }
     var key: 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
// ResourceNamespacePatchProtocol is the Resource definition.
public protocol ResourceNamespacePatchProtocol : ResourceProtocol {
     var location: String? { get set }
     var tags: [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
// ResourceProtocol is the Resource definition for other than namespace.
public protocol ResourceProtocol : Codable {
     var id: String? { get set }
     var name: String? { get set }
     var type: 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
// RuleListResultProtocol is the response of the List rule operation.
public protocol RuleListResultProtocol : Codable {
     var value: [RuleProtocol?]? { 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
// RulepropertiesProtocol is description of Rule Resource.
public protocol RulepropertiesProtocol : Codable {
     var action: ActionProtocol? { get set }
     var filterType: FilterTypeEnum? { get set }
     var sqlFilter: SqlFilterProtocol? { get set }
     var correlationFilter: CorrelationFilterProtocol? { 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
// RuleProtocol is description of Rule Resource.
public protocol RuleProtocol : ResourceProtocol {
     var properties: RulepropertiesProtocol? { 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
// SBAuthorizationRuleListResultProtocol is the response to the List Namespace operation.
public protocol SBAuthorizationRuleListResultProtocol : Codable {
     var value: [SBAuthorizationRuleProtocol?]? { 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
// SBAuthorizationRulePropertiesProtocol is authorizationRule properties.
public protocol SBAuthorizationRulePropertiesProtocol : Codable {
     var rights: [AccessRightsEnum?]? { 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
// SBAuthorizationRuleProtocol is description of a namespace authorization rule.
public protocol SBAuthorizationRuleProtocol : ResourceProtocol {
     var properties: SBAuthorizationRulePropertiesProtocol? { 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
// SBNamespaceListResultProtocol is the response of the List Namespace operation.
public protocol SBNamespaceListResultProtocol : Codable {
     var value: [SBNamespaceProtocol?]? { 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
// SBNamespacePropertiesProtocol is properties of the namespace.
public protocol SBNamespacePropertiesProtocol : Codable {
     var provisioningState: String? { get set }
     var createdAt: Date? { get set }
     var updatedAt: Date? { get set }
     var serviceBusEndpoint: String? { get set }
     var metricId: 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
// SBNamespaceProtocol is description of a namespace resource.
public protocol SBNamespaceProtocol : TrackedResourceProtocol {
     var sku: SBSkuProtocol? { get set }
     var properties: SBNamespacePropertiesProtocol? { 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
// SBNamespaceUpdateParametersProtocol is description of a namespace resource.
public protocol SBNamespaceUpdateParametersProtocol : ResourceNamespacePatchProtocol {
     var sku: SBSkuProtocol? { get set }
     var properties: SBNamespacePropertiesProtocol? { 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
// SBQueueListResultProtocol is the response to the List Queues operation.
public protocol SBQueueListResultProtocol : Codable {
     var value: [SBQueueProtocol?]? { 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
// SBQueuePropertiesProtocol is the Queue Properties definition.
public protocol SBQueuePropertiesProtocol : Codable {
     var countDetails: MessageCountDetailsProtocol? { get set }
     var createdAt: Date? { get set }
     var updatedAt: Date? { get set }
     var accessedAt: Date? { get set }
     var sizeInBytes: Int64? { get set }
     var messageCount: Int64? { get set }
     var lockDuration: String? { get set }
     var maxSizeInMegabytes: Int32? { get set }
     var requiresDuplicateDetection: Bool? { get set }
     var requiresSession: Bool? { get set }
     var defaultMessageTimeToLive: String? { get set }
     var deadLetteringOnMessageExpiration: Bool? { get set }
     var duplicateDetectionHistoryTimeWindow: String? { get set }
     var maxDeliveryCount: Int32? { get set }
     var status: EntityStatusEnum? { get set }
     var enableBatchedOperations: Bool? { get set }
     var autoDeleteOnIdle: String? { get set }
     var enablePartitioning: Bool? { get set }
     var enableExpress: Bool? { get set }
     var forwardTo: String? { get set }
     var forwardDeadLetteredMessagesTo: 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
// SBQueueProtocol is description of queue Resource.
public protocol SBQueueProtocol : ResourceProtocol {
     var properties: SBQueuePropertiesProtocol? { 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
// SBSkuProtocol is SKU of the namespace.
public protocol SBSkuProtocol : Codable {
     var name: SkuNameEnum { get set }
     var tier: SkuTierEnum? { get set }
     var capacity: Int32? { 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
// SBSubscriptionListResultProtocol is the response to the List Subscriptions operation.
public protocol SBSubscriptionListResultProtocol : Codable {
     var value: [SBSubscriptionProtocol?]? { 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
// SBSubscriptionPropertiesProtocol is description of Subscription Resource.
public protocol SBSubscriptionPropertiesProtocol : Codable {
     var messageCount: Int64? { get set }
     var createdAt: Date? { get set }
     var accessedAt: Date? { get set }
     var updatedAt: Date? { get set }
     var countDetails: MessageCountDetailsProtocol? { get set }
     var lockDuration: String? { get set }
     var requiresSession: Bool? { get set }
     var defaultMessageTimeToLive: String? { get set }
     var deadLetteringOnFilterEvaluationExceptions: Bool? { get set }
     var deadLetteringOnMessageExpiration: Bool? { get set }
     var duplicateDetectionHistoryTimeWindow: String? { get set }
     var maxDeliveryCount: Int32? { get set }
     var status: EntityStatusEnum? { get set }
     var enableBatchedOperations: Bool? { get set }
     var autoDeleteOnIdle: String? { get set }
     var forwardTo: String? { get set }
     var forwardDeadLetteredMessagesTo: 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
// SBSubscriptionProtocol is description of subscription resource.
public protocol SBSubscriptionProtocol : ResourceProtocol {
     var properties: SBSubscriptionPropertiesProtocol? { 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
// SBTopicListResultProtocol is the response to the List Topics operation.
public protocol SBTopicListResultProtocol : Codable {
     var value: [SBTopicProtocol?]? { 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
// SBTopicPropertiesProtocol is the Tpoic Properties definition.
public protocol SBTopicPropertiesProtocol : Codable {
     var sizeInBytes: Int64? { get set }
     var createdAt: Date? { get set }
     var updatedAt: Date? { get set }
     var accessedAt: Date? { get set }
     var subscriptionCount: Int32? { get set }
     var countDetails: MessageCountDetailsProtocol? { get set }
     var defaultMessageTimeToLive: String? { get set }
     var maxSizeInMegabytes: Int32? { get set }
     var requiresDuplicateDetection: Bool? { get set }
     var duplicateDetectionHistoryTimeWindow: String? { get set }
     var enableBatchedOperations: Bool? { get set }
     var status: EntityStatusEnum? { get set }
     var supportOrdering: Bool? { get set }
     var autoDeleteOnIdle: String? { get set }
     var enablePartitioning: Bool? { get set }
     var enableExpress: 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
// SBTopicProtocol is description of topic resource.
public protocol SBTopicProtocol : ResourceProtocol {
     var properties: SBTopicPropertiesProtocol? { 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
// SqlFilterProtocol is represents a filter which is a composition of an expression and an action that is executed in
// the pub/sub pipeline.
public protocol SqlFilterProtocol : Codable {
     var sqlExpression: String? { get set }
     var compatibilityLevel: Int32? { get set }
     var requiresPreprocessing: 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
// SqlRuleActionProtocol is represents set of actions written in SQL language-based syntax that is performed against a
// ServiceBus.Messaging.BrokeredMessage
public protocol SqlRuleActionProtocol : ActionProtocol {
}


// 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
// TrackedResourceProtocol is the Resource definition.
public protocol TrackedResourceProtocol : ResourceProtocol {
     var location: String { get set }
     var tags: [String:String]? { get set }
}


// swift-tools-version:4.0
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
    name: "servicefabric",
    products: [
        // Products define the executables and libraries produced by a package, and make them visible to other packages.
        .library(
            name: "servicefabric",
            targets: ["servicefabric"]),
    ],
    dependencies: [
        // Dependencies declare other packages that this package depends on.
        .package(url: "https://github.com/Alamofire/Alamofire.git", from: "4.0.10"),
        .package(url: "https://github.com/ReactiveX/RxSwift.git", from: "3.4.2"),
        .package(url: "https://github.com/SwiftyJSON/SwiftyJSON.git", from: "3.1.4"),
        .package(url: "git@github.com:alvadb/autorest-clientruntime-for-swift.git", .branch("master"))
    ],
    targets: [
        // Targets are the basic building blocks of a package. A target can define a module or a test suite.
        // Targets can depend on other targets in this package, and on products in packages which this package depends on.
        .target(
            name: "servicefabric",
            dependencies: ["Alamofire", "RxSwift", "SwiftyJSON", "azureSwiftRuntime"])
    ]
)


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

// Application is the azure Service Fabric Resource Provider API Client
import Foundation
import azureSwiftRuntime
extension Commands {
public struct Application {
    public static func Delete(subscriptionId: String, resourceGroupName: String, clusterName: String, applicationName: String) -> ApplicationDelete {
        return DeleteCommand(subscriptionId: subscriptionId, resourceGroupName: resourceGroupName, clusterName: clusterName, applicationName: applicationName)
    }
    public static func Get(subscriptionId: String, resourceGroupName: String, clusterName: String, applicationName: String) -> ApplicationGet {
        return GetCommand(subscriptionId: subscriptionId, resourceGroupName: resourceGroupName, clusterName: clusterName, applicationName: applicationName)
    }
    public static func List(subscriptionId: String, resourceGroupName: String, clusterName: String) -> ApplicationList {
        return ListCommand(subscriptionId: subscriptionId, resourceGroupName: resourceGroupName, clusterName: clusterName)
    }
    public static func Patch(subscriptionId: String, resourceGroupName: String, clusterName: String, applicationName: String, parameters: ApplicationResourceUpdateProtocol) -> ApplicationPatch {
        return PatchCommand(subscriptionId: subscriptionId, resourceGroupName: resourceGroupName, clusterName: clusterName, applicationName: applicationName, parameters: parameters)
    }
    public static func Put(subscriptionId: String, resourceGroupName: String, clusterName: String, applicationName: String, parameters: ApplicationResourceProtocol) -> ApplicationPut {
        return PutCommand(subscriptionId: subscriptionId, resourceGroupName: resourceGroupName, clusterName: clusterName, applicationName: applicationName, parameters: parameters)
    }
}
}


import Foundation
import azureSwiftRuntime
public protocol ApplicationDelete  {
    var headerParameters: [String: String] { get set }
    var subscriptionId : String { get set }
    var resourceGroupName : String { get set }
    var clusterName : String { get set }
    var applicationName : String { get set }
    var apiVersion : String { get set }
    func execute(client: RuntimeClient,
    completionHandler: @escaping (Error?) -> Void) -> Void;
}

extension Commands.Application {
// Delete deletes an application resource with the specified name. This method may poll for completion. Polling can be
// canceled by passing the cancel channel argument. The channel will be used to cancel polling and any outstanding HTTP
// requests.
    internal class DeleteCommand : BaseCommand, ApplicationDelete {
        public var subscriptionId : String
        public var resourceGroupName : String
        public var clusterName : String
        public var applicationName : String
        public var apiVersion = "2017-07-01-preview"

        public init(subscriptionId: String, resourceGroupName: String, clusterName: String, applicationName: String) {
            self.subscriptionId = subscriptionId
            self.resourceGroupName = resourceGroupName
            self.clusterName = clusterName
            self.applicationName = applicationName
            super.init()
            self.method = "Delete"
            self.isLongRunningOperation = true
            self.path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}"
            self.headerParameters = ["Content-Type":"application/json; charset=utf-8"]
        }

        public override func preCall()  {
            self.pathParameters["{subscriptionId}"] = String(describing: self.subscriptionId)
            self.pathParameters["{resourceGroupName}"] = String(describing: self.resourceGroupName)
            self.pathParameters["{clusterName}"] = String(describing: self.clusterName)
            self.pathParameters["{applicationName}"] = String(describing: self.applicationName)
            self.queryParameters["api-version"] = String(describing: self.apiVersion)

        }

        public func execute(client: RuntimeClient,
            completionHandler: @escaping (Error?) -> Void) -> Void {
            client.executeAsyncLRO(command: self) {
                (error) in
                completionHandler(error)
            }
        }
    }
}


import Foundation
import azureSwiftRuntime
public protocol ApplicationGet  {
    var headerParameters: [String: String] { get set }
    var subscriptionId : String { get set }
    var resourceGroupName : String { get set }
    var clusterName : String { get set }
    var applicationName : String { get set }
    var apiVersion : String { get set }
    func execute(client: RuntimeClient,
    completionHandler: @escaping (ApplicationResourceProtocol?, Error?) -> Void) -> Void ;
}

extension Commands.Application {
// Get returns an application resource with the specified name.
    internal class GetCommand : BaseCommand, ApplicationGet {
        public var subscriptionId : String
        public var resourceGroupName : String
        public var clusterName : String
        public var applicationName : String
        public var apiVersion = "2017-07-01-preview"

        public init(subscriptionId: String, resourceGroupName: String, clusterName: String, applicationName: String) {
            self.subscriptionId = subscriptionId
            self.resourceGroupName = resourceGroupName
            self.clusterName = clusterName
            self.applicationName = applicationName
            super.init()
            self.method = "Get"
            self.isLongRunningOperation = false
            self.path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}"
            self.headerParameters = ["Content-Type":"application/json; charset=utf-8"]
        }

        public override func preCall()  {
            self.pathParameters["{subscriptionId}"] = String(describing: self.subscriptionId)
            self.pathParameters["{resourceGroupName}"] = String(describing: self.resourceGroupName)
            self.pathParameters["{clusterName}"] = String(describing: self.clusterName)
            self.pathParameters["{applicationName}"] = String(describing: self.applicationName)
            self.queryParameters["api-version"] = String(describing: self.apiVersion)

        }

        public override func returnFunc(data: Data) throws -> Decodable? {
            let contentType = "application/json"
            if let mimeType = MimeType.getType(forStr: contentType) {
                let decoder = try CoderFactory.decoder(for: mimeType)
                let result = try decoder.decode(ApplicationResourceData?.self, from: data)
                return result;
            }
            throw DecodeError.unknownMimeType
        }
        public func execute(client: RuntimeClient,
            completionHandler: @escaping (ApplicationResourceProtocol?, Error?) -> Void) -> Void {
            client.executeAsync(command: self) {
                (result: ApplicationResourceData?, error: Error?) in
                completionHandler(result, error)
            }
        }
    }
}


import Foundation
import azureSwiftRuntime
public protocol ApplicationList  {
    var headerParameters: [String: String] { get set }
    var subscriptionId : String { get set }
    var resourceGroupName : String { get set }
    var clusterName : String { get set }
    var apiVersion : String { get set }
    func execute(client: RuntimeClient,
    completionHandler: @escaping (ApplicationResourceListProtocol?, Error?) -> Void) -> Void ;
}

extension Commands.Application {
// List returns all application resources in the specified cluster.
    internal class ListCommand : BaseCommand, ApplicationList {
        public var subscriptionId : String
        public var resourceGroupName : String
        public var clusterName : String
        public var apiVersion = "2017-07-01-preview"

        public init(subscriptionId: String, resourceGroupName: String, clusterName: String) {
            self.subscriptionId = subscriptionId
            self.resourceGroupName = resourceGroupName
            self.clusterName = clusterName
            super.init()
            self.method = "Get"
            self.isLongRunningOperation = false
            self.path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications"
            self.headerParameters = ["Content-Type":"application/json; charset=utf-8"]
        }

        public override func preCall()  {
            self.pathParameters["{subscriptionId}"] = String(describing: self.subscriptionId)
            self.pathParameters["{resourceGroupName}"] = String(describing: self.resourceGroupName)
            self.pathParameters["{clusterName}"] = String(describing: self.clusterName)
            self.queryParameters["api-version"] = String(describing: self.apiVersion)

        }

        public override func returnFunc(data: Data) throws -> Decodable? {
            let contentType = "application/json"
            if let mimeType = MimeType.getType(forStr: contentType) {
                let decoder = try CoderFactory.decoder(for: mimeType)
                let result = try decoder.decode(ApplicationResourceListData?.self, from: data)
                return result;
            }
            throw DecodeError.unknownMimeType
        }
        public func execute(client: RuntimeClient,
            completionHandler: @escaping (ApplicationResourceListProtocol?, Error?) -> Void) -> Void {
            client.executeAsync(command: self) {
                (result: ApplicationResourceListData?, error: Error?) in
                completionHandler(result, error)
            }
        }
    }
}


import Foundation
import azureSwiftRuntime
public protocol ApplicationPatch  {
    var headerParameters: [String: String] { get set }
    var subscriptionId : String { get set }
    var resourceGroupName : String { get set }
    var clusterName : String { get set }
    var applicationName : String { get set }
    var apiVersion : String { get set }
    var parameters :  ApplicationResourceUpdateProtocol?  { get set }
    func execute(client: RuntimeClient,
    completionHandler: @escaping (ApplicationResourceUpdateProtocol?, Error?) -> Void) -> Void ;
}

extension Commands.Application {
// Patch updates an application resource with the specified name. This method may poll for completion. Polling can be
// canceled by passing the cancel channel argument. The channel will be used to cancel polling and any outstanding HTTP
// requests.
    internal class PatchCommand : BaseCommand, ApplicationPatch {
        public var subscriptionId : String
        public var resourceGroupName : String
        public var clusterName : String
        public var applicationName : String
        public var apiVersion = "2017-07-01-preview"
    public var parameters :  ApplicationResourceUpdateProtocol?

        public init(subscriptionId: String, resourceGroupName: String, clusterName: String, applicationName: String, parameters: ApplicationResourceUpdateProtocol) {
            self.subscriptionId = subscriptionId
            self.resourceGroupName = resourceGroupName
            self.clusterName = clusterName
            self.applicationName = applicationName
            self.parameters = parameters
            super.init()
            self.method = "Patch"
            self.isLongRunningOperation = true
            self.path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}"
            self.headerParameters = ["Content-Type":"application/json; charset=utf-8"]
        }

        public override func preCall()  {
            self.pathParameters["{subscriptionId}"] = String(describing: self.subscriptionId)
            self.pathParameters["{resourceGroupName}"] = String(describing: self.resourceGroupName)
            self.pathParameters["{clusterName}"] = String(describing: self.clusterName)
            self.pathParameters["{applicationName}"] = String(describing: self.applicationName)
            self.queryParameters["api-version"] = String(describing: self.apiVersion)
            self.body = parameters

        }
        public override func encodeBody() throws -> Data? {
            let contentType = "application/json"
            if let mimeType = MimeType.getType(forStr: contentType) {
                let encoder = try CoderFactory.encoder(for: mimeType)
                let encodedValue = try encoder.encode(parameters as? ApplicationResourceUpdateData)
                return encodedValue
            }
            throw DecodeError.unknownMimeType
        }

        public override func returnFunc(data: Data) throws -> Decodable? {
            let contentType = "application/json"
            if let mimeType = MimeType.getType(forStr: contentType) {
                let decoder = try CoderFactory.decoder(for: mimeType)
                let result = try decoder.decode(ApplicationResourceUpdateData?.self, from: data)
                return result;
            }
            throw DecodeError.unknownMimeType
        }
        public func execute(client: RuntimeClient,
            completionHandler: @escaping (ApplicationResourceUpdateProtocol?, Error?) -> Void) -> Void {
            client.executeAsyncLRO(command: self) {
                (result: ApplicationResourceUpdateData?, error: Error?) in
                completionHandler(result, error)
            }
        }
    }
}