// 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 DatabaseAutomaticTuningData : DatabaseAutomaticTuningProtocol, ProxyResourceProtocol, ResourceProtocol {
    public var id: String?
    public var name: String?
    public var type: String?
    public var properties: DatabaseAutomaticTuningPropertiesProtocol?

        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(DatabaseAutomaticTuningPropertiesData?.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! DatabaseAutomaticTuningPropertiesData?, forKey: .properties)}
  }
}

extension DataFactory {
  public static func createDatabaseAutomaticTuningProtocol() -> DatabaseAutomaticTuningProtocol {
    return DatabaseAutomaticTuningData()
  }
}


// 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 DatabaseAutomaticTuningPropertiesData : DatabaseAutomaticTuningPropertiesProtocol {
    public var desiredState: AutomaticTuningModeEnum?
    public var actualState: AutomaticTuningModeEnum?
    public var options: [String:AutomaticTuningOptionsProtocol?]?

        enum CodingKeys: String, CodingKey {case desiredState = "desiredState"
        case actualState = "actualState"
        case options = "options"
        }

  public init()  {
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.desiredState) {
        self.desiredState = try container.decode(AutomaticTuningModeEnum?.self, forKey: .desiredState)
    }
    if container.contains(.actualState) {
        self.actualState = try container.decode(AutomaticTuningModeEnum?.self, forKey: .actualState)
    }
    if container.contains(.options) {
        self.options = try container.decode([String:AutomaticTuningOptionsData?]?.self, forKey: .options)
    }
    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.desiredState != nil {try container.encode(self.desiredState, forKey: .desiredState)}
    if self.actualState != nil {try container.encode(self.actualState, forKey: .actualState)}
    if self.options != nil {try container.encode(self.options, forKey: .options)}
  }
}

extension DataFactory {
  public static func createDatabaseAutomaticTuningPropertiesProtocol() -> DatabaseAutomaticTuningPropertiesProtocol {
    return DatabaseAutomaticTuningPropertiesData()
  }
}


// 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 DatabaseBlobAuditingPolicyData : DatabaseBlobAuditingPolicyProtocol, ProxyResourceProtocol, ResourceProtocol {
    public var id: String?
    public var name: String?
    public var type: String?
    public var kind: String?
    public var properties: DatabaseBlobAuditingPolicyPropertiesProtocol?

        enum CodingKeys: String, CodingKey {case id = "id"
        case name = "name"
        case type = "type"
        case kind = "kind"
        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(.kind) {
        self.kind = try container.decode(String?.self, forKey: .kind)
    }
    if container.contains(.properties) {
        self.properties = try container.decode(DatabaseBlobAuditingPolicyPropertiesData?.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.kind != nil {try container.encode(self.kind, forKey: .kind)}
    if self.properties != nil {try container.encode(self.properties as! DatabaseBlobAuditingPolicyPropertiesData?, forKey: .properties)}
  }
}

extension DataFactory {
  public static func createDatabaseBlobAuditingPolicyProtocol() -> DatabaseBlobAuditingPolicyProtocol {
    return DatabaseBlobAuditingPolicyData()
  }
}


// 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 DatabaseBlobAuditingPolicyPropertiesData : DatabaseBlobAuditingPolicyPropertiesProtocol {
    public var state: BlobAuditingPolicyStateEnum
    public var storageEndpoint: String?
    public var storageAccountAccessKey: String?
    public var retentionDays: Int32?
    public var auditActionsAndGroups: [String]?
    public var storageAccountSubscriptionId: String?
    public var isStorageSecondaryKeyInUse: Bool?

        enum CodingKeys: String, CodingKey {case state = "state"
        case storageEndpoint = "storageEndpoint"
        case storageAccountAccessKey = "storageAccountAccessKey"
        case retentionDays = "retentionDays"
        case auditActionsAndGroups = "auditActionsAndGroups"
        case storageAccountSubscriptionId = "storageAccountSubscriptionId"
        case isStorageSecondaryKeyInUse = "isStorageSecondaryKeyInUse"
        }

  public init(state: BlobAuditingPolicyStateEnum)  {
    self.state = state
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      self.state = try container.decode(BlobAuditingPolicyStateEnum.self, forKey: .state)
    if container.contains(.storageEndpoint) {
        self.storageEndpoint = try container.decode(String?.self, forKey: .storageEndpoint)
    }
    if container.contains(.storageAccountAccessKey) {
        self.storageAccountAccessKey = try container.decode(String?.self, forKey: .storageAccountAccessKey)
    }
    if container.contains(.retentionDays) {
        self.retentionDays = try container.decode(Int32?.self, forKey: .retentionDays)
    }
    if container.contains(.auditActionsAndGroups) {
        self.auditActionsAndGroups = try container.decode([String]?.self, forKey: .auditActionsAndGroups)
    }
    if container.contains(.storageAccountSubscriptionId) {
        self.storageAccountSubscriptionId = try container.decode(String?.self, forKey: .storageAccountSubscriptionId)
    }
    if container.contains(.isStorageSecondaryKeyInUse) {
        self.isStorageSecondaryKeyInUse = try container.decode(Bool?.self, forKey: .isStorageSecondaryKeyInUse)
    }
    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.state, forKey: .state)
    if self.storageEndpoint != nil {try container.encode(self.storageEndpoint, forKey: .storageEndpoint)}
    if self.storageAccountAccessKey != nil {try container.encode(self.storageAccountAccessKey, forKey: .storageAccountAccessKey)}
    if self.retentionDays != nil {try container.encode(self.retentionDays, forKey: .retentionDays)}
    if self.auditActionsAndGroups != nil {try container.encode(self.auditActionsAndGroups as! [String]?, forKey: .auditActionsAndGroups)}
    if self.storageAccountSubscriptionId != nil {try container.encode(self.storageAccountSubscriptionId, forKey: .storageAccountSubscriptionId)}
    if self.isStorageSecondaryKeyInUse != nil {try container.encode(self.isStorageSecondaryKeyInUse, forKey: .isStorageSecondaryKeyInUse)}
  }
}

extension DataFactory {
  public static func createDatabaseBlobAuditingPolicyPropertiesProtocol(state: BlobAuditingPolicyStateEnum) -> DatabaseBlobAuditingPolicyPropertiesProtocol {
    return DatabaseBlobAuditingPolicyPropertiesData(state: state)
  }
}


// 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 DatabaseData : DatabaseProtocol, TrackedResourceProtocol, ResourceProtocol {
    public var id: String?
    public var name: String?
    public var type: String?
    public var tags: [String:String]?
    public var location: String
    public var kind: String?
    public var properties: DatabasePropertiesProtocol?

        enum CodingKeys: String, CodingKey {case id = "id"
        case name = "name"
        case type = "type"
        case tags = "tags"
        case location = "location"
        case kind = "kind"
        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)
    }
    if container.contains(.tags) {
        self.tags = try container.decode([String:String]?.self, forKey: .tags)
    }
    self.location = try container.decode(String.self, forKey: .location)
    if container.contains(.kind) {
        self.kind = try container.decode(String?.self, forKey: .kind)
    }
    if container.contains(.properties) {
        self.properties = try container.decode(DatabasePropertiesData?.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.tags != nil {try container.encode(self.tags, forKey: .tags)}
    try container.encode(self.location, forKey: .location)
    if self.kind != nil {try container.encode(self.kind, forKey: .kind)}
    if self.properties != nil {try container.encode(self.properties as! DatabasePropertiesData?, forKey: .properties)}
  }
}

extension DataFactory {
  public static func createDatabaseProtocol(location: String) -> DatabaseProtocol {
    return DatabaseData(location: location)
  }
}


// DatabaseEdition enumerates the values for database edition.

// 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 DatabaseEditionEnum: String, Codable
{
// Basic specifies the basic state for database edition.
    case Basic = "Basic"
// Business specifies the business state for database edition.
    case Business = "Business"
// DataWarehouse specifies the data warehouse state for database edition.
    case DataWarehouse = "DataWarehouse"
// Free specifies the free state for database edition.
    case Free = "Free"
// Premium specifies the premium state for database edition.
    case Premium = "Premium"
// PremiumRS specifies the premium rs state for database edition.
    case PremiumRS = "PremiumRS"
// Standard specifies the standard state for database edition.
    case Standard = "Standard"
// Stretch specifies the stretch state for database edition.
    case Stretch = "Stretch"
// System specifies the system state for database edition.
    case System = "System"
// System2 specifies the system 2 state for database edition.
    case System2 = "System2"
// Web specifies the web state for database edition.
    case Web = "Web"
}


// 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 DatabaseListResultData : DatabaseListResultProtocol {
    public var value: [DatabaseProtocol]

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

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

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

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

extension DataFactory {
  public static func createDatabaseListResultProtocol(value: [DatabaseProtocol]) -> DatabaseListResultProtocol {
    return DatabaseListResultData(value: value)
  }
}


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

        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(DatabaseOperationPropertiesData?.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! DatabaseOperationPropertiesData?, forKey: .properties)}
  }
}

extension DataFactory {
  public static func createDatabaseOperationProtocol() -> DatabaseOperationProtocol {
    return DatabaseOperationData()
  }
}


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

extension DataFactory {
  public static func createDatabaseOperationListResultProtocol() -> DatabaseOperationListResultProtocol {
    return DatabaseOperationListResultData()
  }
}


// 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 DatabaseOperationPropertiesData : DatabaseOperationPropertiesProtocol {
    public var databaseName: String?
    public var operation: String?
    public var operationFriendlyName: String?
    public var percentComplete: Int32?
    public var serverName: String?
    public var startTime: Date?
    public var state: ManagementOperationStateEnum?
    public var errorCode: Int32?
    public var errorDescription: String?
    public var errorSeverity: Int32?
    public var isUserError: Bool?
    public var estimatedCompletionTime: Date?
    public var description: String?
    public var isCancellable: Bool?

        enum CodingKeys: String, CodingKey {case databaseName = "databaseName"
        case operation = "operation"
        case operationFriendlyName = "operationFriendlyName"
        case percentComplete = "percentComplete"
        case serverName = "serverName"
        case startTime = "startTime"
        case state = "state"
        case errorCode = "errorCode"
        case errorDescription = "errorDescription"
        case errorSeverity = "errorSeverity"
        case isUserError = "isUserError"
        case estimatedCompletionTime = "estimatedCompletionTime"
        case description = "description"
        case isCancellable = "isCancellable"
        }

  public init()  {
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.databaseName) {
        self.databaseName = try container.decode(String?.self, forKey: .databaseName)
    }
    if container.contains(.operation) {
        self.operation = try container.decode(String?.self, forKey: .operation)
    }
    if container.contains(.operationFriendlyName) {
        self.operationFriendlyName = try container.decode(String?.self, forKey: .operationFriendlyName)
    }
    if container.contains(.percentComplete) {
        self.percentComplete = try container.decode(Int32?.self, forKey: .percentComplete)
    }
    if container.contains(.serverName) {
        self.serverName = try container.decode(String?.self, forKey: .serverName)
    }
    if container.contains(.startTime) {
        self.startTime = DateConverter.fromString(dateStr: (try container.decode(String?.self, forKey: .startTime)), format: .dateTime)
    }
    if container.contains(.state) {
        self.state = try container.decode(ManagementOperationStateEnum?.self, forKey: .state)
    }
    if container.contains(.errorCode) {
        self.errorCode = try container.decode(Int32?.self, forKey: .errorCode)
    }
    if container.contains(.errorDescription) {
        self.errorDescription = try container.decode(String?.self, forKey: .errorDescription)
    }
    if container.contains(.errorSeverity) {
        self.errorSeverity = try container.decode(Int32?.self, forKey: .errorSeverity)
    }
    if container.contains(.isUserError) {
        self.isUserError = try container.decode(Bool?.self, forKey: .isUserError)
    }
    if container.contains(.estimatedCompletionTime) {
        self.estimatedCompletionTime = DateConverter.fromString(dateStr: (try container.decode(String?.self, forKey: .estimatedCompletionTime)), format: .dateTime)
    }
    if container.contains(.description) {
        self.description = try container.decode(String?.self, forKey: .description)
    }
    if container.contains(.isCancellable) {
        self.isCancellable = try container.decode(Bool?.self, forKey: .isCancellable)
    }
    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.databaseName != nil {try container.encode(self.databaseName, forKey: .databaseName)}
    if self.operation != nil {try container.encode(self.operation, forKey: .operation)}
    if self.operationFriendlyName != nil {try container.encode(self.operationFriendlyName, forKey: .operationFriendlyName)}
    if self.percentComplete != nil {try container.encode(self.percentComplete, forKey: .percentComplete)}
    if self.serverName != nil {try container.encode(self.serverName, forKey: .serverName)}
    if self.startTime != nil {
        try container.encode(DateConverter.toString(date: self.startTime!, format: .dateTime), forKey: .startTime)
    }
    if self.state != nil {try container.encode(self.state, forKey: .state)}
    if self.errorCode != nil {try container.encode(self.errorCode, forKey: .errorCode)}
    if self.errorDescription != nil {try container.encode(self.errorDescription, forKey: .errorDescription)}
    if self.errorSeverity != nil {try container.encode(self.errorSeverity, forKey: .errorSeverity)}
    if self.isUserError != nil {try container.encode(self.isUserError, forKey: .isUserError)}
    if self.estimatedCompletionTime != nil {
        try container.encode(DateConverter.toString(date: self.estimatedCompletionTime!, format: .dateTime), forKey: .estimatedCompletionTime)
    }
    if self.description != nil {try container.encode(self.description, forKey: .description)}
    if self.isCancellable != nil {try container.encode(self.isCancellable, forKey: .isCancellable)}
  }
}

extension DataFactory {
  public static func createDatabaseOperationPropertiesProtocol() -> DatabaseOperationPropertiesProtocol {
    return DatabaseOperationPropertiesData()
  }
}


// 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 DatabasePropertiesData : DatabasePropertiesProtocol {
    public var collation: String?
    public var creationDate: Date?
    public var containmentState: Int64?
    public var currentServiceObjectiveId: String?
    public var databaseId: String?
    public var earliestRestoreDate: Date?
    public var createMode: CreateModeEnum?
    public var sourceDatabaseId: String?
    public var sourceDatabaseDeletionDate: Date?
    public var restorePointInTime: Date?
    public var recoveryServicesRecoveryPointResourceId: String?
    public var edition: DatabaseEditionEnum?
    public var maxSizeBytes: String?
    public var requestedServiceObjectiveId: String?
    public var requestedServiceObjectiveName: ServiceObjectiveNameEnum?
    public var serviceLevelObjective: ServiceObjectiveNameEnum?
    public var status: String?
    public var elasticPoolName: String?
    public var defaultSecondaryLocation: String?
    public var serviceTierAdvisors: [ServiceTierAdvisorProtocol?]?
    public var transparentDataEncryption: [TransparentDataEncryptionProtocol?]?
    public var recommendedIndex: [RecommendedIndexProtocol?]?
    public var failoverGroupId: String?
    public var readScale: ReadScaleEnum?
    public var sampleName: SampleNameEnum?
    public var zoneRedundant: Bool?

        enum CodingKeys: String, CodingKey {case collation = "collation"
        case creationDate = "creationDate"
        case containmentState = "containmentState"
        case currentServiceObjectiveId = "currentServiceObjectiveId"
        case databaseId = "databaseId"
        case earliestRestoreDate = "earliestRestoreDate"
        case createMode = "createMode"
        case sourceDatabaseId = "sourceDatabaseId"
        case sourceDatabaseDeletionDate = "sourceDatabaseDeletionDate"
        case restorePointInTime = "restorePointInTime"
        case recoveryServicesRecoveryPointResourceId = "recoveryServicesRecoveryPointResourceId"
        case edition = "edition"
        case maxSizeBytes = "maxSizeBytes"
        case requestedServiceObjectiveId = "requestedServiceObjectiveId"
        case requestedServiceObjectiveName = "requestedServiceObjectiveName"
        case serviceLevelObjective = "serviceLevelObjective"
        case status = "status"
        case elasticPoolName = "elasticPoolName"
        case defaultSecondaryLocation = "defaultSecondaryLocation"
        case serviceTierAdvisors = "serviceTierAdvisors"
        case transparentDataEncryption = "transparentDataEncryption"
        case recommendedIndex = "recommendedIndex"
        case failoverGroupId = "failoverGroupId"
        case readScale = "readScale"
        case sampleName = "sampleName"
        case zoneRedundant = "zoneRedundant"
        }

  public init()  {
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.collation) {
        self.collation = try container.decode(String?.self, forKey: .collation)
    }
    if container.contains(.creationDate) {
        self.creationDate = DateConverter.fromString(dateStr: (try container.decode(String?.self, forKey: .creationDate)), format: .dateTime)
    }
    if container.contains(.containmentState) {
        self.containmentState = try container.decode(Int64?.self, forKey: .containmentState)
    }
    if container.contains(.currentServiceObjectiveId) {
        self.currentServiceObjectiveId = try container.decode(String?.self, forKey: .currentServiceObjectiveId)
    }
    if container.contains(.databaseId) {
        self.databaseId = try container.decode(String?.self, forKey: .databaseId)
    }
    if container.contains(.earliestRestoreDate) {
        self.earliestRestoreDate = DateConverter.fromString(dateStr: (try container.decode(String?.self, forKey: .earliestRestoreDate)), format: .dateTime)
    }
    if container.contains(.createMode) {
        self.createMode = try container.decode(CreateModeEnum?.self, forKey: .createMode)
    }
    if container.contains(.sourceDatabaseId) {
        self.sourceDatabaseId = try container.decode(String?.self, forKey: .sourceDatabaseId)
    }
    if container.contains(.sourceDatabaseDeletionDate) {
        self.sourceDatabaseDeletionDate = DateConverter.fromString(dateStr: (try container.decode(String?.self, forKey: .sourceDatabaseDeletionDate)), format: .dateTime)
    }
    if container.contains(.restorePointInTime) {
        self.restorePointInTime = DateConverter.fromString(dateStr: (try container.decode(String?.self, forKey: .restorePointInTime)), format: .dateTime)
    }
    if container.contains(.recoveryServicesRecoveryPointResourceId) {
        self.recoveryServicesRecoveryPointResourceId = try container.decode(String?.self, forKey: .recoveryServicesRecoveryPointResourceId)
    }
    if container.contains(.edition) {
        self.edition = try container.decode(DatabaseEditionEnum?.self, forKey: .edition)
    }
    if container.contains(.maxSizeBytes) {
        self.maxSizeBytes = try container.decode(String?.self, forKey: .maxSizeBytes)
    }
    if container.contains(.requestedServiceObjectiveId) {
        self.requestedServiceObjectiveId = try container.decode(String?.self, forKey: .requestedServiceObjectiveId)
    }
    if container.contains(.requestedServiceObjectiveName) {
        self.requestedServiceObjectiveName = try container.decode(ServiceObjectiveNameEnum?.self, forKey: .requestedServiceObjectiveName)
    }
    if container.contains(.serviceLevelObjective) {
        self.serviceLevelObjective = try container.decode(ServiceObjectiveNameEnum?.self, forKey: .serviceLevelObjective)
    }
    if container.contains(.status) {
        self.status = try container.decode(String?.self, forKey: .status)
    }
    if container.contains(.elasticPoolName) {
        self.elasticPoolName = try container.decode(String?.self, forKey: .elasticPoolName)
    }
    if container.contains(.defaultSecondaryLocation) {
        self.defaultSecondaryLocation = try container.decode(String?.self, forKey: .defaultSecondaryLocation)
    }
    if container.contains(.serviceTierAdvisors) {
        self.serviceTierAdvisors = try container.decode([ServiceTierAdvisorData?]?.self, forKey: .serviceTierAdvisors)
    }
    if container.contains(.transparentDataEncryption) {
        self.transparentDataEncryption = try container.decode([TransparentDataEncryptionData?]?.self, forKey: .transparentDataEncryption)
    }
    if container.contains(.recommendedIndex) {
        self.recommendedIndex = try container.decode([RecommendedIndexData?]?.self, forKey: .recommendedIndex)
    }
    if container.contains(.failoverGroupId) {
        self.failoverGroupId = try container.decode(String?.self, forKey: .failoverGroupId)
    }
    if container.contains(.readScale) {
        self.readScale = try container.decode(ReadScaleEnum?.self, forKey: .readScale)
    }
    if container.contains(.sampleName) {
        self.sampleName = try container.decode(SampleNameEnum?.self, forKey: .sampleName)
    }
    if container.contains(.zoneRedundant) {
        self.zoneRedundant = try container.decode(Bool?.self, forKey: .zoneRedundant)
    }
    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.collation != nil {try container.encode(self.collation, forKey: .collation)}
    if self.creationDate != nil {
        try container.encode(DateConverter.toString(date: self.creationDate!, format: .dateTime), forKey: .creationDate)
    }
    if self.containmentState != nil {try container.encode(self.containmentState, forKey: .containmentState)}
    if self.currentServiceObjectiveId != nil {try container.encode(self.currentServiceObjectiveId, forKey: .currentServiceObjectiveId)}
    if self.databaseId != nil {try container.encode(self.databaseId, forKey: .databaseId)}
    if self.earliestRestoreDate != nil {
        try container.encode(DateConverter.toString(date: self.earliestRestoreDate!, format: .dateTime), forKey: .earliestRestoreDate)
    }
    if self.createMode != nil {try container.encode(self.createMode, forKey: .createMode)}
    if self.sourceDatabaseId != nil {try container.encode(self.sourceDatabaseId, forKey: .sourceDatabaseId)}
    if self.sourceDatabaseDeletionDate != nil {
        try container.encode(DateConverter.toString(date: self.sourceDatabaseDeletionDate!, format: .dateTime), forKey: .sourceDatabaseDeletionDate)
    }
    if self.restorePointInTime != nil {
        try container.encode(DateConverter.toString(date: self.restorePointInTime!, format: .dateTime), forKey: .restorePointInTime)
    }
    if self.recoveryServicesRecoveryPointResourceId != nil {try container.encode(self.recoveryServicesRecoveryPointResourceId, forKey: .recoveryServicesRecoveryPointResourceId)}
    if self.edition != nil {try container.encode(self.edition, forKey: .edition)}
    if self.maxSizeBytes != nil {try container.encode(self.maxSizeBytes, forKey: .maxSizeBytes)}
    if self.requestedServiceObjectiveId != nil {try container.encode(self.requestedServiceObjectiveId, forKey: .requestedServiceObjectiveId)}
    if self.requestedServiceObjectiveName != nil {try container.encode(self.requestedServiceObjectiveName, forKey: .requestedServiceObjectiveName)}
    if self.serviceLevelObjective != nil {try container.encode(self.serviceLevelObjective, forKey: .serviceLevelObjective)}
    if self.status != nil {try container.encode(self.status, forKey: .status)}
    if self.elasticPoolName != nil {try container.encode(self.elasticPoolName, forKey: .elasticPoolName)}
    if self.defaultSecondaryLocation != nil {try container.encode(self.defaultSecondaryLocation, forKey: .defaultSecondaryLocation)}
    if self.serviceTierAdvisors != nil {try container.encode(self.serviceTierAdvisors as! [ServiceTierAdvisorData?]?, forKey: .serviceTierAdvisors)}
    if self.transparentDataEncryption != nil {try container.encode(self.transparentDataEncryption as! [TransparentDataEncryptionData?]?, forKey: .transparentDataEncryption)}
    if self.recommendedIndex != nil {try container.encode(self.recommendedIndex as! [RecommendedIndexData?]?, forKey: .recommendedIndex)}
    if self.failoverGroupId != nil {try container.encode(self.failoverGroupId, forKey: .failoverGroupId)}
    if self.readScale != nil {try container.encode(self.readScale, forKey: .readScale)}
    if self.sampleName != nil {try container.encode(self.sampleName, forKey: .sampleName)}
    if self.zoneRedundant != nil {try container.encode(self.zoneRedundant, forKey: .zoneRedundant)}
  }
}

extension DataFactory {
  public static func createDatabasePropertiesProtocol() -> DatabasePropertiesProtocol {
    return DatabasePropertiesData()
  }
}


// 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 DatabaseSecurityAlertPolicyData : DatabaseSecurityAlertPolicyProtocol, ProxyResourceProtocol, ResourceProtocol {
    public var id: String?
    public var name: String?
    public var type: String?
    public var location: String?
    public var kind: String?
    public var properties: DatabaseSecurityAlertPolicyPropertiesProtocol?

        enum CodingKeys: String, CodingKey {case id = "id"
        case name = "name"
        case type = "type"
        case location = "location"
        case kind = "kind"
        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(.kind) {
        self.kind = try container.decode(String?.self, forKey: .kind)
    }
    if container.contains(.properties) {
        self.properties = try container.decode(DatabaseSecurityAlertPolicyPropertiesData?.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.kind != nil {try container.encode(self.kind, forKey: .kind)}
    if self.properties != nil {try container.encode(self.properties as! DatabaseSecurityAlertPolicyPropertiesData?, forKey: .properties)}
  }
}

extension DataFactory {
  public static func createDatabaseSecurityAlertPolicyProtocol() -> DatabaseSecurityAlertPolicyProtocol {
    return DatabaseSecurityAlertPolicyData()
  }
}


// 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 DatabaseSecurityAlertPolicyPropertiesData : DatabaseSecurityAlertPolicyPropertiesProtocol {
    public var state: SecurityAlertPolicyStateEnum
    public var disabledAlerts: String?
    public var emailAddresses: String?
    public var emailAccountAdmins: SecurityAlertPolicyEmailAccountAdminsEnum?
    public var storageEndpoint: String?
    public var storageAccountAccessKey: String?
    public var retentionDays: Int32?
    public var useServerDefault: SecurityAlertPolicyUseServerDefaultEnum?

        enum CodingKeys: String, CodingKey {case state = "state"
        case disabledAlerts = "disabledAlerts"
        case emailAddresses = "emailAddresses"
        case emailAccountAdmins = "emailAccountAdmins"
        case storageEndpoint = "storageEndpoint"
        case storageAccountAccessKey = "storageAccountAccessKey"
        case retentionDays = "retentionDays"
        case useServerDefault = "useServerDefault"
        }

  public init(state: SecurityAlertPolicyStateEnum)  {
    self.state = state
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      self.state = try container.decode(SecurityAlertPolicyStateEnum.self, forKey: .state)
    if container.contains(.disabledAlerts) {
        self.disabledAlerts = try container.decode(String?.self, forKey: .disabledAlerts)
    }
    if container.contains(.emailAddresses) {
        self.emailAddresses = try container.decode(String?.self, forKey: .emailAddresses)
    }
    if container.contains(.emailAccountAdmins) {
        self.emailAccountAdmins = try container.decode(SecurityAlertPolicyEmailAccountAdminsEnum?.self, forKey: .emailAccountAdmins)
    }
    if container.contains(.storageEndpoint) {
        self.storageEndpoint = try container.decode(String?.self, forKey: .storageEndpoint)
    }
    if container.contains(.storageAccountAccessKey) {
        self.storageAccountAccessKey = try container.decode(String?.self, forKey: .storageAccountAccessKey)
    }
    if container.contains(.retentionDays) {
        self.retentionDays = try container.decode(Int32?.self, forKey: .retentionDays)
    }
    if container.contains(.useServerDefault) {
        self.useServerDefault = try container.decode(SecurityAlertPolicyUseServerDefaultEnum?.self, forKey: .useServerDefault)
    }
    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.state, forKey: .state)
    if self.disabledAlerts != nil {try container.encode(self.disabledAlerts, forKey: .disabledAlerts)}
    if self.emailAddresses != nil {try container.encode(self.emailAddresses, forKey: .emailAddresses)}
    if self.emailAccountAdmins != nil {try container.encode(self.emailAccountAdmins, forKey: .emailAccountAdmins)}
    if self.storageEndpoint != nil {try container.encode(self.storageEndpoint, forKey: .storageEndpoint)}
    if self.storageAccountAccessKey != nil {try container.encode(self.storageAccountAccessKey, forKey: .storageAccountAccessKey)}
    if self.retentionDays != nil {try container.encode(self.retentionDays, forKey: .retentionDays)}
    if self.useServerDefault != nil {try container.encode(self.useServerDefault, forKey: .useServerDefault)}
  }
}

extension DataFactory {
  public static func createDatabaseSecurityAlertPolicyPropertiesProtocol(state: SecurityAlertPolicyStateEnum) -> DatabaseSecurityAlertPolicyPropertiesProtocol {
    return DatabaseSecurityAlertPolicyPropertiesData(state: state)
  }
}


// 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 DatabaseUpdateData : DatabaseUpdateProtocol, ResourceProtocol {
    public var id: String?
    public var name: String?
    public var type: String?
    public var tags: [String:String]?
    public var properties: DatabasePropertiesProtocol?

        enum CodingKeys: String, CodingKey {case id = "id"
        case name = "name"
        case type = "type"
        case tags = "tags"
        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(.tags) {
        self.tags = try container.decode([String:String]?.self, forKey: .tags)
    }
    if container.contains(.properties) {
        self.properties = try container.decode(DatabasePropertiesData?.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.tags != nil {try container.encode(self.tags, forKey: .tags)}
    if self.properties != nil {try container.encode(self.properties as! DatabasePropertiesData?, forKey: .properties)}
  }
}

extension DataFactory {
  public static func createDatabaseUpdateProtocol() -> DatabaseUpdateProtocol {
    return DatabaseUpdateData()
  }
}


// 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 DatabaseUsageData : DatabaseUsageProtocol {
    public var name: String?
    public var resourceName: String?
    public var displayName: String?
    public var currentValue: Double?
    public var limit: Double?
    public var unit: String?
    public var nextResetTime: Date?

        enum CodingKeys: String, CodingKey {case name = "name"
        case resourceName = "resourceName"
        case displayName = "displayName"
        case currentValue = "currentValue"
        case limit = "limit"
        case unit = "unit"
        case nextResetTime = "nextResetTime"
        }

  public init()  {
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.name) {
        self.name = try container.decode(String?.self, forKey: .name)
    }
    if container.contains(.resourceName) {
        self.resourceName = try container.decode(String?.self, forKey: .resourceName)
    }
    if container.contains(.displayName) {
        self.displayName = try container.decode(String?.self, forKey: .displayName)
    }
    if container.contains(.currentValue) {
        self.currentValue = try container.decode(Double?.self, forKey: .currentValue)
    }
    if container.contains(.limit) {
        self.limit = try container.decode(Double?.self, forKey: .limit)
    }
    if container.contains(.unit) {
        self.unit = try container.decode(String?.self, forKey: .unit)
    }
    if container.contains(.nextResetTime) {
        self.nextResetTime = DateConverter.fromString(dateStr: (try container.decode(String?.self, forKey: .nextResetTime)), format: .dateTime)
    }
    if var pageDecoder = decoder as? PageDecoder  {
      if pageDecoder.isPagedData,
        let nextLinkName = pageDecoder.nextLinkName {
          pageDecoder.nextLink = try UnknownCodingKey.decodeStringForKey(decoder: decoder, keyForDecode: nextLinkName)
      }
    }
  }

  public func encode(to encoder: Encoder) throws {
    var container = encoder.container(keyedBy: CodingKeys.self)
    if self.name != nil {try container.encode(self.name, forKey: .name)}
    if self.resourceName != nil {try container.encode(self.resourceName, forKey: .resourceName)}
    if self.displayName != nil {try container.encode(self.displayName, forKey: .displayName)}
    if self.currentValue != nil {try container.encode(self.currentValue, forKey: .currentValue)}
    if self.limit != nil {try container.encode(self.limit, forKey: .limit)}
    if self.unit != nil {try container.encode(self.unit, forKey: .unit)}
    if self.nextResetTime != nil {
        try container.encode(DateConverter.toString(date: self.nextResetTime!, format: .dateTime), forKey: .nextResetTime)
    }
  }
}

extension DataFactory {
  public static func createDatabaseUsageProtocol() -> DatabaseUsageProtocol {
    return DatabaseUsageData()
  }
}


// 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 DatabaseUsageListResultData : DatabaseUsageListResultProtocol {
    public var value: [DatabaseUsageProtocol]

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

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

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

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

extension DataFactory {
  public static func createDatabaseUsageListResultProtocol(value: [DatabaseUsageProtocol]) -> DatabaseUsageListResultProtocol {
    return DatabaseUsageListResultData(value: value)
  }
}


// DataMaskingFunction enumerates the values for data masking function.

// 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 DataMaskingFunctionEnum: String, Codable
{
// DataMaskingFunctionCCN specifies the data masking function ccn state for data masking function.
    case DataMaskingFunctionCCN = "CCN"
// DataMaskingFunctionDefault specifies the data masking function default state for data masking function.
    case DataMaskingFunctionDefault = "Default"
// DataMaskingFunctionEmail specifies the data masking function email state for data masking function.
    case DataMaskingFunctionEmail = "Email"
// DataMaskingFunctionNumber specifies the data masking function number state for data masking function.
    case DataMaskingFunctionNumber = "Number"
// DataMaskingFunctionSSN specifies the data masking function ssn state for data masking function.
    case DataMaskingFunctionSSN = "SSN"
// DataMaskingFunctionText specifies the data masking function text state for data masking function.
    case DataMaskingFunctionText = "Text"
}


// 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 DataMaskingPolicyData : DataMaskingPolicyProtocol, ProxyResourceProtocol, ResourceProtocol {
    public var id: String?
    public var name: String?
    public var type: String?
    public var properties: DataMaskingPolicyPropertiesProtocol?
    public var location: String?
    public var kind: String?

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

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

extension DataFactory {
  public static func createDataMaskingPolicyProtocol() -> DataMaskingPolicyProtocol {
    return DataMaskingPolicyData()
  }
}


// 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 DataMaskingPolicyPropertiesData : DataMaskingPolicyPropertiesProtocol {
    public var dataMaskingState: DataMaskingStateEnum
    public var exemptPrincipals: String?
    public var applicationPrincipals: String?
    public var maskingLevel: String?

        enum CodingKeys: String, CodingKey {case dataMaskingState = "dataMaskingState"
        case exemptPrincipals = "exemptPrincipals"
        case applicationPrincipals = "applicationPrincipals"
        case maskingLevel = "maskingLevel"
        }

  public init(dataMaskingState: DataMaskingStateEnum)  {
    self.dataMaskingState = dataMaskingState
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      self.dataMaskingState = try container.decode(DataMaskingStateEnum.self, forKey: .dataMaskingState)
    if container.contains(.exemptPrincipals) {
        self.exemptPrincipals = try container.decode(String?.self, forKey: .exemptPrincipals)
    }
    if container.contains(.applicationPrincipals) {
        self.applicationPrincipals = try container.decode(String?.self, forKey: .applicationPrincipals)
    }
    if container.contains(.maskingLevel) {
        self.maskingLevel = try container.decode(String?.self, forKey: .maskingLevel)
    }
    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.dataMaskingState, forKey: .dataMaskingState)
    if self.exemptPrincipals != nil {try container.encode(self.exemptPrincipals, forKey: .exemptPrincipals)}
    if self.applicationPrincipals != nil {try container.encode(self.applicationPrincipals, forKey: .applicationPrincipals)}
    if self.maskingLevel != nil {try container.encode(self.maskingLevel, forKey: .maskingLevel)}
  }
}

extension DataFactory {
  public static func createDataMaskingPolicyPropertiesProtocol(dataMaskingState: DataMaskingStateEnum) -> DataMaskingPolicyPropertiesProtocol {
    return DataMaskingPolicyPropertiesData(dataMaskingState: dataMaskingState)
  }
}


// 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 DataMaskingRuleData : DataMaskingRuleProtocol, ProxyResourceProtocol, ResourceProtocol {
    public var id: String?
    public var name: String?
    public var type: String?
    public var properties: DataMaskingRulePropertiesProtocol?
    public var location: String?
    public var kind: String?

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

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

extension DataFactory {
  public static func createDataMaskingRuleProtocol() -> DataMaskingRuleProtocol {
    return DataMaskingRuleData()
  }
}


// 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 DataMaskingRuleListResultData : DataMaskingRuleListResultProtocol {
    public var value: [DataMaskingRuleProtocol?]?

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

  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([DataMaskingRuleData?]?.self, forKey: .value)
    }
    if var pageDecoder = decoder as? PageDecoder  {
      if pageDecoder.isPagedData,
        let nextLinkName = pageDecoder.nextLinkName {
          pageDecoder.nextLink = try UnknownCodingKey.decodeStringForKey(decoder: decoder, keyForDecode: nextLinkName)
      }
    }
  }

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

extension DataFactory {
  public static func createDataMaskingRuleListResultProtocol() -> DataMaskingRuleListResultProtocol {
    return DataMaskingRuleListResultData()
  }
}


// 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 DataMaskingRulePropertiesData : DataMaskingRulePropertiesProtocol {
    public var id: String?
    public var aliasName: String?
    public var ruleState: DataMaskingRuleStateEnum?
    public var schemaName: String
    public var tableName: String
    public var columnName: String
    public var maskingFunction: DataMaskingFunctionEnum
    public var numberFrom: String?
    public var numberTo: String?
    public var prefixSize: String?
    public var suffixSize: String?
    public var replacementString: String?

        enum CodingKeys: String, CodingKey {case id = "id"
        case aliasName = "aliasName"
        case ruleState = "ruleState"
        case schemaName = "schemaName"
        case tableName = "tableName"
        case columnName = "columnName"
        case maskingFunction = "maskingFunction"
        case numberFrom = "numberFrom"
        case numberTo = "numberTo"
        case prefixSize = "prefixSize"
        case suffixSize = "suffixSize"
        case replacementString = "replacementString"
        }

  public init(schemaName: String, tableName: String, columnName: String, maskingFunction: DataMaskingFunctionEnum)  {
    self.schemaName = schemaName
    self.tableName = tableName
    self.columnName = columnName
    self.maskingFunction = maskingFunction
  }

  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(.aliasName) {
        self.aliasName = try container.decode(String?.self, forKey: .aliasName)
    }
    if container.contains(.ruleState) {
        self.ruleState = try container.decode(DataMaskingRuleStateEnum?.self, forKey: .ruleState)
    }
    self.schemaName = try container.decode(String.self, forKey: .schemaName)
    self.tableName = try container.decode(String.self, forKey: .tableName)
    self.columnName = try container.decode(String.self, forKey: .columnName)
    self.maskingFunction = try container.decode(DataMaskingFunctionEnum.self, forKey: .maskingFunction)
    if container.contains(.numberFrom) {
        self.numberFrom = try container.decode(String?.self, forKey: .numberFrom)
    }
    if container.contains(.numberTo) {
        self.numberTo = try container.decode(String?.self, forKey: .numberTo)
    }
    if container.contains(.prefixSize) {
        self.prefixSize = try container.decode(String?.self, forKey: .prefixSize)
    }
    if container.contains(.suffixSize) {
        self.suffixSize = try container.decode(String?.self, forKey: .suffixSize)
    }
    if container.contains(.replacementString) {
        self.replacementString = try container.decode(String?.self, forKey: .replacementString)
    }
    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.aliasName != nil {try container.encode(self.aliasName, forKey: .aliasName)}
    if self.ruleState != nil {try container.encode(self.ruleState, forKey: .ruleState)}
    try container.encode(self.schemaName, forKey: .schemaName)
    try container.encode(self.tableName, forKey: .tableName)
    try container.encode(self.columnName, forKey: .columnName)
    try container.encode(self.maskingFunction, forKey: .maskingFunction)
    if self.numberFrom != nil {try container.encode(self.numberFrom, forKey: .numberFrom)}
    if self.numberTo != nil {try container.encode(self.numberTo, forKey: .numberTo)}
    if self.prefixSize != nil {try container.encode(self.prefixSize, forKey: .prefixSize)}
    if self.suffixSize != nil {try container.encode(self.suffixSize, forKey: .suffixSize)}
    if self.replacementString != nil {try container.encode(self.replacementString, forKey: .replacementString)}
  }
}

extension DataFactory {
  public static func createDataMaskingRulePropertiesProtocol(schemaName: String, tableName: String, columnName: String, maskingFunction: DataMaskingFunctionEnum) -> DataMaskingRulePropertiesProtocol {
    return DataMaskingRulePropertiesData(schemaName: schemaName, tableName: tableName, columnName: columnName, maskingFunction: maskingFunction)
  }
}


// DataMaskingRuleState enumerates the values for data masking rule state.

// 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 DataMaskingRuleStateEnum: String, Codable
{
// DataMaskingRuleStateDisabled specifies the data masking rule state disabled state for data masking rule state.
    case DataMaskingRuleStateDisabled = "Disabled"
// DataMaskingRuleStateEnabled specifies the data masking rule state enabled state for data masking rule state.
    case DataMaskingRuleStateEnabled = "Enabled"
}


// DataMaskingState enumerates the values for data masking state.

// 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 DataMaskingStateEnum: String, Codable
{
// DataMaskingStateDisabled specifies the data masking state disabled state for data masking state.
    case DataMaskingStateDisabled = "Disabled"
// DataMaskingStateEnabled specifies the data masking state enabled state for data masking state.
    case DataMaskingStateEnabled = "Enabled"
}


// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
import Foundation
import azureSwiftRuntime
internal struct EditionCapabilityData : EditionCapabilityProtocol {
    public var name: String?
    public var status: CapabilityStatusEnum?
    public var supportedServiceLevelObjectives: [ServiceObjectiveCapabilityProtocol?]?
    public var zoneRedundant: Bool?

        enum CodingKeys: String, CodingKey {case name = "name"
        case status = "status"
        case supportedServiceLevelObjectives = "supportedServiceLevelObjectives"
        case zoneRedundant = "zoneRedundant"
        }

  public init()  {
  }

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

  public func encode(to encoder: Encoder) throws {
    var container = encoder.container(keyedBy: CodingKeys.self)
    if self.name != nil {try container.encode(self.name, forKey: .name)}
    if self.status != nil {try container.encode(self.status, forKey: .status)}
    if self.supportedServiceLevelObjectives != nil {try container.encode(self.supportedServiceLevelObjectives as! [ServiceObjectiveCapabilityData?]?, forKey: .supportedServiceLevelObjectives)}
    if self.zoneRedundant != nil {try container.encode(self.zoneRedundant, forKey: .zoneRedundant)}
  }
}

extension DataFactory {
  public static func createEditionCapabilityProtocol() -> EditionCapabilityProtocol {
    return EditionCapabilityData()
  }
}


// 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 ElasticPoolActivityData : ElasticPoolActivityProtocol, ProxyResourceProtocol, ResourceProtocol {
    public var id: String?
    public var name: String?
    public var type: String?
    public var location: String?
    public var properties: ElasticPoolActivityPropertiesProtocol?

        enum CodingKeys: String, CodingKey {case id = "id"
        case name = "name"
        case type = "type"
        case location = "location"
        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(.properties) {
        self.properties = try container.decode(ElasticPoolActivityPropertiesData?.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.properties != nil {try container.encode(self.properties as! ElasticPoolActivityPropertiesData?, forKey: .properties)}
  }
}

extension DataFactory {
  public static func createElasticPoolActivityProtocol() -> ElasticPoolActivityProtocol {
    return ElasticPoolActivityData()
  }
}


// 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 ElasticPoolActivityListResultData : ElasticPoolActivityListResultProtocol {
    public var value: [ElasticPoolActivityProtocol]

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

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

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

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

extension DataFactory {
  public static func createElasticPoolActivityListResultProtocol(value: [ElasticPoolActivityProtocol]) -> ElasticPoolActivityListResultProtocol {
    return ElasticPoolActivityListResultData(value: value)
  }
}


// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
import Foundation
import azureSwiftRuntime
internal struct ElasticPoolActivityPropertiesData : ElasticPoolActivityPropertiesProtocol {
    public var endTime: Date?
    public var errorCode: Int32?
    public var errorMessage: String?
    public var errorSeverity: Int32?
    public var operation: String?
    public var operationId: String?
    public var percentComplete: Int32?
    public var requestedDatabaseDtuMax: Int32?
    public var requestedDatabaseDtuMin: Int32?
    public var requestedDtu: Int32?
    public var requestedElasticPoolName: String?
    public var requestedStorageLimitInGB: Int64?
    public var elasticPoolName: String?
    public var serverName: String?
    public var startTime: Date?
    public var state: String?
    public var requestedStorageLimitInMB: Int32?
    public var requestedDatabaseDtuGuarantee: Int32?
    public var requestedDatabaseDtuCap: Int32?
    public var requestedDtuGuarantee: Int32?

        enum CodingKeys: String, CodingKey {case endTime = "endTime"
        case errorCode = "errorCode"
        case errorMessage = "errorMessage"
        case errorSeverity = "errorSeverity"
        case operation = "operation"
        case operationId = "operationId"
        case percentComplete = "percentComplete"
        case requestedDatabaseDtuMax = "requestedDatabaseDtuMax"
        case requestedDatabaseDtuMin = "requestedDatabaseDtuMin"
        case requestedDtu = "requestedDtu"
        case requestedElasticPoolName = "requestedElasticPoolName"
        case requestedStorageLimitInGB = "requestedStorageLimitInGB"
        case elasticPoolName = "elasticPoolName"
        case serverName = "serverName"
        case startTime = "startTime"
        case state = "state"
        case requestedStorageLimitInMB = "requestedStorageLimitInMB"
        case requestedDatabaseDtuGuarantee = "requestedDatabaseDtuGuarantee"
        case requestedDatabaseDtuCap = "requestedDatabaseDtuCap"
        case requestedDtuGuarantee = "requestedDtuGuarantee"
        }

  public init()  {
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.endTime) {
        self.endTime = DateConverter.fromString(dateStr: (try container.decode(String?.self, forKey: .endTime)), format: .dateTime)
    }
    if container.contains(.errorCode) {
        self.errorCode = try container.decode(Int32?.self, forKey: .errorCode)
    }
    if container.contains(.errorMessage) {
        self.errorMessage = try container.decode(String?.self, forKey: .errorMessage)
    }
    if container.contains(.errorSeverity) {
        self.errorSeverity = try container.decode(Int32?.self, forKey: .errorSeverity)
    }
    if container.contains(.operation) {
        self.operation = try container.decode(String?.self, forKey: .operation)
    }
    if container.contains(.operationId) {
        self.operationId = try container.decode(String?.self, forKey: .operationId)
    }
    if container.contains(.percentComplete) {
        self.percentComplete = try container.decode(Int32?.self, forKey: .percentComplete)
    }
    if container.contains(.requestedDatabaseDtuMax) {
        self.requestedDatabaseDtuMax = try container.decode(Int32?.self, forKey: .requestedDatabaseDtuMax)
    }
    if container.contains(.requestedDatabaseDtuMin) {
        self.requestedDatabaseDtuMin = try container.decode(Int32?.self, forKey: .requestedDatabaseDtuMin)
    }
    if container.contains(.requestedDtu) {
        self.requestedDtu = try container.decode(Int32?.self, forKey: .requestedDtu)
    }
    if container.contains(.requestedElasticPoolName) {
        self.requestedElasticPoolName = try container.decode(String?.self, forKey: .requestedElasticPoolName)
    }
    if container.contains(.requestedStorageLimitInGB) {
        self.requestedStorageLimitInGB = try container.decode(Int64?.self, forKey: .requestedStorageLimitInGB)
    }
    if container.contains(.elasticPoolName) {
        self.elasticPoolName = try container.decode(String?.self, forKey: .elasticPoolName)
    }
    if container.contains(.serverName) {
        self.serverName = try container.decode(String?.self, forKey: .serverName)
    }
    if container.contains(.startTime) {
        self.startTime = DateConverter.fromString(dateStr: (try container.decode(String?.self, forKey: .startTime)), format: .dateTime)
    }
    if container.contains(.state) {
        self.state = try container.decode(String?.self, forKey: .state)
    }
    if container.contains(.requestedStorageLimitInMB) {
        self.requestedStorageLimitInMB = try container.decode(Int32?.self, forKey: .requestedStorageLimitInMB)
    }
    if container.contains(.requestedDatabaseDtuGuarantee) {
        self.requestedDatabaseDtuGuarantee = try container.decode(Int32?.self, forKey: .requestedDatabaseDtuGuarantee)
    }
    if container.contains(.requestedDatabaseDtuCap) {
        self.requestedDatabaseDtuCap = try container.decode(Int32?.self, forKey: .requestedDatabaseDtuCap)
    }
    if container.contains(.requestedDtuGuarantee) {
        self.requestedDtuGuarantee = try container.decode(Int32?.self, forKey: .requestedDtuGuarantee)
    }
    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.endTime != nil {
        try container.encode(DateConverter.toString(date: self.endTime!, format: .dateTime), forKey: .endTime)
    }
    if self.errorCode != nil {try container.encode(self.errorCode, forKey: .errorCode)}
    if self.errorMessage != nil {try container.encode(self.errorMessage, forKey: .errorMessage)}
    if self.errorSeverity != nil {try container.encode(self.errorSeverity, forKey: .errorSeverity)}
    if self.operation != nil {try container.encode(self.operation, forKey: .operation)}
    if self.operationId != nil {try container.encode(self.operationId, forKey: .operationId)}
    if self.percentComplete != nil {try container.encode(self.percentComplete, forKey: .percentComplete)}
    if self.requestedDatabaseDtuMax != nil {try container.encode(self.requestedDatabaseDtuMax, forKey: .requestedDatabaseDtuMax)}
    if self.requestedDatabaseDtuMin != nil {try container.encode(self.requestedDatabaseDtuMin, forKey: .requestedDatabaseDtuMin)}
    if self.requestedDtu != nil {try container.encode(self.requestedDtu, forKey: .requestedDtu)}
    if self.requestedElasticPoolName != nil {try container.encode(self.requestedElasticPoolName, forKey: .requestedElasticPoolName)}
    if self.requestedStorageLimitInGB != nil {try container.encode(self.requestedStorageLimitInGB, forKey: .requestedStorageLimitInGB)}
    if self.elasticPoolName != nil {try container.encode(self.elasticPoolName, forKey: .elasticPoolName)}
    if self.serverName != nil {try container.encode(self.serverName, forKey: .serverName)}
    if self.startTime != nil {
        try container.encode(DateConverter.toString(date: self.startTime!, format: .dateTime), forKey: .startTime)
    }
    if self.state != nil {try container.encode(self.state, forKey: .state)}
    if self.requestedStorageLimitInMB != nil {try container.encode(self.requestedStorageLimitInMB, forKey: .requestedStorageLimitInMB)}
    if self.requestedDatabaseDtuGuarantee != nil {try container.encode(self.requestedDatabaseDtuGuarantee, forKey: .requestedDatabaseDtuGuarantee)}
    if self.requestedDatabaseDtuCap != nil {try container.encode(self.requestedDatabaseDtuCap, forKey: .requestedDatabaseDtuCap)}
    if self.requestedDtuGuarantee != nil {try container.encode(self.requestedDtuGuarantee, forKey: .requestedDtuGuarantee)}
  }
}

extension DataFactory {
  public static func createElasticPoolActivityPropertiesProtocol() -> ElasticPoolActivityPropertiesProtocol {
    return ElasticPoolActivityPropertiesData()
  }
}


// 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 ElasticPoolData : ElasticPoolProtocol, TrackedResourceProtocol, ResourceProtocol {
    public var id: String?
    public var name: String?
    public var type: String?
    public var tags: [String:String]?
    public var location: String
    public var properties: ElasticPoolPropertiesProtocol?
    public var kind: String?

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

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

extension DataFactory {
  public static func createElasticPoolProtocol(location: String) -> ElasticPoolProtocol {
    return ElasticPoolData(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 ElasticPoolDatabaseActivityData : ElasticPoolDatabaseActivityProtocol, ProxyResourceProtocol, ResourceProtocol {
    public var id: String?
    public var name: String?
    public var type: String?
    public var location: String?
    public var properties: ElasticPoolDatabaseActivityPropertiesProtocol?

        enum CodingKeys: String, CodingKey {case id = "id"
        case name = "name"
        case type = "type"
        case location = "location"
        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(.properties) {
        self.properties = try container.decode(ElasticPoolDatabaseActivityPropertiesData?.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.properties != nil {try container.encode(self.properties as! ElasticPoolDatabaseActivityPropertiesData?, forKey: .properties)}
  }
}

extension DataFactory {
  public static func createElasticPoolDatabaseActivityProtocol() -> ElasticPoolDatabaseActivityProtocol {
    return ElasticPoolDatabaseActivityData()
  }
}


// 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 ElasticPoolDatabaseActivityListResultData : ElasticPoolDatabaseActivityListResultProtocol {
    public var value: [ElasticPoolDatabaseActivityProtocol]

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

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

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

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

extension DataFactory {
  public static func createElasticPoolDatabaseActivityListResultProtocol(value: [ElasticPoolDatabaseActivityProtocol]) -> ElasticPoolDatabaseActivityListResultProtocol {
    return ElasticPoolDatabaseActivityListResultData(value: value)
  }
}


// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
import Foundation
import azureSwiftRuntime
internal struct ElasticPoolDatabaseActivityPropertiesData : ElasticPoolDatabaseActivityPropertiesProtocol {
    public var databaseName: String?
    public var endTime: Date?
    public var errorCode: Int32?
    public var errorMessage: String?
    public var errorSeverity: Int32?
    public var operation: String?
    public var operationId: String?
    public var percentComplete: Int32?
    public var requestedElasticPoolName: String?
    public var currentElasticPoolName: String?
    public var currentServiceObjective: String?
    public var requestedServiceObjective: String?
    public var serverName: String?
    public var startTime: Date?
    public var state: String?

        enum CodingKeys: String, CodingKey {case databaseName = "databaseName"
        case endTime = "endTime"
        case errorCode = "errorCode"
        case errorMessage = "errorMessage"
        case errorSeverity = "errorSeverity"
        case operation = "operation"
        case operationId = "operationId"
        case percentComplete = "percentComplete"
        case requestedElasticPoolName = "requestedElasticPoolName"
        case currentElasticPoolName = "currentElasticPoolName"
        case currentServiceObjective = "currentServiceObjective"
        case requestedServiceObjective = "requestedServiceObjective"
        case serverName = "serverName"
        case startTime = "startTime"
        case state = "state"
        }

  public init()  {
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.databaseName) {
        self.databaseName = try container.decode(String?.self, forKey: .databaseName)
    }
    if container.contains(.endTime) {
        self.endTime = DateConverter.fromString(dateStr: (try container.decode(String?.self, forKey: .endTime)), format: .dateTime)
    }
    if container.contains(.errorCode) {
        self.errorCode = try container.decode(Int32?.self, forKey: .errorCode)
    }
    if container.contains(.errorMessage) {
        self.errorMessage = try container.decode(String?.self, forKey: .errorMessage)
    }
    if container.contains(.errorSeverity) {
        self.errorSeverity = try container.decode(Int32?.self, forKey: .errorSeverity)
    }
    if container.contains(.operation) {
        self.operation = try container.decode(String?.self, forKey: .operation)
    }
    if container.contains(.operationId) {
        self.operationId = try container.decode(String?.self, forKey: .operationId)
    }
    if container.contains(.percentComplete) {
        self.percentComplete = try container.decode(Int32?.self, forKey: .percentComplete)
    }
    if container.contains(.requestedElasticPoolName) {
        self.requestedElasticPoolName = try container.decode(String?.self, forKey: .requestedElasticPoolName)
    }
    if container.contains(.currentElasticPoolName) {
        self.currentElasticPoolName = try container.decode(String?.self, forKey: .currentElasticPoolName)
    }
    if container.contains(.currentServiceObjective) {
        self.currentServiceObjective = try container.decode(String?.self, forKey: .currentServiceObjective)
    }
    if container.contains(.requestedServiceObjective) {
        self.requestedServiceObjective = try container.decode(String?.self, forKey: .requestedServiceObjective)
    }
    if container.contains(.serverName) {
        self.serverName = try container.decode(String?.self, forKey: .serverName)
    }
    if container.contains(.startTime) {
        self.startTime = DateConverter.fromString(dateStr: (try container.decode(String?.self, forKey: .startTime)), format: .dateTime)
    }
    if container.contains(.state) {
        self.state = try container.decode(String?.self, forKey: .state)
    }
    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.databaseName != nil {try container.encode(self.databaseName, forKey: .databaseName)}
    if self.endTime != nil {
        try container.encode(DateConverter.toString(date: self.endTime!, format: .dateTime), forKey: .endTime)
    }
    if self.errorCode != nil {try container.encode(self.errorCode, forKey: .errorCode)}
    if self.errorMessage != nil {try container.encode(self.errorMessage, forKey: .errorMessage)}
    if self.errorSeverity != nil {try container.encode(self.errorSeverity, forKey: .errorSeverity)}
    if self.operation != nil {try container.encode(self.operation, forKey: .operation)}
    if self.operationId != nil {try container.encode(self.operationId, forKey: .operationId)}
    if self.percentComplete != nil {try container.encode(self.percentComplete, forKey: .percentComplete)}
    if self.requestedElasticPoolName != nil {try container.encode(self.requestedElasticPoolName, forKey: .requestedElasticPoolName)}
    if self.currentElasticPoolName != nil {try container.encode(self.currentElasticPoolName, forKey: .currentElasticPoolName)}
    if self.currentServiceObjective != nil {try container.encode(self.currentServiceObjective, forKey: .currentServiceObjective)}
    if self.requestedServiceObjective != nil {try container.encode(self.requestedServiceObjective, forKey: .requestedServiceObjective)}
    if self.serverName != nil {try container.encode(self.serverName, forKey: .serverName)}
    if self.startTime != nil {
        try container.encode(DateConverter.toString(date: self.startTime!, format: .dateTime), forKey: .startTime)
    }
    if self.state != nil {try container.encode(self.state, forKey: .state)}
  }
}

extension DataFactory {
  public static func createElasticPoolDatabaseActivityPropertiesProtocol() -> ElasticPoolDatabaseActivityPropertiesProtocol {
    return ElasticPoolDatabaseActivityPropertiesData()
  }
}