// 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 AzureVmWorkloadProtectableItemData : AzureVmWorkloadProtectableItemProtocol, WorkloadProtectableItemProtocol {
    public var backupManagementType: String?
    public var workloadType: String?
    public var friendlyName: String?
    public var protectionState: ProtectionStatusEnum?
    public var parentName: String?
    public var parentUniqueName: String?
    public var serverName: String?
    public var isAutoProtectable: Bool?
    public var subinquireditemcount: Int32?
    public var subprotectableitemcount: Int32?
    public var prebackupvalidation: PreBackupValidationProtocol?

        enum CodingKeys: String, CodingKey {case backupManagementType = "backupManagementType"
        case workloadType = "workloadType"
        case friendlyName = "friendlyName"
        case protectionState = "protectionState"
        case parentName = "parentName"
        case parentUniqueName = "parentUniqueName"
        case serverName = "serverName"
        case isAutoProtectable = "isAutoProtectable"
        case subinquireditemcount = "subinquireditemcount"
        case subprotectableitemcount = "subprotectableitemcount"
        case prebackupvalidation = "prebackupvalidation"
        }

  public init()  {
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.backupManagementType) {
        self.backupManagementType = try container.decode(String?.self, forKey: .backupManagementType)
    }
    if container.contains(.workloadType) {
        self.workloadType = try container.decode(String?.self, forKey: .workloadType)
    }
    if container.contains(.friendlyName) {
        self.friendlyName = try container.decode(String?.self, forKey: .friendlyName)
    }
    if container.contains(.protectionState) {
        self.protectionState = try container.decode(ProtectionStatusEnum?.self, forKey: .protectionState)
    }
    if container.contains(.parentName) {
        self.parentName = try container.decode(String?.self, forKey: .parentName)
    }
    if container.contains(.parentUniqueName) {
        self.parentUniqueName = try container.decode(String?.self, forKey: .parentUniqueName)
    }
    if container.contains(.serverName) {
        self.serverName = try container.decode(String?.self, forKey: .serverName)
    }
    if container.contains(.isAutoProtectable) {
        self.isAutoProtectable = try container.decode(Bool?.self, forKey: .isAutoProtectable)
    }
    if container.contains(.subinquireditemcount) {
        self.subinquireditemcount = try container.decode(Int32?.self, forKey: .subinquireditemcount)
    }
    if container.contains(.subprotectableitemcount) {
        self.subprotectableitemcount = try container.decode(Int32?.self, forKey: .subprotectableitemcount)
    }
    if container.contains(.prebackupvalidation) {
        self.prebackupvalidation = try container.decode(PreBackupValidationData?.self, forKey: .prebackupvalidation)
    }
    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.backupManagementType != nil {try container.encode(self.backupManagementType, forKey: .backupManagementType)}
    if self.workloadType != nil {try container.encode(self.workloadType, forKey: .workloadType)}
    if self.friendlyName != nil {try container.encode(self.friendlyName, forKey: .friendlyName)}
    if self.protectionState != nil {try container.encode(self.protectionState, forKey: .protectionState)}
    if self.parentName != nil {try container.encode(self.parentName, forKey: .parentName)}
    if self.parentUniqueName != nil {try container.encode(self.parentUniqueName, forKey: .parentUniqueName)}
    if self.serverName != nil {try container.encode(self.serverName, forKey: .serverName)}
    if self.isAutoProtectable != nil {try container.encode(self.isAutoProtectable, forKey: .isAutoProtectable)}
    if self.subinquireditemcount != nil {try container.encode(self.subinquireditemcount, forKey: .subinquireditemcount)}
    if self.subprotectableitemcount != nil {try container.encode(self.subprotectableitemcount, forKey: .subprotectableitemcount)}
    if self.prebackupvalidation != nil {try container.encode(self.prebackupvalidation as! PreBackupValidationData?, forKey: .prebackupvalidation)}
  }
}

extension DataFactory {
  public static func createAzureVmWorkloadProtectableItemProtocol() -> AzureVmWorkloadProtectableItemProtocol {
    return AzureVmWorkloadProtectableItemData()
  }
}


// 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 AzureVmWorkloadProtectedItemExtendedInfoData : AzureVmWorkloadProtectedItemExtendedInfoProtocol {
    public var oldestRecoveryPoint: Date?
    public var recoveryPointCount: Int32?
    public var policyState: String?

        enum CodingKeys: String, CodingKey {case oldestRecoveryPoint = "oldestRecoveryPoint"
        case recoveryPointCount = "recoveryPointCount"
        case policyState = "policyState"
        }

  public init()  {
  }

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

extension DataFactory {
  public static func createAzureVmWorkloadProtectedItemExtendedInfoProtocol() -> AzureVmWorkloadProtectedItemExtendedInfoProtocol {
    return AzureVmWorkloadProtectedItemExtendedInfoData()
  }
}


// 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 AzureVmWorkloadProtectionPolicyData : AzureVmWorkloadProtectionPolicyProtocol, ProtectionPolicyProtocol {
    public var protectedItemsCount: Int32?
    public var workLoadType: String?
    public var settings: SettingsProtocol?
    public var subProtectionPolicy: [SubProtectionPolicyProtocol?]?

        enum CodingKeys: String, CodingKey {case protectedItemsCount = "protectedItemsCount"
        case workLoadType = "workLoadType"
        case settings = "settings"
        case subProtectionPolicy = "subProtectionPolicy"
        }

  public init()  {
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.protectedItemsCount) {
        self.protectedItemsCount = try container.decode(Int32?.self, forKey: .protectedItemsCount)
    }
    if container.contains(.workLoadType) {
        self.workLoadType = try container.decode(String?.self, forKey: .workLoadType)
    }
    if container.contains(.settings) {
        self.settings = try container.decode(SettingsData?.self, forKey: .settings)
    }
    if container.contains(.subProtectionPolicy) {
        self.subProtectionPolicy = try container.decode([SubProtectionPolicyData?]?.self, forKey: .subProtectionPolicy)
    }
    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.protectedItemsCount != nil {try container.encode(self.protectedItemsCount, forKey: .protectedItemsCount)}
    if self.workLoadType != nil {try container.encode(self.workLoadType, forKey: .workLoadType)}
    if self.settings != nil {try container.encode(self.settings as! SettingsData?, forKey: .settings)}
    if self.subProtectionPolicy != nil {try container.encode(self.subProtectionPolicy as! [SubProtectionPolicyData?]?, forKey: .subProtectionPolicy)}
  }
}

extension DataFactory {
  public static func createAzureVmWorkloadProtectionPolicyProtocol() -> AzureVmWorkloadProtectionPolicyProtocol {
    return AzureVmWorkloadProtectionPolicyData()
  }
}


// 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 AzureVmWorkloadSQLAvailabilityGroupProtectableItemData : AzureVmWorkloadSQLAvailabilityGroupProtectableItemProtocol, AzureVmWorkloadProtectableItemProtocol, WorkloadProtectableItemProtocol {
    public var backupManagementType: String?
    public var workloadType: String?
    public var friendlyName: String?
    public var protectionState: ProtectionStatusEnum?
    public var parentName: String?
    public var parentUniqueName: String?
    public var serverName: String?
    public var isAutoProtectable: Bool?
    public var subinquireditemcount: Int32?
    public var subprotectableitemcount: Int32?
    public var prebackupvalidation: PreBackupValidationProtocol?

        enum CodingKeys: String, CodingKey {case backupManagementType = "backupManagementType"
        case workloadType = "workloadType"
        case friendlyName = "friendlyName"
        case protectionState = "protectionState"
        case parentName = "parentName"
        case parentUniqueName = "parentUniqueName"
        case serverName = "serverName"
        case isAutoProtectable = "isAutoProtectable"
        case subinquireditemcount = "subinquireditemcount"
        case subprotectableitemcount = "subprotectableitemcount"
        case prebackupvalidation = "prebackupvalidation"
        }

  public init()  {
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.backupManagementType) {
        self.backupManagementType = try container.decode(String?.self, forKey: .backupManagementType)
    }
    if container.contains(.workloadType) {
        self.workloadType = try container.decode(String?.self, forKey: .workloadType)
    }
    if container.contains(.friendlyName) {
        self.friendlyName = try container.decode(String?.self, forKey: .friendlyName)
    }
    if container.contains(.protectionState) {
        self.protectionState = try container.decode(ProtectionStatusEnum?.self, forKey: .protectionState)
    }
    if container.contains(.parentName) {
        self.parentName = try container.decode(String?.self, forKey: .parentName)
    }
    if container.contains(.parentUniqueName) {
        self.parentUniqueName = try container.decode(String?.self, forKey: .parentUniqueName)
    }
    if container.contains(.serverName) {
        self.serverName = try container.decode(String?.self, forKey: .serverName)
    }
    if container.contains(.isAutoProtectable) {
        self.isAutoProtectable = try container.decode(Bool?.self, forKey: .isAutoProtectable)
    }
    if container.contains(.subinquireditemcount) {
        self.subinquireditemcount = try container.decode(Int32?.self, forKey: .subinquireditemcount)
    }
    if container.contains(.subprotectableitemcount) {
        self.subprotectableitemcount = try container.decode(Int32?.self, forKey: .subprotectableitemcount)
    }
    if container.contains(.prebackupvalidation) {
        self.prebackupvalidation = try container.decode(PreBackupValidationData?.self, forKey: .prebackupvalidation)
    }
    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.backupManagementType != nil {try container.encode(self.backupManagementType, forKey: .backupManagementType)}
    if self.workloadType != nil {try container.encode(self.workloadType, forKey: .workloadType)}
    if self.friendlyName != nil {try container.encode(self.friendlyName, forKey: .friendlyName)}
    if self.protectionState != nil {try container.encode(self.protectionState, forKey: .protectionState)}
    if self.parentName != nil {try container.encode(self.parentName, forKey: .parentName)}
    if self.parentUniqueName != nil {try container.encode(self.parentUniqueName, forKey: .parentUniqueName)}
    if self.serverName != nil {try container.encode(self.serverName, forKey: .serverName)}
    if self.isAutoProtectable != nil {try container.encode(self.isAutoProtectable, forKey: .isAutoProtectable)}
    if self.subinquireditemcount != nil {try container.encode(self.subinquireditemcount, forKey: .subinquireditemcount)}
    if self.subprotectableitemcount != nil {try container.encode(self.subprotectableitemcount, forKey: .subprotectableitemcount)}
    if self.prebackupvalidation != nil {try container.encode(self.prebackupvalidation as! PreBackupValidationData?, forKey: .prebackupvalidation)}
  }
}

extension DataFactory {
  public static func createAzureVmWorkloadSQLAvailabilityGroupProtectableItemProtocol() -> AzureVmWorkloadSQLAvailabilityGroupProtectableItemProtocol {
    return AzureVmWorkloadSQLAvailabilityGroupProtectableItemData()
  }
}


// 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 AzureVmWorkloadSQLDatabaseProtectableItemData : AzureVmWorkloadSQLDatabaseProtectableItemProtocol, AzureVmWorkloadProtectableItemProtocol, WorkloadProtectableItemProtocol {
    public var backupManagementType: String?
    public var workloadType: String?
    public var friendlyName: String?
    public var protectionState: ProtectionStatusEnum?
    public var parentName: String?
    public var parentUniqueName: String?
    public var serverName: String?
    public var isAutoProtectable: Bool?
    public var subinquireditemcount: Int32?
    public var subprotectableitemcount: Int32?
    public var prebackupvalidation: PreBackupValidationProtocol?

        enum CodingKeys: String, CodingKey {case backupManagementType = "backupManagementType"
        case workloadType = "workloadType"
        case friendlyName = "friendlyName"
        case protectionState = "protectionState"
        case parentName = "parentName"
        case parentUniqueName = "parentUniqueName"
        case serverName = "serverName"
        case isAutoProtectable = "isAutoProtectable"
        case subinquireditemcount = "subinquireditemcount"
        case subprotectableitemcount = "subprotectableitemcount"
        case prebackupvalidation = "prebackupvalidation"
        }

  public init()  {
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.backupManagementType) {
        self.backupManagementType = try container.decode(String?.self, forKey: .backupManagementType)
    }
    if container.contains(.workloadType) {
        self.workloadType = try container.decode(String?.self, forKey: .workloadType)
    }
    if container.contains(.friendlyName) {
        self.friendlyName = try container.decode(String?.self, forKey: .friendlyName)
    }
    if container.contains(.protectionState) {
        self.protectionState = try container.decode(ProtectionStatusEnum?.self, forKey: .protectionState)
    }
    if container.contains(.parentName) {
        self.parentName = try container.decode(String?.self, forKey: .parentName)
    }
    if container.contains(.parentUniqueName) {
        self.parentUniqueName = try container.decode(String?.self, forKey: .parentUniqueName)
    }
    if container.contains(.serverName) {
        self.serverName = try container.decode(String?.self, forKey: .serverName)
    }
    if container.contains(.isAutoProtectable) {
        self.isAutoProtectable = try container.decode(Bool?.self, forKey: .isAutoProtectable)
    }
    if container.contains(.subinquireditemcount) {
        self.subinquireditemcount = try container.decode(Int32?.self, forKey: .subinquireditemcount)
    }
    if container.contains(.subprotectableitemcount) {
        self.subprotectableitemcount = try container.decode(Int32?.self, forKey: .subprotectableitemcount)
    }
    if container.contains(.prebackupvalidation) {
        self.prebackupvalidation = try container.decode(PreBackupValidationData?.self, forKey: .prebackupvalidation)
    }
    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.backupManagementType != nil {try container.encode(self.backupManagementType, forKey: .backupManagementType)}
    if self.workloadType != nil {try container.encode(self.workloadType, forKey: .workloadType)}
    if self.friendlyName != nil {try container.encode(self.friendlyName, forKey: .friendlyName)}
    if self.protectionState != nil {try container.encode(self.protectionState, forKey: .protectionState)}
    if self.parentName != nil {try container.encode(self.parentName, forKey: .parentName)}
    if self.parentUniqueName != nil {try container.encode(self.parentUniqueName, forKey: .parentUniqueName)}
    if self.serverName != nil {try container.encode(self.serverName, forKey: .serverName)}
    if self.isAutoProtectable != nil {try container.encode(self.isAutoProtectable, forKey: .isAutoProtectable)}
    if self.subinquireditemcount != nil {try container.encode(self.subinquireditemcount, forKey: .subinquireditemcount)}
    if self.subprotectableitemcount != nil {try container.encode(self.subprotectableitemcount, forKey: .subprotectableitemcount)}
    if self.prebackupvalidation != nil {try container.encode(self.prebackupvalidation as! PreBackupValidationData?, forKey: .prebackupvalidation)}
  }
}

extension DataFactory {
  public static func createAzureVmWorkloadSQLDatabaseProtectableItemProtocol() -> AzureVmWorkloadSQLDatabaseProtectableItemProtocol {
    return AzureVmWorkloadSQLDatabaseProtectableItemData()
  }
}


// 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 AzureVmWorkloadSQLDatabaseProtectedItemData : AzureVmWorkloadSQLDatabaseProtectedItemProtocol, ProtectedItemProtocol {
    public var backupManagementType: BackupManagementTypeEnum?
    public var workloadType: DataSourceTypeEnum?
    public var containerName: String?
    public var sourceResourceId: String?
    public var policyId: String?
    public var lastRecoveryPoint: Date?
    public var backupSetName: String?
    public var friendlyName: String?
    public var serverName: String?
    public var parentName: String?
    public var parentType: String?
    public var protectionStatus: String?
    public var protectionState: ProtectionStateEnum?
    public var lastBackupStatus: LastBackupStatusEnum?
    public var lastBackupTime: Date?
    public var lastBackupErrorDetail: ErrorDetailProtocol?
    public var protectedItemDataSourceId: String?
    public var protectedItemHealthStatus: ProtectedItemHealthStatusEnum?
    public var extendedInfo: AzureVmWorkloadProtectedItemExtendedInfoProtocol?

        enum CodingKeys: String, CodingKey {case backupManagementType = "backupManagementType"
        case workloadType = "workloadType"
        case containerName = "containerName"
        case sourceResourceId = "sourceResourceId"
        case policyId = "policyId"
        case lastRecoveryPoint = "lastRecoveryPoint"
        case backupSetName = "backupSetName"
        case friendlyName = "friendlyName"
        case serverName = "serverName"
        case parentName = "parentName"
        case parentType = "parentType"
        case protectionStatus = "protectionStatus"
        case protectionState = "protectionState"
        case lastBackupStatus = "lastBackupStatus"
        case lastBackupTime = "lastBackupTime"
        case lastBackupErrorDetail = "lastBackupErrorDetail"
        case protectedItemDataSourceId = "protectedItemDataSourceId"
        case protectedItemHealthStatus = "protectedItemHealthStatus"
        case extendedInfo = "extendedInfo"
        }

  public init()  {
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.backupManagementType) {
        self.backupManagementType = try container.decode(BackupManagementTypeEnum?.self, forKey: .backupManagementType)
    }
    if container.contains(.workloadType) {
        self.workloadType = try container.decode(DataSourceTypeEnum?.self, forKey: .workloadType)
    }
    if container.contains(.containerName) {
        self.containerName = try container.decode(String?.self, forKey: .containerName)
    }
    if container.contains(.sourceResourceId) {
        self.sourceResourceId = try container.decode(String?.self, forKey: .sourceResourceId)
    }
    if container.contains(.policyId) {
        self.policyId = try container.decode(String?.self, forKey: .policyId)
    }
    if container.contains(.lastRecoveryPoint) {
        self.lastRecoveryPoint = DateConverter.fromString(dateStr: (try container.decode(String?.self, forKey: .lastRecoveryPoint)), format: .dateTime)
    }
    if container.contains(.backupSetName) {
        self.backupSetName = try container.decode(String?.self, forKey: .backupSetName)
    }
    if container.contains(.friendlyName) {
        self.friendlyName = try container.decode(String?.self, forKey: .friendlyName)
    }
    if container.contains(.serverName) {
        self.serverName = try container.decode(String?.self, forKey: .serverName)
    }
    if container.contains(.parentName) {
        self.parentName = try container.decode(String?.self, forKey: .parentName)
    }
    if container.contains(.parentType) {
        self.parentType = try container.decode(String?.self, forKey: .parentType)
    }
    if container.contains(.protectionStatus) {
        self.protectionStatus = try container.decode(String?.self, forKey: .protectionStatus)
    }
    if container.contains(.protectionState) {
        self.protectionState = try container.decode(ProtectionStateEnum?.self, forKey: .protectionState)
    }
    if container.contains(.lastBackupStatus) {
        self.lastBackupStatus = try container.decode(LastBackupStatusEnum?.self, forKey: .lastBackupStatus)
    }
    if container.contains(.lastBackupTime) {
        self.lastBackupTime = DateConverter.fromString(dateStr: (try container.decode(String?.self, forKey: .lastBackupTime)), format: .dateTime)
    }
    if container.contains(.lastBackupErrorDetail) {
        self.lastBackupErrorDetail = try container.decode(ErrorDetailData?.self, forKey: .lastBackupErrorDetail)
    }
    if container.contains(.protectedItemDataSourceId) {
        self.protectedItemDataSourceId = try container.decode(String?.self, forKey: .protectedItemDataSourceId)
    }
    if container.contains(.protectedItemHealthStatus) {
        self.protectedItemHealthStatus = try container.decode(ProtectedItemHealthStatusEnum?.self, forKey: .protectedItemHealthStatus)
    }
    if container.contains(.extendedInfo) {
        self.extendedInfo = try container.decode(AzureVmWorkloadProtectedItemExtendedInfoData?.self, forKey: .extendedInfo)
    }
    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.backupManagementType != nil {try container.encode(self.backupManagementType, forKey: .backupManagementType)}
    if self.workloadType != nil {try container.encode(self.workloadType, forKey: .workloadType)}
    if self.containerName != nil {try container.encode(self.containerName, forKey: .containerName)}
    if self.sourceResourceId != nil {try container.encode(self.sourceResourceId, forKey: .sourceResourceId)}
    if self.policyId != nil {try container.encode(self.policyId, forKey: .policyId)}
    if self.lastRecoveryPoint != nil {
        try container.encode(DateConverter.toString(date: self.lastRecoveryPoint!, format: .dateTime), forKey: .lastRecoveryPoint)
    }
    if self.backupSetName != nil {try container.encode(self.backupSetName, forKey: .backupSetName)}
    if self.friendlyName != nil {try container.encode(self.friendlyName, forKey: .friendlyName)}
    if self.serverName != nil {try container.encode(self.serverName, forKey: .serverName)}
    if self.parentName != nil {try container.encode(self.parentName, forKey: .parentName)}
    if self.parentType != nil {try container.encode(self.parentType, forKey: .parentType)}
    if self.protectionStatus != nil {try container.encode(self.protectionStatus, forKey: .protectionStatus)}
    if self.protectionState != nil {try container.encode(self.protectionState, forKey: .protectionState)}
    if self.lastBackupStatus != nil {try container.encode(self.lastBackupStatus, forKey: .lastBackupStatus)}
    if self.lastBackupTime != nil {
        try container.encode(DateConverter.toString(date: self.lastBackupTime!, format: .dateTime), forKey: .lastBackupTime)
    }
    if self.lastBackupErrorDetail != nil {try container.encode(self.lastBackupErrorDetail as! ErrorDetailData?, forKey: .lastBackupErrorDetail)}
    if self.protectedItemDataSourceId != nil {try container.encode(self.protectedItemDataSourceId, forKey: .protectedItemDataSourceId)}
    if self.protectedItemHealthStatus != nil {try container.encode(self.protectedItemHealthStatus, forKey: .protectedItemHealthStatus)}
    if self.extendedInfo != nil {try container.encode(self.extendedInfo as! AzureVmWorkloadProtectedItemExtendedInfoData?, forKey: .extendedInfo)}
  }
}

extension DataFactory {
  public static func createAzureVmWorkloadSQLDatabaseProtectedItemProtocol() -> AzureVmWorkloadSQLDatabaseProtectedItemProtocol {
    return AzureVmWorkloadSQLDatabaseProtectedItemData()
  }
}


// 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 AzureVmWorkloadSQLDatabaseWorkloadItemData : AzureVmWorkloadSQLDatabaseWorkloadItemProtocol, AzureVmWorkloadItemProtocol, WorkloadItemProtocol {
    public var backupManagementType: String?
    public var workloadType: String?
    public var friendlyName: String?
    public var protectionState: ProtectionStatusEnum?
    public var parentName: String?
    public var serverName: String?
    public var isAutoProtectable: Bool?
    public var subinquireditemcount: Int32?
    public var subWorkloadItemCount: Int32?

        enum CodingKeys: String, CodingKey {case backupManagementType = "backupManagementType"
        case workloadType = "workloadType"
        case friendlyName = "friendlyName"
        case protectionState = "protectionState"
        case parentName = "parentName"
        case serverName = "serverName"
        case isAutoProtectable = "isAutoProtectable"
        case subinquireditemcount = "subinquireditemcount"
        case subWorkloadItemCount = "subWorkloadItemCount"
        }

  public init()  {
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.backupManagementType) {
        self.backupManagementType = try container.decode(String?.self, forKey: .backupManagementType)
    }
    if container.contains(.workloadType) {
        self.workloadType = try container.decode(String?.self, forKey: .workloadType)
    }
    if container.contains(.friendlyName) {
        self.friendlyName = try container.decode(String?.self, forKey: .friendlyName)
    }
    if container.contains(.protectionState) {
        self.protectionState = try container.decode(ProtectionStatusEnum?.self, forKey: .protectionState)
    }
    if container.contains(.parentName) {
        self.parentName = try container.decode(String?.self, forKey: .parentName)
    }
    if container.contains(.serverName) {
        self.serverName = try container.decode(String?.self, forKey: .serverName)
    }
    if container.contains(.isAutoProtectable) {
        self.isAutoProtectable = try container.decode(Bool?.self, forKey: .isAutoProtectable)
    }
    if container.contains(.subinquireditemcount) {
        self.subinquireditemcount = try container.decode(Int32?.self, forKey: .subinquireditemcount)
    }
    if container.contains(.subWorkloadItemCount) {
        self.subWorkloadItemCount = try container.decode(Int32?.self, forKey: .subWorkloadItemCount)
    }
    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.backupManagementType != nil {try container.encode(self.backupManagementType, forKey: .backupManagementType)}
    if self.workloadType != nil {try container.encode(self.workloadType, forKey: .workloadType)}
    if self.friendlyName != nil {try container.encode(self.friendlyName, forKey: .friendlyName)}
    if self.protectionState != nil {try container.encode(self.protectionState, forKey: .protectionState)}
    if self.parentName != nil {try container.encode(self.parentName, forKey: .parentName)}
    if self.serverName != nil {try container.encode(self.serverName, forKey: .serverName)}
    if self.isAutoProtectable != nil {try container.encode(self.isAutoProtectable, forKey: .isAutoProtectable)}
    if self.subinquireditemcount != nil {try container.encode(self.subinquireditemcount, forKey: .subinquireditemcount)}
    if self.subWorkloadItemCount != nil {try container.encode(self.subWorkloadItemCount, forKey: .subWorkloadItemCount)}
  }
}

extension DataFactory {
  public static func createAzureVmWorkloadSQLDatabaseWorkloadItemProtocol() -> AzureVmWorkloadSQLDatabaseWorkloadItemProtocol {
    return AzureVmWorkloadSQLDatabaseWorkloadItemData()
  }
}


// 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 AzureVmWorkloadSQLInstanceProtectableItemData : AzureVmWorkloadSQLInstanceProtectableItemProtocol, AzureVmWorkloadProtectableItemProtocol, WorkloadProtectableItemProtocol {
    public var backupManagementType: String?
    public var workloadType: String?
    public var friendlyName: String?
    public var protectionState: ProtectionStatusEnum?
    public var parentName: String?
    public var parentUniqueName: String?
    public var serverName: String?
    public var isAutoProtectable: Bool?
    public var subinquireditemcount: Int32?
    public var subprotectableitemcount: Int32?
    public var prebackupvalidation: PreBackupValidationProtocol?

        enum CodingKeys: String, CodingKey {case backupManagementType = "backupManagementType"
        case workloadType = "workloadType"
        case friendlyName = "friendlyName"
        case protectionState = "protectionState"
        case parentName = "parentName"
        case parentUniqueName = "parentUniqueName"
        case serverName = "serverName"
        case isAutoProtectable = "isAutoProtectable"
        case subinquireditemcount = "subinquireditemcount"
        case subprotectableitemcount = "subprotectableitemcount"
        case prebackupvalidation = "prebackupvalidation"
        }

  public init()  {
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.backupManagementType) {
        self.backupManagementType = try container.decode(String?.self, forKey: .backupManagementType)
    }
    if container.contains(.workloadType) {
        self.workloadType = try container.decode(String?.self, forKey: .workloadType)
    }
    if container.contains(.friendlyName) {
        self.friendlyName = try container.decode(String?.self, forKey: .friendlyName)
    }
    if container.contains(.protectionState) {
        self.protectionState = try container.decode(ProtectionStatusEnum?.self, forKey: .protectionState)
    }
    if container.contains(.parentName) {
        self.parentName = try container.decode(String?.self, forKey: .parentName)
    }
    if container.contains(.parentUniqueName) {
        self.parentUniqueName = try container.decode(String?.self, forKey: .parentUniqueName)
    }
    if container.contains(.serverName) {
        self.serverName = try container.decode(String?.self, forKey: .serverName)
    }
    if container.contains(.isAutoProtectable) {
        self.isAutoProtectable = try container.decode(Bool?.self, forKey: .isAutoProtectable)
    }
    if container.contains(.subinquireditemcount) {
        self.subinquireditemcount = try container.decode(Int32?.self, forKey: .subinquireditemcount)
    }
    if container.contains(.subprotectableitemcount) {
        self.subprotectableitemcount = try container.decode(Int32?.self, forKey: .subprotectableitemcount)
    }
    if container.contains(.prebackupvalidation) {
        self.prebackupvalidation = try container.decode(PreBackupValidationData?.self, forKey: .prebackupvalidation)
    }
    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.backupManagementType != nil {try container.encode(self.backupManagementType, forKey: .backupManagementType)}
    if self.workloadType != nil {try container.encode(self.workloadType, forKey: .workloadType)}
    if self.friendlyName != nil {try container.encode(self.friendlyName, forKey: .friendlyName)}
    if self.protectionState != nil {try container.encode(self.protectionState, forKey: .protectionState)}
    if self.parentName != nil {try container.encode(self.parentName, forKey: .parentName)}
    if self.parentUniqueName != nil {try container.encode(self.parentUniqueName, forKey: .parentUniqueName)}
    if self.serverName != nil {try container.encode(self.serverName, forKey: .serverName)}
    if self.isAutoProtectable != nil {try container.encode(self.isAutoProtectable, forKey: .isAutoProtectable)}
    if self.subinquireditemcount != nil {try container.encode(self.subinquireditemcount, forKey: .subinquireditemcount)}
    if self.subprotectableitemcount != nil {try container.encode(self.subprotectableitemcount, forKey: .subprotectableitemcount)}
    if self.prebackupvalidation != nil {try container.encode(self.prebackupvalidation as! PreBackupValidationData?, forKey: .prebackupvalidation)}
  }
}

extension DataFactory {
  public static func createAzureVmWorkloadSQLInstanceProtectableItemProtocol() -> AzureVmWorkloadSQLInstanceProtectableItemProtocol {
    return AzureVmWorkloadSQLInstanceProtectableItemData()
  }
}


// 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 AzureVmWorkloadSQLInstanceWorkloadItemData : AzureVmWorkloadSQLInstanceWorkloadItemProtocol, AzureVmWorkloadItemProtocol, WorkloadItemProtocol {
    public var backupManagementType: String?
    public var workloadType: String?
    public var friendlyName: String?
    public var protectionState: ProtectionStatusEnum?
    public var parentName: String?
    public var serverName: String?
    public var isAutoProtectable: Bool?
    public var subinquireditemcount: Int32?
    public var subWorkloadItemCount: Int32?
    public var dataDirectoryPaths: [SQLDataDirectoryProtocol?]?

        enum CodingKeys: String, CodingKey {case backupManagementType = "backupManagementType"
        case workloadType = "workloadType"
        case friendlyName = "friendlyName"
        case protectionState = "protectionState"
        case parentName = "parentName"
        case serverName = "serverName"
        case isAutoProtectable = "isAutoProtectable"
        case subinquireditemcount = "subinquireditemcount"
        case subWorkloadItemCount = "subWorkloadItemCount"
        case dataDirectoryPaths = "dataDirectoryPaths"
        }

  public init()  {
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.backupManagementType) {
        self.backupManagementType = try container.decode(String?.self, forKey: .backupManagementType)
    }
    if container.contains(.workloadType) {
        self.workloadType = try container.decode(String?.self, forKey: .workloadType)
    }
    if container.contains(.friendlyName) {
        self.friendlyName = try container.decode(String?.self, forKey: .friendlyName)
    }
    if container.contains(.protectionState) {
        self.protectionState = try container.decode(ProtectionStatusEnum?.self, forKey: .protectionState)
    }
    if container.contains(.parentName) {
        self.parentName = try container.decode(String?.self, forKey: .parentName)
    }
    if container.contains(.serverName) {
        self.serverName = try container.decode(String?.self, forKey: .serverName)
    }
    if container.contains(.isAutoProtectable) {
        self.isAutoProtectable = try container.decode(Bool?.self, forKey: .isAutoProtectable)
    }
    if container.contains(.subinquireditemcount) {
        self.subinquireditemcount = try container.decode(Int32?.self, forKey: .subinquireditemcount)
    }
    if container.contains(.subWorkloadItemCount) {
        self.subWorkloadItemCount = try container.decode(Int32?.self, forKey: .subWorkloadItemCount)
    }
    if container.contains(.dataDirectoryPaths) {
        self.dataDirectoryPaths = try container.decode([SQLDataDirectoryData?]?.self, forKey: .dataDirectoryPaths)
    }
    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.backupManagementType != nil {try container.encode(self.backupManagementType, forKey: .backupManagementType)}
    if self.workloadType != nil {try container.encode(self.workloadType, forKey: .workloadType)}
    if self.friendlyName != nil {try container.encode(self.friendlyName, forKey: .friendlyName)}
    if self.protectionState != nil {try container.encode(self.protectionState, forKey: .protectionState)}
    if self.parentName != nil {try container.encode(self.parentName, forKey: .parentName)}
    if self.serverName != nil {try container.encode(self.serverName, forKey: .serverName)}
    if self.isAutoProtectable != nil {try container.encode(self.isAutoProtectable, forKey: .isAutoProtectable)}
    if self.subinquireditemcount != nil {try container.encode(self.subinquireditemcount, forKey: .subinquireditemcount)}
    if self.subWorkloadItemCount != nil {try container.encode(self.subWorkloadItemCount, forKey: .subWorkloadItemCount)}
    if self.dataDirectoryPaths != nil {try container.encode(self.dataDirectoryPaths as! [SQLDataDirectoryData?]?, forKey: .dataDirectoryPaths)}
  }
}

extension DataFactory {
  public static func createAzureVmWorkloadSQLInstanceWorkloadItemProtocol() -> AzureVmWorkloadSQLInstanceWorkloadItemProtocol {
    return AzureVmWorkloadSQLInstanceWorkloadItemData()
  }
}


// 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 AzureWorkloadBackupRequestData : AzureWorkloadBackupRequestProtocol, BackupRequestProtocol {
    public var backupType: BackupTypeEnum?
    public var enableCompression: Bool?
    public var recoveryPointExpiryTimeInUTC: Date?

        enum CodingKeys: String, CodingKey {case backupType = "backupType"
        case enableCompression = "enableCompression"
        case recoveryPointExpiryTimeInUTC = "recoveryPointExpiryTimeInUTC"
        }

  public init()  {
  }

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

extension DataFactory {
  public static func createAzureWorkloadBackupRequestProtocol() -> AzureWorkloadBackupRequestProtocol {
    return AzureWorkloadBackupRequestData()
  }
}


// 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 AzureWorkloadContainerData : AzureWorkloadContainerProtocol, ProtectionContainerProtocol {
    public var friendlyName: String?
    public var backupManagementType: BackupManagementTypeEnum?
    public var registrationStatus: String?
    public var healthStatus: String?
    public var sourceResourceId: String?
    public var lastUpdatedTime: Date?
    public var extendedInfo: AzureWorkloadContainerExtendedInfoProtocol?

        enum CodingKeys: String, CodingKey {case friendlyName = "friendlyName"
        case backupManagementType = "backupManagementType"
        case registrationStatus = "registrationStatus"
        case healthStatus = "healthStatus"
        case sourceResourceId = "sourceResourceId"
        case lastUpdatedTime = "lastUpdatedTime"
        case extendedInfo = "extendedInfo"
        }

  public init()  {
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.friendlyName) {
        self.friendlyName = try container.decode(String?.self, forKey: .friendlyName)
    }
    if container.contains(.backupManagementType) {
        self.backupManagementType = try container.decode(BackupManagementTypeEnum?.self, forKey: .backupManagementType)
    }
    if container.contains(.registrationStatus) {
        self.registrationStatus = try container.decode(String?.self, forKey: .registrationStatus)
    }
    if container.contains(.healthStatus) {
        self.healthStatus = try container.decode(String?.self, forKey: .healthStatus)
    }
    if container.contains(.sourceResourceId) {
        self.sourceResourceId = try container.decode(String?.self, forKey: .sourceResourceId)
    }
    if container.contains(.lastUpdatedTime) {
        self.lastUpdatedTime = DateConverter.fromString(dateStr: (try container.decode(String?.self, forKey: .lastUpdatedTime)), format: .dateTime)
    }
    if container.contains(.extendedInfo) {
        self.extendedInfo = try container.decode(AzureWorkloadContainerExtendedInfoData?.self, forKey: .extendedInfo)
    }
    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.friendlyName != nil {try container.encode(self.friendlyName, forKey: .friendlyName)}
    if self.backupManagementType != nil {try container.encode(self.backupManagementType, forKey: .backupManagementType)}
    if self.registrationStatus != nil {try container.encode(self.registrationStatus, forKey: .registrationStatus)}
    if self.healthStatus != nil {try container.encode(self.healthStatus, forKey: .healthStatus)}
    if self.sourceResourceId != nil {try container.encode(self.sourceResourceId, forKey: .sourceResourceId)}
    if self.lastUpdatedTime != nil {
        try container.encode(DateConverter.toString(date: self.lastUpdatedTime!, format: .dateTime), forKey: .lastUpdatedTime)
    }
    if self.extendedInfo != nil {try container.encode(self.extendedInfo as! AzureWorkloadContainerExtendedInfoData?, forKey: .extendedInfo)}
  }
}

extension DataFactory {
  public static func createAzureWorkloadContainerProtocol() -> AzureWorkloadContainerProtocol {
    return AzureWorkloadContainerData()
  }
}


// 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 AzureWorkloadContainerExtendedInfoData : AzureWorkloadContainerExtendedInfoProtocol {
    public var hostServerName: String?
    public var inquiryInfo: InquiryInfoProtocol?
    public var nodesList: [DistributedNodesInfoProtocol?]?

        enum CodingKeys: String, CodingKey {case hostServerName = "hostServerName"
        case inquiryInfo = "inquiryInfo"
        case nodesList = "nodesList"
        }

  public init()  {
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.hostServerName) {
        self.hostServerName = try container.decode(String?.self, forKey: .hostServerName)
    }
    if container.contains(.inquiryInfo) {
        self.inquiryInfo = try container.decode(InquiryInfoData?.self, forKey: .inquiryInfo)
    }
    if container.contains(.nodesList) {
        self.nodesList = try container.decode([DistributedNodesInfoData?]?.self, forKey: .nodesList)
    }
    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.hostServerName != nil {try container.encode(self.hostServerName, forKey: .hostServerName)}
    if self.inquiryInfo != nil {try container.encode(self.inquiryInfo as! InquiryInfoData?, forKey: .inquiryInfo)}
    if self.nodesList != nil {try container.encode(self.nodesList as! [DistributedNodesInfoData?]?, forKey: .nodesList)}
  }
}

extension DataFactory {
  public static func createAzureWorkloadContainerExtendedInfoProtocol() -> AzureWorkloadContainerExtendedInfoProtocol {
    return AzureWorkloadContainerExtendedInfoData()
  }
}


// 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 AzureWorkloadErrorInfoData : AzureWorkloadErrorInfoProtocol {
    public var errorCode: Int32?
    public var errorString: String?
    public var errorTitle: String?
    public var recommendations: [String]?
    public var additionalDetails: String?

        enum CodingKeys: String, CodingKey {case errorCode = "errorCode"
        case errorString = "errorString"
        case errorTitle = "errorTitle"
        case recommendations = "recommendations"
        case additionalDetails = "additionalDetails"
        }

  public init()  {
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.errorCode) {
        self.errorCode = try container.decode(Int32?.self, forKey: .errorCode)
    }
    if container.contains(.errorString) {
        self.errorString = try container.decode(String?.self, forKey: .errorString)
    }
    if container.contains(.errorTitle) {
        self.errorTitle = try container.decode(String?.self, forKey: .errorTitle)
    }
    if container.contains(.recommendations) {
        self.recommendations = try container.decode([String]?.self, forKey: .recommendations)
    }
    if container.contains(.additionalDetails) {
        self.additionalDetails = try container.decode(String?.self, forKey: .additionalDetails)
    }
    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.errorCode != nil {try container.encode(self.errorCode, forKey: .errorCode)}
    if self.errorString != nil {try container.encode(self.errorString, forKey: .errorString)}
    if self.errorTitle != nil {try container.encode(self.errorTitle, forKey: .errorTitle)}
    if self.recommendations != nil {try container.encode(self.recommendations as! [String]?, forKey: .recommendations)}
    if self.additionalDetails != nil {try container.encode(self.additionalDetails, forKey: .additionalDetails)}
  }
}

extension DataFactory {
  public static func createAzureWorkloadErrorInfoProtocol() -> AzureWorkloadErrorInfoProtocol {
    return AzureWorkloadErrorInfoData()
  }
}


// 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 AzureWorkloadJobData : AzureWorkloadJobProtocol, JobProtocol {
    public var entityFriendlyName: String?
    public var backupManagementType: BackupManagementTypeEnum?
    public var operation: String?
    public var status: String?
    public var startTime: Date?
    public var endTime: Date?
    public var activityId: String?
    public var duration: String?
    public var actionsInfo: [JobSupportedActionEnum?]?
    public var errorDetails: [AzureWorkloadErrorInfoProtocol?]?
    public var extendedInfo: AzureWorkloadJobExtendedInfoProtocol?

        enum CodingKeys: String, CodingKey {case entityFriendlyName = "entityFriendlyName"
        case backupManagementType = "backupManagementType"
        case operation = "operation"
        case status = "status"
        case startTime = "startTime"
        case endTime = "endTime"
        case activityId = "activityId"
        case duration = "duration"
        case actionsInfo = "actionsInfo"
        case errorDetails = "errorDetails"
        case extendedInfo = "extendedInfo"
        }

  public init()  {
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.entityFriendlyName) {
        self.entityFriendlyName = try container.decode(String?.self, forKey: .entityFriendlyName)
    }
    if container.contains(.backupManagementType) {
        self.backupManagementType = try container.decode(BackupManagementTypeEnum?.self, forKey: .backupManagementType)
    }
    if container.contains(.operation) {
        self.operation = try container.decode(String?.self, forKey: .operation)
    }
    if container.contains(.status) {
        self.status = try container.decode(String?.self, forKey: .status)
    }
    if container.contains(.startTime) {
        self.startTime = DateConverter.fromString(dateStr: (try container.decode(String?.self, forKey: .startTime)), format: .dateTime)
    }
    if container.contains(.endTime) {
        self.endTime = DateConverter.fromString(dateStr: (try container.decode(String?.self, forKey: .endTime)), format: .dateTime)
    }
    if container.contains(.activityId) {
        self.activityId = try container.decode(String?.self, forKey: .activityId)
    }
    if container.contains(.duration) {
        self.duration = try container.decode(String?.self, forKey: .duration)
    }
    if container.contains(.actionsInfo) {
        self.actionsInfo = try container.decode([JobSupportedActionEnum?]?.self, forKey: .actionsInfo)
    }
    if container.contains(.errorDetails) {
        self.errorDetails = try container.decode([AzureWorkloadErrorInfoData?]?.self, forKey: .errorDetails)
    }
    if container.contains(.extendedInfo) {
        self.extendedInfo = try container.decode(AzureWorkloadJobExtendedInfoData?.self, forKey: .extendedInfo)
    }
    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.entityFriendlyName != nil {try container.encode(self.entityFriendlyName, forKey: .entityFriendlyName)}
    if self.backupManagementType != nil {try container.encode(self.backupManagementType, forKey: .backupManagementType)}
    if self.operation != nil {try container.encode(self.operation, forKey: .operation)}
    if self.status != nil {try container.encode(self.status, forKey: .status)}
    if self.startTime != nil {
        try container.encode(DateConverter.toString(date: self.startTime!, format: .dateTime), forKey: .startTime)
    }
    if self.endTime != nil {
        try container.encode(DateConverter.toString(date: self.endTime!, format: .dateTime), forKey: .endTime)
    }
    if self.activityId != nil {try container.encode(self.activityId, forKey: .activityId)}
    if self.duration != nil {try container.encode(self.duration, forKey: .duration)}
    if self.actionsInfo != nil {try container.encode(self.actionsInfo as! [JobSupportedActionEnum?]?, forKey: .actionsInfo)}
    if self.errorDetails != nil {try container.encode(self.errorDetails as! [AzureWorkloadErrorInfoData?]?, forKey: .errorDetails)}
    if self.extendedInfo != nil {try container.encode(self.extendedInfo as! AzureWorkloadJobExtendedInfoData?, forKey: .extendedInfo)}
  }
}

extension DataFactory {
  public static func createAzureWorkloadJobProtocol() -> AzureWorkloadJobProtocol {
    return AzureWorkloadJobData()
  }
}


// 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 AzureWorkloadJobExtendedInfoData : AzureWorkloadJobExtendedInfoProtocol {
    public var tasksList: [AzureWorkloadJobTaskDetailsProtocol?]?
    public var propertyBag: [String:String]?
    public var dynamicErrorMessage: String?

        enum CodingKeys: String, CodingKey {case tasksList = "tasksList"
        case propertyBag = "propertyBag"
        case dynamicErrorMessage = "dynamicErrorMessage"
        }

  public init()  {
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.tasksList) {
        self.tasksList = try container.decode([AzureWorkloadJobTaskDetailsData?]?.self, forKey: .tasksList)
    }
    if container.contains(.propertyBag) {
        self.propertyBag = try container.decode([String:String]?.self, forKey: .propertyBag)
    }
    if container.contains(.dynamicErrorMessage) {
        self.dynamicErrorMessage = try container.decode(String?.self, forKey: .dynamicErrorMessage)
    }
    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.tasksList != nil {try container.encode(self.tasksList as! [AzureWorkloadJobTaskDetailsData?]?, forKey: .tasksList)}
    if self.propertyBag != nil {try container.encode(self.propertyBag, forKey: .propertyBag)}
    if self.dynamicErrorMessage != nil {try container.encode(self.dynamicErrorMessage, forKey: .dynamicErrorMessage)}
  }
}

extension DataFactory {
  public static func createAzureWorkloadJobExtendedInfoProtocol() -> AzureWorkloadJobExtendedInfoProtocol {
    return AzureWorkloadJobExtendedInfoData()
  }
}


// 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 AzureWorkloadJobTaskDetailsData : AzureWorkloadJobTaskDetailsProtocol {
    public var taskId: String?
    public var status: String?

        enum CodingKeys: String, CodingKey {case taskId = "taskId"
        case status = "status"
        }

  public init()  {
  }

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

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

extension DataFactory {
  public static func createAzureWorkloadJobTaskDetailsProtocol() -> AzureWorkloadJobTaskDetailsProtocol {
    return AzureWorkloadJobTaskDetailsData()
  }
}


// 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 AzureWorkloadRecoveryPointData : AzureWorkloadRecoveryPointProtocol, RecoveryPointProtocol {
    public var recoveryPointTimeInUTC: Date?
    public var type: RestorePointTypeEnum?

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

  public init()  {
  }

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

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

extension DataFactory {
  public static func createAzureWorkloadRecoveryPointProtocol() -> AzureWorkloadRecoveryPointProtocol {
    return AzureWorkloadRecoveryPointData()
  }
}


// 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 AzureWorkloadRestoreRequestData : AzureWorkloadRestoreRequestProtocol, RestoreRequestProtocol {
    public var recoveryType: RecoveryTypeEnum?
    public var sourceResourceId: String?
    public var propertyBag: [String:String]?

        enum CodingKeys: String, CodingKey {case recoveryType = "recoveryType"
        case sourceResourceId = "sourceResourceId"
        case propertyBag = "propertyBag"
        }

  public init()  {
  }

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

extension DataFactory {
  public static func createAzureWorkloadRestoreRequestProtocol() -> AzureWorkloadRestoreRequestProtocol {
    return AzureWorkloadRestoreRequestData()
  }
}


// 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 AzureWorkloadSQLPointInTimeRecoveryPointData : AzureWorkloadSQLPointInTimeRecoveryPointProtocol, AzureWorkloadSQLRecoveryPointProtocol, AzureWorkloadRecoveryPointProtocol, RecoveryPointProtocol {
    public var recoveryPointTimeInUTC: Date?
    public var type: RestorePointTypeEnum?
    public var extendedInfo: AzureWorkloadSQLRecoveryPointExtendedInfoProtocol?
    public var timeRanges: [PointInTimeRangeProtocol?]?

        enum CodingKeys: String, CodingKey {case recoveryPointTimeInUTC = "recoveryPointTimeInUTC"
        case type = "type"
        case extendedInfo = "extendedInfo"
        case timeRanges = "timeRanges"
        }

  public init()  {
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.recoveryPointTimeInUTC) {
        self.recoveryPointTimeInUTC = DateConverter.fromString(dateStr: (try container.decode(String?.self, forKey: .recoveryPointTimeInUTC)), format: .dateTime)
    }
    if container.contains(.type) {
        self.type = try container.decode(RestorePointTypeEnum?.self, forKey: .type)
    }
    if container.contains(.extendedInfo) {
        self.extendedInfo = try container.decode(AzureWorkloadSQLRecoveryPointExtendedInfoData?.self, forKey: .extendedInfo)
    }
    if container.contains(.timeRanges) {
        self.timeRanges = try container.decode([PointInTimeRangeData?]?.self, forKey: .timeRanges)
    }
    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.recoveryPointTimeInUTC != nil {
        try container.encode(DateConverter.toString(date: self.recoveryPointTimeInUTC!, format: .dateTime), forKey: .recoveryPointTimeInUTC)
    }
    if self.type != nil {try container.encode(self.type, forKey: .type)}
    if self.extendedInfo != nil {try container.encode(self.extendedInfo as! AzureWorkloadSQLRecoveryPointExtendedInfoData?, forKey: .extendedInfo)}
    if self.timeRanges != nil {try container.encode(self.timeRanges as! [PointInTimeRangeData?]?, forKey: .timeRanges)}
  }
}

extension DataFactory {
  public static func createAzureWorkloadSQLPointInTimeRecoveryPointProtocol() -> AzureWorkloadSQLPointInTimeRecoveryPointProtocol {
    return AzureWorkloadSQLPointInTimeRecoveryPointData()
  }
}


// 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 AzureWorkloadSQLPointInTimeRestoreRequestData : AzureWorkloadSQLPointInTimeRestoreRequestProtocol, AzureWorkloadSQLRestoreRequestProtocol, AzureWorkloadRestoreRequestProtocol, RestoreRequestProtocol {
    public var recoveryType: RecoveryTypeEnum?
    public var sourceResourceId: String?
    public var propertyBag: [String:String]?
    public var shouldUseAlternateTargetLocation: Bool?
    public var isNonRecoverable: Bool?
    public var targetInfo: TargetRestoreInfoProtocol?
    public var alternateDirectoryPaths: [SQLDataDirectoryMappingProtocol?]?
    public var pointInTime: Date?

        enum CodingKeys: String, CodingKey {case recoveryType = "recoveryType"
        case sourceResourceId = "sourceResourceId"
        case propertyBag = "propertyBag"
        case shouldUseAlternateTargetLocation = "shouldUseAlternateTargetLocation"
        case isNonRecoverable = "isNonRecoverable"
        case targetInfo = "targetInfo"
        case alternateDirectoryPaths = "alternateDirectoryPaths"
        case pointInTime = "pointInTime"
        }

  public init()  {
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.recoveryType) {
        self.recoveryType = try container.decode(RecoveryTypeEnum?.self, forKey: .recoveryType)
    }
    if container.contains(.sourceResourceId) {
        self.sourceResourceId = try container.decode(String?.self, forKey: .sourceResourceId)
    }
    if container.contains(.propertyBag) {
        self.propertyBag = try container.decode([String:String]?.self, forKey: .propertyBag)
    }
    if container.contains(.shouldUseAlternateTargetLocation) {
        self.shouldUseAlternateTargetLocation = try container.decode(Bool?.self, forKey: .shouldUseAlternateTargetLocation)
    }
    if container.contains(.isNonRecoverable) {
        self.isNonRecoverable = try container.decode(Bool?.self, forKey: .isNonRecoverable)
    }
    if container.contains(.targetInfo) {
        self.targetInfo = try container.decode(TargetRestoreInfoData?.self, forKey: .targetInfo)
    }
    if container.contains(.alternateDirectoryPaths) {
        self.alternateDirectoryPaths = try container.decode([SQLDataDirectoryMappingData?]?.self, forKey: .alternateDirectoryPaths)
    }
    if container.contains(.pointInTime) {
        self.pointInTime = DateConverter.fromString(dateStr: (try container.decode(String?.self, forKey: .pointInTime)), 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.recoveryType != nil {try container.encode(self.recoveryType, forKey: .recoveryType)}
    if self.sourceResourceId != nil {try container.encode(self.sourceResourceId, forKey: .sourceResourceId)}
    if self.propertyBag != nil {try container.encode(self.propertyBag, forKey: .propertyBag)}
    if self.shouldUseAlternateTargetLocation != nil {try container.encode(self.shouldUseAlternateTargetLocation, forKey: .shouldUseAlternateTargetLocation)}
    if self.isNonRecoverable != nil {try container.encode(self.isNonRecoverable, forKey: .isNonRecoverable)}
    if self.targetInfo != nil {try container.encode(self.targetInfo as! TargetRestoreInfoData?, forKey: .targetInfo)}
    if self.alternateDirectoryPaths != nil {try container.encode(self.alternateDirectoryPaths as! [SQLDataDirectoryMappingData?]?, forKey: .alternateDirectoryPaths)}
    if self.pointInTime != nil {
        try container.encode(DateConverter.toString(date: self.pointInTime!, format: .dateTime), forKey: .pointInTime)
    }
  }
}

extension DataFactory {
  public static func createAzureWorkloadSQLPointInTimeRestoreRequestProtocol() -> AzureWorkloadSQLPointInTimeRestoreRequestProtocol {
    return AzureWorkloadSQLPointInTimeRestoreRequestData()
  }
}


// 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 AzureWorkloadSQLRecoveryPointData : AzureWorkloadSQLRecoveryPointProtocol, AzureWorkloadRecoveryPointProtocol, RecoveryPointProtocol {
    public var recoveryPointTimeInUTC: Date?
    public var type: RestorePointTypeEnum?
    public var extendedInfo: AzureWorkloadSQLRecoveryPointExtendedInfoProtocol?

        enum CodingKeys: String, CodingKey {case recoveryPointTimeInUTC = "recoveryPointTimeInUTC"
        case type = "type"
        case extendedInfo = "extendedInfo"
        }

  public init()  {
  }

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

extension DataFactory {
  public static func createAzureWorkloadSQLRecoveryPointProtocol() -> AzureWorkloadSQLRecoveryPointProtocol {
    return AzureWorkloadSQLRecoveryPointData()
  }
}


// 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 AzureWorkloadSQLRecoveryPointExtendedInfoData : AzureWorkloadSQLRecoveryPointExtendedInfoProtocol {
    public var dataDirectoryTimeInUTC: Date?
    public var dataDirectoryPaths: [SQLDataDirectoryProtocol?]?

        enum CodingKeys: String, CodingKey {case dataDirectoryTimeInUTC = "dataDirectoryTimeInUTC"
        case dataDirectoryPaths = "dataDirectoryPaths"
        }

  public init()  {
  }

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

extension DataFactory {
  public static func createAzureWorkloadSQLRecoveryPointExtendedInfoProtocol() -> AzureWorkloadSQLRecoveryPointExtendedInfoProtocol {
    return AzureWorkloadSQLRecoveryPointExtendedInfoData()
  }
}


// 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 AzureWorkloadSQLRestoreRequestData : AzureWorkloadSQLRestoreRequestProtocol, AzureWorkloadRestoreRequestProtocol, RestoreRequestProtocol {
    public var recoveryType: RecoveryTypeEnum?
    public var sourceResourceId: String?
    public var propertyBag: [String:String]?
    public var shouldUseAlternateTargetLocation: Bool?
    public var isNonRecoverable: Bool?
    public var targetInfo: TargetRestoreInfoProtocol?
    public var alternateDirectoryPaths: [SQLDataDirectoryMappingProtocol?]?

        enum CodingKeys: String, CodingKey {case recoveryType = "recoveryType"
        case sourceResourceId = "sourceResourceId"
        case propertyBag = "propertyBag"
        case shouldUseAlternateTargetLocation = "shouldUseAlternateTargetLocation"
        case isNonRecoverable = "isNonRecoverable"
        case targetInfo = "targetInfo"
        case alternateDirectoryPaths = "alternateDirectoryPaths"
        }

  public init()  {
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.recoveryType) {
        self.recoveryType = try container.decode(RecoveryTypeEnum?.self, forKey: .recoveryType)
    }
    if container.contains(.sourceResourceId) {
        self.sourceResourceId = try container.decode(String?.self, forKey: .sourceResourceId)
    }
    if container.contains(.propertyBag) {
        self.propertyBag = try container.decode([String:String]?.self, forKey: .propertyBag)
    }
    if container.contains(.shouldUseAlternateTargetLocation) {
        self.shouldUseAlternateTargetLocation = try container.decode(Bool?.self, forKey: .shouldUseAlternateTargetLocation)
    }
    if container.contains(.isNonRecoverable) {
        self.isNonRecoverable = try container.decode(Bool?.self, forKey: .isNonRecoverable)
    }
    if container.contains(.targetInfo) {
        self.targetInfo = try container.decode(TargetRestoreInfoData?.self, forKey: .targetInfo)
    }
    if container.contains(.alternateDirectoryPaths) {
        self.alternateDirectoryPaths = try container.decode([SQLDataDirectoryMappingData?]?.self, forKey: .alternateDirectoryPaths)
    }
    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.recoveryType != nil {try container.encode(self.recoveryType, forKey: .recoveryType)}
    if self.sourceResourceId != nil {try container.encode(self.sourceResourceId, forKey: .sourceResourceId)}
    if self.propertyBag != nil {try container.encode(self.propertyBag, forKey: .propertyBag)}
    if self.shouldUseAlternateTargetLocation != nil {try container.encode(self.shouldUseAlternateTargetLocation, forKey: .shouldUseAlternateTargetLocation)}
    if self.isNonRecoverable != nil {try container.encode(self.isNonRecoverable, forKey: .isNonRecoverable)}
    if self.targetInfo != nil {try container.encode(self.targetInfo as! TargetRestoreInfoData?, forKey: .targetInfo)}
    if self.alternateDirectoryPaths != nil {try container.encode(self.alternateDirectoryPaths as! [SQLDataDirectoryMappingData?]?, forKey: .alternateDirectoryPaths)}
  }
}

extension DataFactory {
  public static func createAzureWorkloadSQLRestoreRequestProtocol() -> AzureWorkloadSQLRestoreRequestProtocol {
    return AzureWorkloadSQLRestoreRequestData()
  }
}


// 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 BackupEngineBaseData : BackupEngineBaseProtocol {
    public var friendlyName: String?
    public var backupManagementType: BackupManagementTypeEnum?
    public var registrationStatus: String?
    public var backupEngineState: String?
    public var healthStatus: String?
    public var canReRegister: Bool?
    public var backupEngineId: String?
    public var dpmVersion: String?
    public var azureBackupAgentVersion: String?
    public var isAzureBackupAgentUpgradeAvailable: Bool?
    public var isDpmUpgradeAvailable: Bool?
    public var extendedInfo: BackupEngineExtendedInfoProtocol?

        enum CodingKeys: String, CodingKey {case friendlyName = "friendlyName"
        case backupManagementType = "backupManagementType"
        case registrationStatus = "registrationStatus"
        case backupEngineState = "backupEngineState"
        case healthStatus = "healthStatus"
        case canReRegister = "canReRegister"
        case backupEngineId = "backupEngineId"
        case dpmVersion = "dpmVersion"
        case azureBackupAgentVersion = "azureBackupAgentVersion"
        case isAzureBackupAgentUpgradeAvailable = "isAzureBackupAgentUpgradeAvailable"
        case isDpmUpgradeAvailable = "isDpmUpgradeAvailable"
        case extendedInfo = "extendedInfo"
        }

  public init()  {
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.friendlyName) {
        self.friendlyName = try container.decode(String?.self, forKey: .friendlyName)
    }
    if container.contains(.backupManagementType) {
        self.backupManagementType = try container.decode(BackupManagementTypeEnum?.self, forKey: .backupManagementType)
    }
    if container.contains(.registrationStatus) {
        self.registrationStatus = try container.decode(String?.self, forKey: .registrationStatus)
    }
    if container.contains(.backupEngineState) {
        self.backupEngineState = try container.decode(String?.self, forKey: .backupEngineState)
    }
    if container.contains(.healthStatus) {
        self.healthStatus = try container.decode(String?.self, forKey: .healthStatus)
    }
    if container.contains(.canReRegister) {
        self.canReRegister = try container.decode(Bool?.self, forKey: .canReRegister)
    }
    if container.contains(.backupEngineId) {
        self.backupEngineId = try container.decode(String?.self, forKey: .backupEngineId)
    }
    if container.contains(.dpmVersion) {
        self.dpmVersion = try container.decode(String?.self, forKey: .dpmVersion)
    }
    if container.contains(.azureBackupAgentVersion) {
        self.azureBackupAgentVersion = try container.decode(String?.self, forKey: .azureBackupAgentVersion)
    }
    if container.contains(.isAzureBackupAgentUpgradeAvailable) {
        self.isAzureBackupAgentUpgradeAvailable = try container.decode(Bool?.self, forKey: .isAzureBackupAgentUpgradeAvailable)
    }
    if container.contains(.isDpmUpgradeAvailable) {
        self.isDpmUpgradeAvailable = try container.decode(Bool?.self, forKey: .isDpmUpgradeAvailable)
    }
    if container.contains(.extendedInfo) {
        self.extendedInfo = try container.decode(BackupEngineExtendedInfoData?.self, forKey: .extendedInfo)
    }
    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.friendlyName != nil {try container.encode(self.friendlyName, forKey: .friendlyName)}
    if self.backupManagementType != nil {try container.encode(self.backupManagementType, forKey: .backupManagementType)}
    if self.registrationStatus != nil {try container.encode(self.registrationStatus, forKey: .registrationStatus)}
    if self.backupEngineState != nil {try container.encode(self.backupEngineState, forKey: .backupEngineState)}
    if self.healthStatus != nil {try container.encode(self.healthStatus, forKey: .healthStatus)}
    if self.canReRegister != nil {try container.encode(self.canReRegister, forKey: .canReRegister)}
    if self.backupEngineId != nil {try container.encode(self.backupEngineId, forKey: .backupEngineId)}
    if self.dpmVersion != nil {try container.encode(self.dpmVersion, forKey: .dpmVersion)}
    if self.azureBackupAgentVersion != nil {try container.encode(self.azureBackupAgentVersion, forKey: .azureBackupAgentVersion)}
    if self.isAzureBackupAgentUpgradeAvailable != nil {try container.encode(self.isAzureBackupAgentUpgradeAvailable, forKey: .isAzureBackupAgentUpgradeAvailable)}
    if self.isDpmUpgradeAvailable != nil {try container.encode(self.isDpmUpgradeAvailable, forKey: .isDpmUpgradeAvailable)}
    if self.extendedInfo != nil {try container.encode(self.extendedInfo as! BackupEngineExtendedInfoData?, forKey: .extendedInfo)}
  }
}

extension DataFactory {
  public static func createBackupEngineBaseProtocol() -> BackupEngineBaseProtocol {
    return BackupEngineBaseData()
  }
}


// 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 BackupEngineBaseResourceData : BackupEngineBaseResourceProtocol, ResourceProtocol {
    public var id: String?
    public var name: String?
    public var type: String?
    public var location: String?
    public var tags: [String:String]?
    public var eTag: String?
    public var properties: BackupEngineBaseProtocol?

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

  public init()  {
  }

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

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

extension DataFactory {
  public static func createBackupEngineBaseResourceProtocol() -> BackupEngineBaseResourceProtocol {
    return BackupEngineBaseResourceData()
  }
}


// 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 BackupEngineBaseResourceListData : BackupEngineBaseResourceListProtocol, ResourceListProtocol {
    public var _nextLink: String?
    public var value: [BackupEngineBaseResourceProtocol?]?

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

  public init()  {
  }

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

extension DataFactory {
  public static func createBackupEngineBaseResourceListProtocol() -> BackupEngineBaseResourceListProtocol {
    return BackupEngineBaseResourceListData()
  }
}


// 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 BackupEngineExtendedInfoData : BackupEngineExtendedInfoProtocol {
    public var databaseName: String?
    public var protectedItemsCount: Int32?
    public var protectedServersCount: Int32?
    public var diskCount: Int32?
    public var usedDiskSpace: Double?
    public var availableDiskSpace: Double?
    public var refreshedAt: Date?
    public var azureProtectedInstances: Int32?

        enum CodingKeys: String, CodingKey {case databaseName = "databaseName"
        case protectedItemsCount = "protectedItemsCount"
        case protectedServersCount = "protectedServersCount"
        case diskCount = "diskCount"
        case usedDiskSpace = "usedDiskSpace"
        case availableDiskSpace = "availableDiskSpace"
        case refreshedAt = "refreshedAt"
        case azureProtectedInstances = "azureProtectedInstances"
        }

  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(.protectedItemsCount) {
        self.protectedItemsCount = try container.decode(Int32?.self, forKey: .protectedItemsCount)
    }
    if container.contains(.protectedServersCount) {
        self.protectedServersCount = try container.decode(Int32?.self, forKey: .protectedServersCount)
    }
    if container.contains(.diskCount) {
        self.diskCount = try container.decode(Int32?.self, forKey: .diskCount)
    }
    if container.contains(.usedDiskSpace) {
        self.usedDiskSpace = try container.decode(Double?.self, forKey: .usedDiskSpace)
    }
    if container.contains(.availableDiskSpace) {
        self.availableDiskSpace = try container.decode(Double?.self, forKey: .availableDiskSpace)
    }
    if container.contains(.refreshedAt) {
        self.refreshedAt = DateConverter.fromString(dateStr: (try container.decode(String?.self, forKey: .refreshedAt)), format: .dateTime)
    }
    if container.contains(.azureProtectedInstances) {
        self.azureProtectedInstances = try container.decode(Int32?.self, forKey: .azureProtectedInstances)
    }
    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.protectedItemsCount != nil {try container.encode(self.protectedItemsCount, forKey: .protectedItemsCount)}
    if self.protectedServersCount != nil {try container.encode(self.protectedServersCount, forKey: .protectedServersCount)}
    if self.diskCount != nil {try container.encode(self.diskCount, forKey: .diskCount)}
    if self.usedDiskSpace != nil {try container.encode(self.usedDiskSpace, forKey: .usedDiskSpace)}
    if self.availableDiskSpace != nil {try container.encode(self.availableDiskSpace, forKey: .availableDiskSpace)}
    if self.refreshedAt != nil {
        try container.encode(DateConverter.toString(date: self.refreshedAt!, format: .dateTime), forKey: .refreshedAt)
    }
    if self.azureProtectedInstances != nil {try container.encode(self.azureProtectedInstances, forKey: .azureProtectedInstances)}
  }
}

extension DataFactory {
  public static func createBackupEngineExtendedInfoProtocol() -> BackupEngineExtendedInfoProtocol {
    return BackupEngineExtendedInfoData()
  }
}


// BackupItemType enumerates the values for backup item type.

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
public enum BackupItemTypeEnum: String, Codable
{
// BackupItemTypeAzureFileShare specifies the backup item type azure file share state for backup item type.
    case BackupItemTypeAzureFileShare = "AzureFileShare"
// BackupItemTypeAzureSqlDb specifies the backup item type azure sql db state for backup item type.
    case BackupItemTypeAzureSqlDb = "AzureSqlDb"
// BackupItemTypeClient specifies the backup item type client state for backup item type.
    case BackupItemTypeClient = "Client"
// BackupItemTypeExchange specifies the backup item type exchange state for backup item type.
    case BackupItemTypeExchange = "Exchange"
// BackupItemTypeFileFolder specifies the backup item type file folder state for backup item type.
    case BackupItemTypeFileFolder = "FileFolder"
// BackupItemTypeGenericDataSource specifies the backup item type generic data source state for backup item type.
    case BackupItemTypeGenericDataSource = "GenericDataSource"
// BackupItemTypeInvalid specifies the backup item type invalid state for backup item type.
    case BackupItemTypeInvalid = "Invalid"
// BackupItemTypeSharepoint specifies the backup item type sharepoint state for backup item type.
    case BackupItemTypeSharepoint = "Sharepoint"
// BackupItemTypeSQLDataBase specifies the backup item type sql data base state for backup item type.
    case BackupItemTypeSQLDataBase = "SQLDataBase"
// BackupItemTypeSQLDB specifies the backup item type sqldb state for backup item type.
    case BackupItemTypeSQLDB = "SQLDB"
// BackupItemTypeSystemState specifies the backup item type system state state for backup item type.
    case BackupItemTypeSystemState = "SystemState"
// BackupItemTypeVM specifies the backup item type vm state for backup item type.
    case BackupItemTypeVM = "VM"
// BackupItemTypeVMwareVM specifies the backup item type v mware vm state for backup item type.
    case BackupItemTypeVMwareVM = "VMwareVM"
}