// 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 AppServiceCertificateOrderData : AppServiceCertificateOrderProtocol, ResourceProtocol {
    public var id: String?
    public var name: String?
    public var kind: String?
    public var location: String
    public var type: String?
    public var tags: [String:String]?
    public var properties: AppServiceCertificateOrderPropertiesProtocol?

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

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

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.id) {
        self.id = try container.decode(String?.self, forKey: .id)
    }
    if container.contains(.name) {
        self.name = try container.decode(String?.self, forKey: .name)
    }
    if container.contains(.kind) {
        self.kind = try container.decode(String?.self, forKey: .kind)
    }
    self.location = try container.decode(String.self, forKey: .location)
    if container.contains(.type) {
        self.type = try container.decode(String?.self, forKey: .type)
    }
    if container.contains(.tags) {
        self.tags = try container.decode([String:String]?.self, forKey: .tags)
    }
    if container.contains(.properties) {
        self.properties = try container.decode(AppServiceCertificateOrderPropertiesData?.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.kind != nil {try container.encode(self.kind, forKey: .kind)}
    try container.encode(self.location, forKey: .location)
    if self.type != nil {try container.encode(self.type, forKey: .type)}
    if self.tags != nil {try container.encode(self.tags, forKey: .tags)}
    if self.properties != nil {try container.encode(self.properties as! AppServiceCertificateOrderPropertiesData?, forKey: .properties)}
  }
}

extension DataFactory {
  public static func createAppServiceCertificateOrderProtocol(location: String) -> AppServiceCertificateOrderProtocol {
    return AppServiceCertificateOrderData(location: location)
  }
}


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

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

  public init()  {
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.id) {
        self.id = try container.decode(String?.self, forKey: .id)
    }
    if container.contains(.name) {
        self.name = try container.decode(String?.self, forKey: .name)
    }
    if container.contains(.kind) {
        self.kind = try container.decode(String?.self, forKey: .kind)
    }
    if container.contains(.type) {
        self.type = try container.decode(String?.self, forKey: .type)
    }
    if container.contains(.properties) {
        self.properties = try container.decode(AppServiceCertificateOrderPatchResourcePropertiesData?.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.kind != nil {try container.encode(self.kind, forKey: .kind)}
    if self.type != nil {try container.encode(self.type, forKey: .type)}
    if self.properties != nil {try container.encode(self.properties as! AppServiceCertificateOrderPatchResourcePropertiesData?, forKey: .properties)}
  }
}

extension DataFactory {
  public static func createAppServiceCertificateOrderPatchResourceProtocol() -> AppServiceCertificateOrderPatchResourceProtocol {
    return AppServiceCertificateOrderPatchResourceData()
  }
}


// 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 AppServiceCertificateOrderPatchResourcePropertiesData : AppServiceCertificateOrderPatchResourcePropertiesProtocol {
    public var certificates: [String:AppServiceCertificateProtocol?]?
    public var distinguishedName: String?
    public var domainVerificationToken: String?
    public var validityInYears: Int32?
    public var keySize: Int32?
    public var productType: CertificateProductTypeEnum?
    public var autoRenew: Bool?
    public var provisioningState: ProvisioningStateEnum?
    public var status: CertificateOrderStatusEnum?
    public var signedCertificate: CertificateDetailsProtocol?
    public var csr: String?
    public var intermediate: CertificateDetailsProtocol?
    public var root: CertificateDetailsProtocol?
    public var serialNumber: String?
    public var lastCertificateIssuanceTime: Date?
    public var expirationTime: Date?
    public var isPrivateKeyExternal: Bool?
    public var appServiceCertificateNotRenewableReasons: [String?]?
    public var nextAutoRenewalTimeStamp: Date?

        enum CodingKeys: String, CodingKey {case certificates = "certificates"
        case distinguishedName = "distinguishedName"
        case domainVerificationToken = "domainVerificationToken"
        case validityInYears = "validityInYears"
        case keySize = "keySize"
        case productType = "productType"
        case autoRenew = "autoRenew"
        case provisioningState = "provisioningState"
        case status = "status"
        case signedCertificate = "signedCertificate"
        case csr = "csr"
        case intermediate = "intermediate"
        case root = "root"
        case serialNumber = "serialNumber"
        case lastCertificateIssuanceTime = "lastCertificateIssuanceTime"
        case expirationTime = "expirationTime"
        case isPrivateKeyExternal = "isPrivateKeyExternal"
        case appServiceCertificateNotRenewableReasons = "appServiceCertificateNotRenewableReasons"
        case nextAutoRenewalTimeStamp = "nextAutoRenewalTimeStamp"
        }

  public init()  {
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.certificates) {
        self.certificates = try container.decode([String:AppServiceCertificateData?]?.self, forKey: .certificates)
    }
    if container.contains(.distinguishedName) {
        self.distinguishedName = try container.decode(String?.self, forKey: .distinguishedName)
    }
    if container.contains(.domainVerificationToken) {
        self.domainVerificationToken = try container.decode(String?.self, forKey: .domainVerificationToken)
    }
    if container.contains(.validityInYears) {
        self.validityInYears = try container.decode(Int32?.self, forKey: .validityInYears)
    }
    if container.contains(.keySize) {
        self.keySize = try container.decode(Int32?.self, forKey: .keySize)
    }
    if container.contains(.productType) {
        self.productType = try container.decode(CertificateProductTypeEnum?.self, forKey: .productType)
    }
    if container.contains(.autoRenew) {
        self.autoRenew = try container.decode(Bool?.self, forKey: .autoRenew)
    }
    if container.contains(.provisioningState) {
        self.provisioningState = try container.decode(ProvisioningStateEnum?.self, forKey: .provisioningState)
    }
    if container.contains(.status) {
        self.status = try container.decode(CertificateOrderStatusEnum?.self, forKey: .status)
    }
    if container.contains(.signedCertificate) {
        self.signedCertificate = try container.decode(CertificateDetailsData?.self, forKey: .signedCertificate)
    }
    if container.contains(.csr) {
        self.csr = try container.decode(String?.self, forKey: .csr)
    }
    if container.contains(.intermediate) {
        self.intermediate = try container.decode(CertificateDetailsData?.self, forKey: .intermediate)
    }
    if container.contains(.root) {
        self.root = try container.decode(CertificateDetailsData?.self, forKey: .root)
    }
    if container.contains(.serialNumber) {
        self.serialNumber = try container.decode(String?.self, forKey: .serialNumber)
    }
    if container.contains(.lastCertificateIssuanceTime) {
        self.lastCertificateIssuanceTime = DateConverter.fromString(dateStr: (try container.decode(String?.self, forKey: .lastCertificateIssuanceTime)), format: .dateTime)
    }
    if container.contains(.expirationTime) {
        self.expirationTime = DateConverter.fromString(dateStr: (try container.decode(String?.self, forKey: .expirationTime)), format: .dateTime)
    }
    if container.contains(.isPrivateKeyExternal) {
        self.isPrivateKeyExternal = try container.decode(Bool?.self, forKey: .isPrivateKeyExternal)
    }
    if container.contains(.appServiceCertificateNotRenewableReasons) {
        self.appServiceCertificateNotRenewableReasons = try container.decode([String?]?.self, forKey: .appServiceCertificateNotRenewableReasons)
    }
    if container.contains(.nextAutoRenewalTimeStamp) {
        self.nextAutoRenewalTimeStamp = DateConverter.fromString(dateStr: (try container.decode(String?.self, forKey: .nextAutoRenewalTimeStamp)), 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.certificates != nil {try container.encode(self.certificates, forKey: .certificates)}
    if self.distinguishedName != nil {try container.encode(self.distinguishedName, forKey: .distinguishedName)}
    if self.domainVerificationToken != nil {try container.encode(self.domainVerificationToken, forKey: .domainVerificationToken)}
    if self.validityInYears != nil {try container.encode(self.validityInYears, forKey: .validityInYears)}
    if self.keySize != nil {try container.encode(self.keySize, forKey: .keySize)}
    if self.productType != nil {try container.encode(self.productType, forKey: .productType)}
    if self.autoRenew != nil {try container.encode(self.autoRenew, forKey: .autoRenew)}
    if self.provisioningState != nil {try container.encode(self.provisioningState, forKey: .provisioningState)}
    if self.status != nil {try container.encode(self.status, forKey: .status)}
    if self.signedCertificate != nil {try container.encode(self.signedCertificate as! CertificateDetailsData?, forKey: .signedCertificate)}
    if self.csr != nil {try container.encode(self.csr, forKey: .csr)}
    if self.intermediate != nil {try container.encode(self.intermediate as! CertificateDetailsData?, forKey: .intermediate)}
    if self.root != nil {try container.encode(self.root as! CertificateDetailsData?, forKey: .root)}
    if self.serialNumber != nil {try container.encode(self.serialNumber, forKey: .serialNumber)}
    if self.lastCertificateIssuanceTime != nil {
        try container.encode(DateConverter.toString(date: self.lastCertificateIssuanceTime!, format: .dateTime), forKey: .lastCertificateIssuanceTime)
    }
    if self.expirationTime != nil {
        try container.encode(DateConverter.toString(date: self.expirationTime!, format: .dateTime), forKey: .expirationTime)
    }
    if self.isPrivateKeyExternal != nil {try container.encode(self.isPrivateKeyExternal, forKey: .isPrivateKeyExternal)}
    if self.appServiceCertificateNotRenewableReasons != nil {try container.encode(self.appServiceCertificateNotRenewableReasons as! [String?]?, forKey: .appServiceCertificateNotRenewableReasons)}
    if self.nextAutoRenewalTimeStamp != nil {
        try container.encode(DateConverter.toString(date: self.nextAutoRenewalTimeStamp!, format: .dateTime), forKey: .nextAutoRenewalTimeStamp)
    }
  }
}

extension DataFactory {
  public static func createAppServiceCertificateOrderPatchResourcePropertiesProtocol() -> AppServiceCertificateOrderPatchResourcePropertiesProtocol {
    return AppServiceCertificateOrderPatchResourcePropertiesData()
  }
}


// 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 AppServiceCertificateOrderPropertiesData : AppServiceCertificateOrderPropertiesProtocol {
    public var certificates: [String:AppServiceCertificateProtocol?]?
    public var distinguishedName: String?
    public var domainVerificationToken: String?
    public var validityInYears: Int32?
    public var keySize: Int32?
    public var productType: CertificateProductTypeEnum?
    public var autoRenew: Bool?
    public var provisioningState: ProvisioningStateEnum?
    public var status: CertificateOrderStatusEnum?
    public var signedCertificate: CertificateDetailsProtocol?
    public var csr: String?
    public var intermediate: CertificateDetailsProtocol?
    public var root: CertificateDetailsProtocol?
    public var serialNumber: String?
    public var lastCertificateIssuanceTime: Date?
    public var expirationTime: Date?
    public var isPrivateKeyExternal: Bool?
    public var appServiceCertificateNotRenewableReasons: [String?]?
    public var nextAutoRenewalTimeStamp: Date?

        enum CodingKeys: String, CodingKey {case certificates = "certificates"
        case distinguishedName = "distinguishedName"
        case domainVerificationToken = "domainVerificationToken"
        case validityInYears = "validityInYears"
        case keySize = "keySize"
        case productType = "productType"
        case autoRenew = "autoRenew"
        case provisioningState = "provisioningState"
        case status = "status"
        case signedCertificate = "signedCertificate"
        case csr = "csr"
        case intermediate = "intermediate"
        case root = "root"
        case serialNumber = "serialNumber"
        case lastCertificateIssuanceTime = "lastCertificateIssuanceTime"
        case expirationTime = "expirationTime"
        case isPrivateKeyExternal = "isPrivateKeyExternal"
        case appServiceCertificateNotRenewableReasons = "appServiceCertificateNotRenewableReasons"
        case nextAutoRenewalTimeStamp = "nextAutoRenewalTimeStamp"
        }

  public init()  {
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.certificates) {
        self.certificates = try container.decode([String:AppServiceCertificateData?]?.self, forKey: .certificates)
    }
    if container.contains(.distinguishedName) {
        self.distinguishedName = try container.decode(String?.self, forKey: .distinguishedName)
    }
    if container.contains(.domainVerificationToken) {
        self.domainVerificationToken = try container.decode(String?.self, forKey: .domainVerificationToken)
    }
    if container.contains(.validityInYears) {
        self.validityInYears = try container.decode(Int32?.self, forKey: .validityInYears)
    }
    if container.contains(.keySize) {
        self.keySize = try container.decode(Int32?.self, forKey: .keySize)
    }
    if container.contains(.productType) {
        self.productType = try container.decode(CertificateProductTypeEnum?.self, forKey: .productType)
    }
    if container.contains(.autoRenew) {
        self.autoRenew = try container.decode(Bool?.self, forKey: .autoRenew)
    }
    if container.contains(.provisioningState) {
        self.provisioningState = try container.decode(ProvisioningStateEnum?.self, forKey: .provisioningState)
    }
    if container.contains(.status) {
        self.status = try container.decode(CertificateOrderStatusEnum?.self, forKey: .status)
    }
    if container.contains(.signedCertificate) {
        self.signedCertificate = try container.decode(CertificateDetailsData?.self, forKey: .signedCertificate)
    }
    if container.contains(.csr) {
        self.csr = try container.decode(String?.self, forKey: .csr)
    }
    if container.contains(.intermediate) {
        self.intermediate = try container.decode(CertificateDetailsData?.self, forKey: .intermediate)
    }
    if container.contains(.root) {
        self.root = try container.decode(CertificateDetailsData?.self, forKey: .root)
    }
    if container.contains(.serialNumber) {
        self.serialNumber = try container.decode(String?.self, forKey: .serialNumber)
    }
    if container.contains(.lastCertificateIssuanceTime) {
        self.lastCertificateIssuanceTime = DateConverter.fromString(dateStr: (try container.decode(String?.self, forKey: .lastCertificateIssuanceTime)), format: .dateTime)
    }
    if container.contains(.expirationTime) {
        self.expirationTime = DateConverter.fromString(dateStr: (try container.decode(String?.self, forKey: .expirationTime)), format: .dateTime)
    }
    if container.contains(.isPrivateKeyExternal) {
        self.isPrivateKeyExternal = try container.decode(Bool?.self, forKey: .isPrivateKeyExternal)
    }
    if container.contains(.appServiceCertificateNotRenewableReasons) {
        self.appServiceCertificateNotRenewableReasons = try container.decode([String?]?.self, forKey: .appServiceCertificateNotRenewableReasons)
    }
    if container.contains(.nextAutoRenewalTimeStamp) {
        self.nextAutoRenewalTimeStamp = DateConverter.fromString(dateStr: (try container.decode(String?.self, forKey: .nextAutoRenewalTimeStamp)), 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.certificates != nil {try container.encode(self.certificates, forKey: .certificates)}
    if self.distinguishedName != nil {try container.encode(self.distinguishedName, forKey: .distinguishedName)}
    if self.domainVerificationToken != nil {try container.encode(self.domainVerificationToken, forKey: .domainVerificationToken)}
    if self.validityInYears != nil {try container.encode(self.validityInYears, forKey: .validityInYears)}
    if self.keySize != nil {try container.encode(self.keySize, forKey: .keySize)}
    if self.productType != nil {try container.encode(self.productType, forKey: .productType)}
    if self.autoRenew != nil {try container.encode(self.autoRenew, forKey: .autoRenew)}
    if self.provisioningState != nil {try container.encode(self.provisioningState, forKey: .provisioningState)}
    if self.status != nil {try container.encode(self.status, forKey: .status)}
    if self.signedCertificate != nil {try container.encode(self.signedCertificate as! CertificateDetailsData?, forKey: .signedCertificate)}
    if self.csr != nil {try container.encode(self.csr, forKey: .csr)}
    if self.intermediate != nil {try container.encode(self.intermediate as! CertificateDetailsData?, forKey: .intermediate)}
    if self.root != nil {try container.encode(self.root as! CertificateDetailsData?, forKey: .root)}
    if self.serialNumber != nil {try container.encode(self.serialNumber, forKey: .serialNumber)}
    if self.lastCertificateIssuanceTime != nil {
        try container.encode(DateConverter.toString(date: self.lastCertificateIssuanceTime!, format: .dateTime), forKey: .lastCertificateIssuanceTime)
    }
    if self.expirationTime != nil {
        try container.encode(DateConverter.toString(date: self.expirationTime!, format: .dateTime), forKey: .expirationTime)
    }
    if self.isPrivateKeyExternal != nil {try container.encode(self.isPrivateKeyExternal, forKey: .isPrivateKeyExternal)}
    if self.appServiceCertificateNotRenewableReasons != nil {try container.encode(self.appServiceCertificateNotRenewableReasons as! [String?]?, forKey: .appServiceCertificateNotRenewableReasons)}
    if self.nextAutoRenewalTimeStamp != nil {
        try container.encode(DateConverter.toString(date: self.nextAutoRenewalTimeStamp!, format: .dateTime), forKey: .nextAutoRenewalTimeStamp)
    }
  }
}

extension DataFactory {
  public static func createAppServiceCertificateOrderPropertiesProtocol() -> AppServiceCertificateOrderPropertiesProtocol {
    return AppServiceCertificateOrderPropertiesData()
  }
}


// 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 AppServiceCertificatePatchResourceData : AppServiceCertificatePatchResourceProtocol, ProxyOnlyResourceProtocol {
    public var id: String?
    public var name: String?
    public var kind: String?
    public var type: String?
    public var properties: AppServiceCertificateProtocol?

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

  public init()  {
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.id) {
        self.id = try container.decode(String?.self, forKey: .id)
    }
    if container.contains(.name) {
        self.name = try container.decode(String?.self, forKey: .name)
    }
    if container.contains(.kind) {
        self.kind = try container.decode(String?.self, forKey: .kind)
    }
    if container.contains(.type) {
        self.type = try container.decode(String?.self, forKey: .type)
    }
    if container.contains(.properties) {
        self.properties = try container.decode(AppServiceCertificateData?.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.kind != nil {try container.encode(self.kind, forKey: .kind)}
    if self.type != nil {try container.encode(self.type, forKey: .type)}
    if self.properties != nil {try container.encode(self.properties as! AppServiceCertificateData?, forKey: .properties)}
  }
}

extension DataFactory {
  public static func createAppServiceCertificatePatchResourceProtocol() -> AppServiceCertificatePatchResourceProtocol {
    return AppServiceCertificatePatchResourceData()
  }
}


// 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 AppServiceCertificateResourceData : AppServiceCertificateResourceProtocol, ResourceProtocol {
    public var id: String?
    public var name: String?
    public var kind: String?
    public var location: String
    public var type: String?
    public var tags: [String:String]?
    public var properties: AppServiceCertificateProtocol?

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

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

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.id) {
        self.id = try container.decode(String?.self, forKey: .id)
    }
    if container.contains(.name) {
        self.name = try container.decode(String?.self, forKey: .name)
    }
    if container.contains(.kind) {
        self.kind = try container.decode(String?.self, forKey: .kind)
    }
    self.location = try container.decode(String.self, forKey: .location)
    if container.contains(.type) {
        self.type = try container.decode(String?.self, forKey: .type)
    }
    if container.contains(.tags) {
        self.tags = try container.decode([String:String]?.self, forKey: .tags)
    }
    if container.contains(.properties) {
        self.properties = try container.decode(AppServiceCertificateData?.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.kind != nil {try container.encode(self.kind, forKey: .kind)}
    try container.encode(self.location, forKey: .location)
    if self.type != nil {try container.encode(self.type, forKey: .type)}
    if self.tags != nil {try container.encode(self.tags, forKey: .tags)}
    if self.properties != nil {try container.encode(self.properties as! AppServiceCertificateData?, forKey: .properties)}
  }
}

extension DataFactory {
  public static func createAppServiceCertificateResourceProtocol(location: String) -> AppServiceCertificateResourceProtocol {
    return AppServiceCertificateResourceData(location: location)
  }
}


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

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

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

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

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

extension DataFactory {
  public static func createAppServiceEnvironmentCollectionProtocol(value: [AppServiceEnvironmentResourceProtocol]) -> AppServiceEnvironmentCollectionProtocol {
    return AppServiceEnvironmentCollectionData(value: value)
  }
}


// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
import Foundation
import azureSwiftRuntime
internal struct AppServiceEnvironmentData : AppServiceEnvironmentProtocol {
    public var name: String
    public var location: String
    public var provisioningState: ProvisioningStateEnum?
    public var status: HostingEnvironmentStatusEnum?
    public var vnetName: String?
    public var vnetResourceGroupName: String?
    public var vnetSubnetName: String?
    public var virtualNetwork: VirtualNetworkProfileProtocol
    public var internalLoadBalancingMode: InternalLoadBalancingModeEnum?
    public var multiSize: String?
    public var multiRoleCount: Int32?
    public var workerPools: [WorkerPoolProtocol]
    public var ipsslAddressCount: Int32?
    public var databaseEdition: String?
    public var databaseServiceObjective: String?
    public var upgradeDomains: Int32?
    public var subscriptionId: String?
    public var dnsSuffix: String?
    public var lastAction: String?
    public var lastActionResult: String?
    public var allowedMultiSizes: String?
    public var allowedWorkerSizes: String?
    public var maximumNumberOfMachines: Int32?
    public var vipMappings: [VirtualIPMappingProtocol?]?
    public var environmentCapacities: [StampCapacityProtocol?]?
    public var networkAccessControlList: [NetworkAccessControlEntryProtocol?]?
    public var environmentIsHealthy: Bool?
    public var environmentStatus: String?
    public var resourceGroup: String?
    public var frontEndScaleFactor: Int32?
    public var defaultFrontEndScaleFactor: Int32?
    public var apiManagementAccountId: String?
    public var suspended: Bool?
    public var dynamicCacheEnabled: Bool?
    public var clusterSettings: [NameValuePairProtocol?]?
    public var userWhitelistedIpRanges: [String]?

        enum CodingKeys: String, CodingKey {case name = "name"
        case location = "location"
        case provisioningState = "provisioningState"
        case status = "status"
        case vnetName = "vnetName"
        case vnetResourceGroupName = "vnetResourceGroupName"
        case vnetSubnetName = "vnetSubnetName"
        case virtualNetwork = "virtualNetwork"
        case internalLoadBalancingMode = "internalLoadBalancingMode"
        case multiSize = "multiSize"
        case multiRoleCount = "multiRoleCount"
        case workerPools = "workerPools"
        case ipsslAddressCount = "ipsslAddressCount"
        case databaseEdition = "databaseEdition"
        case databaseServiceObjective = "databaseServiceObjective"
        case upgradeDomains = "upgradeDomains"
        case subscriptionId = "subscriptionId"
        case dnsSuffix = "dnsSuffix"
        case lastAction = "lastAction"
        case lastActionResult = "lastActionResult"
        case allowedMultiSizes = "allowedMultiSizes"
        case allowedWorkerSizes = "allowedWorkerSizes"
        case maximumNumberOfMachines = "maximumNumberOfMachines"
        case vipMappings = "vipMappings"
        case environmentCapacities = "environmentCapacities"
        case networkAccessControlList = "networkAccessControlList"
        case environmentIsHealthy = "environmentIsHealthy"
        case environmentStatus = "environmentStatus"
        case resourceGroup = "resourceGroup"
        case frontEndScaleFactor = "frontEndScaleFactor"
        case defaultFrontEndScaleFactor = "defaultFrontEndScaleFactor"
        case apiManagementAccountId = "apiManagementAccountId"
        case suspended = "suspended"
        case dynamicCacheEnabled = "dynamicCacheEnabled"
        case clusterSettings = "clusterSettings"
        case userWhitelistedIpRanges = "userWhitelistedIpRanges"
        }

  public init(name: String, location: String, virtualNetwork: VirtualNetworkProfileProtocol, workerPools: [WorkerPoolProtocol])  {
    self.name = name
    self.location = location
    self.virtualNetwork = virtualNetwork
    self.workerPools = workerPools
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      self.name = try container.decode(String.self, forKey: .name)
    self.location = try container.decode(String.self, forKey: .location)
    if container.contains(.provisioningState) {
        self.provisioningState = try container.decode(ProvisioningStateEnum?.self, forKey: .provisioningState)
    }
    if container.contains(.status) {
        self.status = try container.decode(HostingEnvironmentStatusEnum?.self, forKey: .status)
    }
    if container.contains(.vnetName) {
        self.vnetName = try container.decode(String?.self, forKey: .vnetName)
    }
    if container.contains(.vnetResourceGroupName) {
        self.vnetResourceGroupName = try container.decode(String?.self, forKey: .vnetResourceGroupName)
    }
    if container.contains(.vnetSubnetName) {
        self.vnetSubnetName = try container.decode(String?.self, forKey: .vnetSubnetName)
    }
    self.virtualNetwork = try container.decode(VirtualNetworkProfileData.self, forKey: .virtualNetwork)
    if container.contains(.internalLoadBalancingMode) {
        self.internalLoadBalancingMode = try container.decode(InternalLoadBalancingModeEnum?.self, forKey: .internalLoadBalancingMode)
    }
    if container.contains(.multiSize) {
        self.multiSize = try container.decode(String?.self, forKey: .multiSize)
    }
    if container.contains(.multiRoleCount) {
        self.multiRoleCount = try container.decode(Int32?.self, forKey: .multiRoleCount)
    }
    self.workerPools = try container.decode([WorkerPoolData].self, forKey: .workerPools)
    if container.contains(.ipsslAddressCount) {
        self.ipsslAddressCount = try container.decode(Int32?.self, forKey: .ipsslAddressCount)
    }
    if container.contains(.databaseEdition) {
        self.databaseEdition = try container.decode(String?.self, forKey: .databaseEdition)
    }
    if container.contains(.databaseServiceObjective) {
        self.databaseServiceObjective = try container.decode(String?.self, forKey: .databaseServiceObjective)
    }
    if container.contains(.upgradeDomains) {
        self.upgradeDomains = try container.decode(Int32?.self, forKey: .upgradeDomains)
    }
    if container.contains(.subscriptionId) {
        self.subscriptionId = try container.decode(String?.self, forKey: .subscriptionId)
    }
    if container.contains(.dnsSuffix) {
        self.dnsSuffix = try container.decode(String?.self, forKey: .dnsSuffix)
    }
    if container.contains(.lastAction) {
        self.lastAction = try container.decode(String?.self, forKey: .lastAction)
    }
    if container.contains(.lastActionResult) {
        self.lastActionResult = try container.decode(String?.self, forKey: .lastActionResult)
    }
    if container.contains(.allowedMultiSizes) {
        self.allowedMultiSizes = try container.decode(String?.self, forKey: .allowedMultiSizes)
    }
    if container.contains(.allowedWorkerSizes) {
        self.allowedWorkerSizes = try container.decode(String?.self, forKey: .allowedWorkerSizes)
    }
    if container.contains(.maximumNumberOfMachines) {
        self.maximumNumberOfMachines = try container.decode(Int32?.self, forKey: .maximumNumberOfMachines)
    }
    if container.contains(.vipMappings) {
        self.vipMappings = try container.decode([VirtualIPMappingData?]?.self, forKey: .vipMappings)
    }
    if container.contains(.environmentCapacities) {
        self.environmentCapacities = try container.decode([StampCapacityData?]?.self, forKey: .environmentCapacities)
    }
    if container.contains(.networkAccessControlList) {
        self.networkAccessControlList = try container.decode([NetworkAccessControlEntryData?]?.self, forKey: .networkAccessControlList)
    }
    if container.contains(.environmentIsHealthy) {
        self.environmentIsHealthy = try container.decode(Bool?.self, forKey: .environmentIsHealthy)
    }
    if container.contains(.environmentStatus) {
        self.environmentStatus = try container.decode(String?.self, forKey: .environmentStatus)
    }
    if container.contains(.resourceGroup) {
        self.resourceGroup = try container.decode(String?.self, forKey: .resourceGroup)
    }
    if container.contains(.frontEndScaleFactor) {
        self.frontEndScaleFactor = try container.decode(Int32?.self, forKey: .frontEndScaleFactor)
    }
    if container.contains(.defaultFrontEndScaleFactor) {
        self.defaultFrontEndScaleFactor = try container.decode(Int32?.self, forKey: .defaultFrontEndScaleFactor)
    }
    if container.contains(.apiManagementAccountId) {
        self.apiManagementAccountId = try container.decode(String?.self, forKey: .apiManagementAccountId)
    }
    if container.contains(.suspended) {
        self.suspended = try container.decode(Bool?.self, forKey: .suspended)
    }
    if container.contains(.dynamicCacheEnabled) {
        self.dynamicCacheEnabled = try container.decode(Bool?.self, forKey: .dynamicCacheEnabled)
    }
    if container.contains(.clusterSettings) {
        self.clusterSettings = try container.decode([NameValuePairData?]?.self, forKey: .clusterSettings)
    }
    if container.contains(.userWhitelistedIpRanges) {
        self.userWhitelistedIpRanges = try container.decode([String]?.self, forKey: .userWhitelistedIpRanges)
    }
    if var pageDecoder = decoder as? PageDecoder  {
      if pageDecoder.isPagedData,
        let nextLinkName = pageDecoder.nextLinkName {
          pageDecoder.nextLink = try UnknownCodingKey.decodeStringForKey(decoder: decoder, keyForDecode: nextLinkName)
      }
    }
  }

  public func encode(to encoder: Encoder) throws {
    var container = encoder.container(keyedBy: CodingKeys.self)
    try container.encode(self.name, forKey: .name)
    try container.encode(self.location, forKey: .location)
    if self.provisioningState != nil {try container.encode(self.provisioningState, forKey: .provisioningState)}
    if self.status != nil {try container.encode(self.status, forKey: .status)}
    if self.vnetName != nil {try container.encode(self.vnetName, forKey: .vnetName)}
    if self.vnetResourceGroupName != nil {try container.encode(self.vnetResourceGroupName, forKey: .vnetResourceGroupName)}
    if self.vnetSubnetName != nil {try container.encode(self.vnetSubnetName, forKey: .vnetSubnetName)}
    try container.encode(self.virtualNetwork as! VirtualNetworkProfileData, forKey: .virtualNetwork)
    if self.internalLoadBalancingMode != nil {try container.encode(self.internalLoadBalancingMode, forKey: .internalLoadBalancingMode)}
    if self.multiSize != nil {try container.encode(self.multiSize, forKey: .multiSize)}
    if self.multiRoleCount != nil {try container.encode(self.multiRoleCount, forKey: .multiRoleCount)}
    try container.encode(self.workerPools as! [WorkerPoolData], forKey: .workerPools)
    if self.ipsslAddressCount != nil {try container.encode(self.ipsslAddressCount, forKey: .ipsslAddressCount)}
    if self.databaseEdition != nil {try container.encode(self.databaseEdition, forKey: .databaseEdition)}
    if self.databaseServiceObjective != nil {try container.encode(self.databaseServiceObjective, forKey: .databaseServiceObjective)}
    if self.upgradeDomains != nil {try container.encode(self.upgradeDomains, forKey: .upgradeDomains)}
    if self.subscriptionId != nil {try container.encode(self.subscriptionId, forKey: .subscriptionId)}
    if self.dnsSuffix != nil {try container.encode(self.dnsSuffix, forKey: .dnsSuffix)}
    if self.lastAction != nil {try container.encode(self.lastAction, forKey: .lastAction)}
    if self.lastActionResult != nil {try container.encode(self.lastActionResult, forKey: .lastActionResult)}
    if self.allowedMultiSizes != nil {try container.encode(self.allowedMultiSizes, forKey: .allowedMultiSizes)}
    if self.allowedWorkerSizes != nil {try container.encode(self.allowedWorkerSizes, forKey: .allowedWorkerSizes)}
    if self.maximumNumberOfMachines != nil {try container.encode(self.maximumNumberOfMachines, forKey: .maximumNumberOfMachines)}
    if self.vipMappings != nil {try container.encode(self.vipMappings as! [VirtualIPMappingData?]?, forKey: .vipMappings)}
    if self.environmentCapacities != nil {try container.encode(self.environmentCapacities as! [StampCapacityData?]?, forKey: .environmentCapacities)}
    if self.networkAccessControlList != nil {try container.encode(self.networkAccessControlList as! [NetworkAccessControlEntryData?]?, forKey: .networkAccessControlList)}
    if self.environmentIsHealthy != nil {try container.encode(self.environmentIsHealthy, forKey: .environmentIsHealthy)}
    if self.environmentStatus != nil {try container.encode(self.environmentStatus, forKey: .environmentStatus)}
    if self.resourceGroup != nil {try container.encode(self.resourceGroup, forKey: .resourceGroup)}
    if self.frontEndScaleFactor != nil {try container.encode(self.frontEndScaleFactor, forKey: .frontEndScaleFactor)}
    if self.defaultFrontEndScaleFactor != nil {try container.encode(self.defaultFrontEndScaleFactor, forKey: .defaultFrontEndScaleFactor)}
    if self.apiManagementAccountId != nil {try container.encode(self.apiManagementAccountId, forKey: .apiManagementAccountId)}
    if self.suspended != nil {try container.encode(self.suspended, forKey: .suspended)}
    if self.dynamicCacheEnabled != nil {try container.encode(self.dynamicCacheEnabled, forKey: .dynamicCacheEnabled)}
    if self.clusterSettings != nil {try container.encode(self.clusterSettings as! [NameValuePairData?]?, forKey: .clusterSettings)}
    if self.userWhitelistedIpRanges != nil {try container.encode(self.userWhitelistedIpRanges as! [String]?, forKey: .userWhitelistedIpRanges)}
  }
}

extension DataFactory {
  public static func createAppServiceEnvironmentProtocol(name: String, location: String, virtualNetwork: VirtualNetworkProfileProtocol, workerPools: [WorkerPoolProtocol]) -> AppServiceEnvironmentProtocol {
    return AppServiceEnvironmentData(name: name, location: location, virtualNetwork: virtualNetwork, workerPools: workerPools)
  }
}


// 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 AppServiceEnvironmentPatchResourceData : AppServiceEnvironmentPatchResourceProtocol, ProxyOnlyResourceProtocol {
    public var id: String?
    public var name: String?
    public var kind: String?
    public var type: String?
    public var properties: AppServiceEnvironmentProtocol?

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

  public init()  {
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.id) {
        self.id = try container.decode(String?.self, forKey: .id)
    }
    if container.contains(.name) {
        self.name = try container.decode(String?.self, forKey: .name)
    }
    if container.contains(.kind) {
        self.kind = try container.decode(String?.self, forKey: .kind)
    }
    if container.contains(.type) {
        self.type = try container.decode(String?.self, forKey: .type)
    }
    if container.contains(.properties) {
        self.properties = try container.decode(AppServiceEnvironmentData?.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.kind != nil {try container.encode(self.kind, forKey: .kind)}
    if self.type != nil {try container.encode(self.type, forKey: .type)}
    if self.properties != nil {try container.encode(self.properties as! AppServiceEnvironmentData?, forKey: .properties)}
  }
}

extension DataFactory {
  public static func createAppServiceEnvironmentPatchResourceProtocol() -> AppServiceEnvironmentPatchResourceProtocol {
    return AppServiceEnvironmentPatchResourceData()
  }
}


// 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 AppServiceEnvironmentResourceData : AppServiceEnvironmentResourceProtocol, ResourceProtocol {
    public var id: String?
    public var name: String?
    public var kind: String?
    public var location: String
    public var type: String?
    public var tags: [String:String]?
    public var properties: AppServiceEnvironmentProtocol?

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

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

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.id) {
        self.id = try container.decode(String?.self, forKey: .id)
    }
    if container.contains(.name) {
        self.name = try container.decode(String?.self, forKey: .name)
    }
    if container.contains(.kind) {
        self.kind = try container.decode(String?.self, forKey: .kind)
    }
    self.location = try container.decode(String.self, forKey: .location)
    if container.contains(.type) {
        self.type = try container.decode(String?.self, forKey: .type)
    }
    if container.contains(.tags) {
        self.tags = try container.decode([String:String]?.self, forKey: .tags)
    }
    if container.contains(.properties) {
        self.properties = try container.decode(AppServiceEnvironmentData?.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.kind != nil {try container.encode(self.kind, forKey: .kind)}
    try container.encode(self.location, forKey: .location)
    if self.type != nil {try container.encode(self.type, forKey: .type)}
    if self.tags != nil {try container.encode(self.tags, forKey: .tags)}
    if self.properties != nil {try container.encode(self.properties as! AppServiceEnvironmentData?, forKey: .properties)}
  }
}

extension DataFactory {
  public static func createAppServiceEnvironmentResourceProtocol(location: String) -> AppServiceEnvironmentResourceProtocol {
    return AppServiceEnvironmentResourceData(location: location)
  }
}


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

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

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

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

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

extension DataFactory {
  public static func createAppServicePlanCollectionProtocol(value: [AppServicePlanProtocol]) -> AppServicePlanCollectionProtocol {
    return AppServicePlanCollectionData(value: value)
  }
}


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

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

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

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.id) {
        self.id = try container.decode(String?.self, forKey: .id)
    }
    if container.contains(.name) {
        self.name = try container.decode(String?.self, forKey: .name)
    }
    if container.contains(.kind) {
        self.kind = try container.decode(String?.self, forKey: .kind)
    }
    self.location = try container.decode(String.self, forKey: .location)
    if container.contains(.type) {
        self.type = try container.decode(String?.self, forKey: .type)
    }
    if container.contains(.tags) {
        self.tags = try container.decode([String:String]?.self, forKey: .tags)
    }
    if container.contains(.properties) {
        self.properties = try container.decode(AppServicePlanPropertiesData?.self, forKey: .properties)
    }
    if container.contains(.sku) {
        self.sku = try container.decode(SkuDescriptionData?.self, forKey: .sku)
    }
    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.kind != nil {try container.encode(self.kind, forKey: .kind)}
    try container.encode(self.location, forKey: .location)
    if self.type != nil {try container.encode(self.type, forKey: .type)}
    if self.tags != nil {try container.encode(self.tags, forKey: .tags)}
    if self.properties != nil {try container.encode(self.properties as! AppServicePlanPropertiesData?, forKey: .properties)}
    if self.sku != nil {try container.encode(self.sku as! SkuDescriptionData?, forKey: .sku)}
  }
}

extension DataFactory {
  public static func createAppServicePlanProtocol(location: String) -> AppServicePlanProtocol {
    return AppServicePlanData(location: location)
  }
}


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

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

  public init()  {
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.id) {
        self.id = try container.decode(String?.self, forKey: .id)
    }
    if container.contains(.name) {
        self.name = try container.decode(String?.self, forKey: .name)
    }
    if container.contains(.kind) {
        self.kind = try container.decode(String?.self, forKey: .kind)
    }
    if container.contains(.type) {
        self.type = try container.decode(String?.self, forKey: .type)
    }
    if container.contains(.properties) {
        self.properties = try container.decode(AppServicePlanPatchResourcePropertiesData?.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.kind != nil {try container.encode(self.kind, forKey: .kind)}
    if self.type != nil {try container.encode(self.type, forKey: .type)}
    if self.properties != nil {try container.encode(self.properties as! AppServicePlanPatchResourcePropertiesData?, forKey: .properties)}
  }
}

extension DataFactory {
  public static func createAppServicePlanPatchResourceProtocol() -> AppServicePlanPatchResourceProtocol {
    return AppServicePlanPatchResourceData()
  }
}


// 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 AppServicePlanPatchResourcePropertiesData : AppServicePlanPatchResourcePropertiesProtocol {
    public var name: String?
    public var workerTierName: String?
    public var status: StatusOptionsEnum?
    public var subscription: String?
    public var adminSiteName: String?
    public var hostingEnvironmentProfile: HostingEnvironmentProfileProtocol?
    public var maximumNumberOfWorkers: Int32?
    public var geoRegion: String?
    public var perSiteScaling: Bool?
    public var numberOfSites: Int32?
    public var isSpot: Bool?
    public var spotExpirationTime: Date?
    public var resourceGroup: String?
    public var reserved: Bool?
    public var targetWorkerCount: Int32?
    public var targetWorkerSizeId: Int32?
    public var provisioningState: ProvisioningStateEnum?

        enum CodingKeys: String, CodingKey {case name = "name"
        case workerTierName = "workerTierName"
        case status = "status"
        case subscription = "subscription"
        case adminSiteName = "adminSiteName"
        case hostingEnvironmentProfile = "hostingEnvironmentProfile"
        case maximumNumberOfWorkers = "maximumNumberOfWorkers"
        case geoRegion = "geoRegion"
        case perSiteScaling = "perSiteScaling"
        case numberOfSites = "numberOfSites"
        case isSpot = "isSpot"
        case spotExpirationTime = "spotExpirationTime"
        case resourceGroup = "resourceGroup"
        case reserved = "reserved"
        case targetWorkerCount = "targetWorkerCount"
        case targetWorkerSizeId = "targetWorkerSizeId"
        case provisioningState = "provisioningState"
        }

  public init()  {
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.name) {
        self.name = try container.decode(String?.self, forKey: .name)
    }
    if container.contains(.workerTierName) {
        self.workerTierName = try container.decode(String?.self, forKey: .workerTierName)
    }
    if container.contains(.status) {
        self.status = try container.decode(StatusOptionsEnum?.self, forKey: .status)
    }
    if container.contains(.subscription) {
        self.subscription = try container.decode(String?.self, forKey: .subscription)
    }
    if container.contains(.adminSiteName) {
        self.adminSiteName = try container.decode(String?.self, forKey: .adminSiteName)
    }
    if container.contains(.hostingEnvironmentProfile) {
        self.hostingEnvironmentProfile = try container.decode(HostingEnvironmentProfileData?.self, forKey: .hostingEnvironmentProfile)
    }
    if container.contains(.maximumNumberOfWorkers) {
        self.maximumNumberOfWorkers = try container.decode(Int32?.self, forKey: .maximumNumberOfWorkers)
    }
    if container.contains(.geoRegion) {
        self.geoRegion = try container.decode(String?.self, forKey: .geoRegion)
    }
    if container.contains(.perSiteScaling) {
        self.perSiteScaling = try container.decode(Bool?.self, forKey: .perSiteScaling)
    }
    if container.contains(.numberOfSites) {
        self.numberOfSites = try container.decode(Int32?.self, forKey: .numberOfSites)
    }
    if container.contains(.isSpot) {
        self.isSpot = try container.decode(Bool?.self, forKey: .isSpot)
    }
    if container.contains(.spotExpirationTime) {
        self.spotExpirationTime = DateConverter.fromString(dateStr: (try container.decode(String?.self, forKey: .spotExpirationTime)), format: .dateTime)
    }
    if container.contains(.resourceGroup) {
        self.resourceGroup = try container.decode(String?.self, forKey: .resourceGroup)
    }
    if container.contains(.reserved) {
        self.reserved = try container.decode(Bool?.self, forKey: .reserved)
    }
    if container.contains(.targetWorkerCount) {
        self.targetWorkerCount = try container.decode(Int32?.self, forKey: .targetWorkerCount)
    }
    if container.contains(.targetWorkerSizeId) {
        self.targetWorkerSizeId = try container.decode(Int32?.self, forKey: .targetWorkerSizeId)
    }
    if container.contains(.provisioningState) {
        self.provisioningState = try container.decode(ProvisioningStateEnum?.self, forKey: .provisioningState)
    }
    if var pageDecoder = decoder as? PageDecoder  {
      if pageDecoder.isPagedData,
        let nextLinkName = pageDecoder.nextLinkName {
          pageDecoder.nextLink = try UnknownCodingKey.decodeStringForKey(decoder: decoder, keyForDecode: nextLinkName)
      }
    }
  }

  public func encode(to encoder: Encoder) throws {
    var container = encoder.container(keyedBy: CodingKeys.self)
    if self.name != nil {try container.encode(self.name, forKey: .name)}
    if self.workerTierName != nil {try container.encode(self.workerTierName, forKey: .workerTierName)}
    if self.status != nil {try container.encode(self.status, forKey: .status)}
    if self.subscription != nil {try container.encode(self.subscription, forKey: .subscription)}
    if self.adminSiteName != nil {try container.encode(self.adminSiteName, forKey: .adminSiteName)}
    if self.hostingEnvironmentProfile != nil {try container.encode(self.hostingEnvironmentProfile as! HostingEnvironmentProfileData?, forKey: .hostingEnvironmentProfile)}
    if self.maximumNumberOfWorkers != nil {try container.encode(self.maximumNumberOfWorkers, forKey: .maximumNumberOfWorkers)}
    if self.geoRegion != nil {try container.encode(self.geoRegion, forKey: .geoRegion)}
    if self.perSiteScaling != nil {try container.encode(self.perSiteScaling, forKey: .perSiteScaling)}
    if self.numberOfSites != nil {try container.encode(self.numberOfSites, forKey: .numberOfSites)}
    if self.isSpot != nil {try container.encode(self.isSpot, forKey: .isSpot)}
    if self.spotExpirationTime != nil {
        try container.encode(DateConverter.toString(date: self.spotExpirationTime!, format: .dateTime), forKey: .spotExpirationTime)
    }
    if self.resourceGroup != nil {try container.encode(self.resourceGroup, forKey: .resourceGroup)}
    if self.reserved != nil {try container.encode(self.reserved, forKey: .reserved)}
    if self.targetWorkerCount != nil {try container.encode(self.targetWorkerCount, forKey: .targetWorkerCount)}
    if self.targetWorkerSizeId != nil {try container.encode(self.targetWorkerSizeId, forKey: .targetWorkerSizeId)}
    if self.provisioningState != nil {try container.encode(self.provisioningState, forKey: .provisioningState)}
  }
}

extension DataFactory {
  public static func createAppServicePlanPatchResourcePropertiesProtocol() -> AppServicePlanPatchResourcePropertiesProtocol {
    return AppServicePlanPatchResourcePropertiesData()
  }
}


// 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 AppServicePlanPropertiesData : AppServicePlanPropertiesProtocol {
    public var name: String?
    public var workerTierName: String?
    public var status: StatusOptionsEnum?
    public var subscription: String?
    public var adminSiteName: String?
    public var hostingEnvironmentProfile: HostingEnvironmentProfileProtocol?
    public var maximumNumberOfWorkers: Int32?
    public var geoRegion: String?
    public var perSiteScaling: Bool?
    public var numberOfSites: Int32?
    public var isSpot: Bool?
    public var spotExpirationTime: Date?
    public var resourceGroup: String?
    public var reserved: Bool?
    public var targetWorkerCount: Int32?
    public var targetWorkerSizeId: Int32?
    public var provisioningState: ProvisioningStateEnum?

        enum CodingKeys: String, CodingKey {case name = "name"
        case workerTierName = "workerTierName"
        case status = "status"
        case subscription = "subscription"
        case adminSiteName = "adminSiteName"
        case hostingEnvironmentProfile = "hostingEnvironmentProfile"
        case maximumNumberOfWorkers = "maximumNumberOfWorkers"
        case geoRegion = "geoRegion"
        case perSiteScaling = "perSiteScaling"
        case numberOfSites = "numberOfSites"
        case isSpot = "isSpot"
        case spotExpirationTime = "spotExpirationTime"
        case resourceGroup = "resourceGroup"
        case reserved = "reserved"
        case targetWorkerCount = "targetWorkerCount"
        case targetWorkerSizeId = "targetWorkerSizeId"
        case provisioningState = "provisioningState"
        }

  public init()  {
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.name) {
        self.name = try container.decode(String?.self, forKey: .name)
    }
    if container.contains(.workerTierName) {
        self.workerTierName = try container.decode(String?.self, forKey: .workerTierName)
    }
    if container.contains(.status) {
        self.status = try container.decode(StatusOptionsEnum?.self, forKey: .status)
    }
    if container.contains(.subscription) {
        self.subscription = try container.decode(String?.self, forKey: .subscription)
    }
    if container.contains(.adminSiteName) {
        self.adminSiteName = try container.decode(String?.self, forKey: .adminSiteName)
    }
    if container.contains(.hostingEnvironmentProfile) {
        self.hostingEnvironmentProfile = try container.decode(HostingEnvironmentProfileData?.self, forKey: .hostingEnvironmentProfile)
    }
    if container.contains(.maximumNumberOfWorkers) {
        self.maximumNumberOfWorkers = try container.decode(Int32?.self, forKey: .maximumNumberOfWorkers)
    }
    if container.contains(.geoRegion) {
        self.geoRegion = try container.decode(String?.self, forKey: .geoRegion)
    }
    if container.contains(.perSiteScaling) {
        self.perSiteScaling = try container.decode(Bool?.self, forKey: .perSiteScaling)
    }
    if container.contains(.numberOfSites) {
        self.numberOfSites = try container.decode(Int32?.self, forKey: .numberOfSites)
    }
    if container.contains(.isSpot) {
        self.isSpot = try container.decode(Bool?.self, forKey: .isSpot)
    }
    if container.contains(.spotExpirationTime) {
        self.spotExpirationTime = DateConverter.fromString(dateStr: (try container.decode(String?.self, forKey: .spotExpirationTime)), format: .dateTime)
    }
    if container.contains(.resourceGroup) {
        self.resourceGroup = try container.decode(String?.self, forKey: .resourceGroup)
    }
    if container.contains(.reserved) {
        self.reserved = try container.decode(Bool?.self, forKey: .reserved)
    }
    if container.contains(.targetWorkerCount) {
        self.targetWorkerCount = try container.decode(Int32?.self, forKey: .targetWorkerCount)
    }
    if container.contains(.targetWorkerSizeId) {
        self.targetWorkerSizeId = try container.decode(Int32?.self, forKey: .targetWorkerSizeId)
    }
    if container.contains(.provisioningState) {
        self.provisioningState = try container.decode(ProvisioningStateEnum?.self, forKey: .provisioningState)
    }
    if var pageDecoder = decoder as? PageDecoder  {
      if pageDecoder.isPagedData,
        let nextLinkName = pageDecoder.nextLinkName {
          pageDecoder.nextLink = try UnknownCodingKey.decodeStringForKey(decoder: decoder, keyForDecode: nextLinkName)
      }
    }
  }

  public func encode(to encoder: Encoder) throws {
    var container = encoder.container(keyedBy: CodingKeys.self)
    if self.name != nil {try container.encode(self.name, forKey: .name)}
    if self.workerTierName != nil {try container.encode(self.workerTierName, forKey: .workerTierName)}
    if self.status != nil {try container.encode(self.status, forKey: .status)}
    if self.subscription != nil {try container.encode(self.subscription, forKey: .subscription)}
    if self.adminSiteName != nil {try container.encode(self.adminSiteName, forKey: .adminSiteName)}
    if self.hostingEnvironmentProfile != nil {try container.encode(self.hostingEnvironmentProfile as! HostingEnvironmentProfileData?, forKey: .hostingEnvironmentProfile)}
    if self.maximumNumberOfWorkers != nil {try container.encode(self.maximumNumberOfWorkers, forKey: .maximumNumberOfWorkers)}
    if self.geoRegion != nil {try container.encode(self.geoRegion, forKey: .geoRegion)}
    if self.perSiteScaling != nil {try container.encode(self.perSiteScaling, forKey: .perSiteScaling)}
    if self.numberOfSites != nil {try container.encode(self.numberOfSites, forKey: .numberOfSites)}
    if self.isSpot != nil {try container.encode(self.isSpot, forKey: .isSpot)}
    if self.spotExpirationTime != nil {
        try container.encode(DateConverter.toString(date: self.spotExpirationTime!, format: .dateTime), forKey: .spotExpirationTime)
    }
    if self.resourceGroup != nil {try container.encode(self.resourceGroup, forKey: .resourceGroup)}
    if self.reserved != nil {try container.encode(self.reserved, forKey: .reserved)}
    if self.targetWorkerCount != nil {try container.encode(self.targetWorkerCount, forKey: .targetWorkerCount)}
    if self.targetWorkerSizeId != nil {try container.encode(self.targetWorkerSizeId, forKey: .targetWorkerSizeId)}
    if self.provisioningState != nil {try container.encode(self.provisioningState, forKey: .provisioningState)}
  }
}

extension DataFactory {
  public static func createAppServicePlanPropertiesProtocol() -> AppServicePlanPropertiesProtocol {
    return AppServicePlanPropertiesData()
  }
}


// AppServicePlanRestrictions enumerates the values for app service plan restrictions.

// 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 AppServicePlanRestrictionsEnum: String, Codable
{
// Basic specifies the basic state for app service plan restrictions.
    case Basic = "Basic"
// Free specifies the free state for app service plan restrictions.
    case Free = "Free"
// None specifies the none state for app service plan restrictions.
    case None = "None"
// Premium specifies the premium state for app service plan restrictions.
    case Premium = "Premium"
// Shared specifies the shared state for app service plan restrictions.
    case Shared = "Shared"
// Standard specifies the standard state for app service plan restrictions.
    case Standard = "Standard"
}


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

        enum CodingKeys: String, CodingKey {case actionType = "actionType"
        case customAction = "customAction"
        case minProcessExecutionTime = "minProcessExecutionTime"
        }

  public init()  {
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.actionType) {
        self.actionType = try container.decode(AutoHealActionTypeEnum?.self, forKey: .actionType)
    }
    if container.contains(.customAction) {
        self.customAction = try container.decode(AutoHealCustomActionData?.self, forKey: .customAction)
    }
    if container.contains(.minProcessExecutionTime) {
        self.minProcessExecutionTime = try container.decode(String?.self, forKey: .minProcessExecutionTime)
    }
    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.actionType != nil {try container.encode(self.actionType, forKey: .actionType)}
    if self.customAction != nil {try container.encode(self.customAction as! AutoHealCustomActionData?, forKey: .customAction)}
    if self.minProcessExecutionTime != nil {try container.encode(self.minProcessExecutionTime, forKey: .minProcessExecutionTime)}
  }
}

extension DataFactory {
  public static func createAutoHealActionsProtocol() -> AutoHealActionsProtocol {
    return AutoHealActionsData()
  }
}


// AutoHealActionType enumerates the values for auto heal action 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 AutoHealActionTypeEnum: String, Codable
{
// CustomAction specifies the custom action state for auto heal action type.
    case CustomAction = "CustomAction"
// LogEvent specifies the log event state for auto heal action type.
    case LogEvent = "LogEvent"
// Recycle specifies the recycle state for auto heal action type.
    case Recycle = "Recycle"
}


// 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 AutoHealCustomActionData : AutoHealCustomActionProtocol {
    public var exe: String?
    public var parameters: String?

        enum CodingKeys: String, CodingKey {case exe = "exe"
        case parameters = "parameters"
        }

  public init()  {
  }

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

extension DataFactory {
  public static func createAutoHealCustomActionProtocol() -> AutoHealCustomActionProtocol {
    return AutoHealCustomActionData()
  }
}


// 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 AutoHealRulesData : AutoHealRulesProtocol {
    public var triggers: AutoHealTriggersProtocol?
    public var actions: AutoHealActionsProtocol?

        enum CodingKeys: String, CodingKey {case triggers = "triggers"
        case actions = "actions"
        }

  public init()  {
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.triggers) {
        self.triggers = try container.decode(AutoHealTriggersData?.self, forKey: .triggers)
    }
    if container.contains(.actions) {
        self.actions = try container.decode(AutoHealActionsData?.self, forKey: .actions)
    }
    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.triggers != nil {try container.encode(self.triggers as! AutoHealTriggersData?, forKey: .triggers)}
    if self.actions != nil {try container.encode(self.actions as! AutoHealActionsData?, forKey: .actions)}
  }
}

extension DataFactory {
  public static func createAutoHealRulesProtocol() -> AutoHealRulesProtocol {
    return AutoHealRulesData()
  }
}


// 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 AutoHealTriggersData : AutoHealTriggersProtocol {
    public var requests: RequestsBasedTriggerProtocol?
    public var privateBytesInKB: Int32?
    public var statusCodes: [StatusCodesBasedTriggerProtocol?]?
    public var slowRequests: SlowRequestsBasedTriggerProtocol?

        enum CodingKeys: String, CodingKey {case requests = "requests"
        case privateBytesInKB = "privateBytesInKB"
        case statusCodes = "statusCodes"
        case slowRequests = "slowRequests"
        }

  public init()  {
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.requests) {
        self.requests = try container.decode(RequestsBasedTriggerData?.self, forKey: .requests)
    }
    if container.contains(.privateBytesInKB) {
        self.privateBytesInKB = try container.decode(Int32?.self, forKey: .privateBytesInKB)
    }
    if container.contains(.statusCodes) {
        self.statusCodes = try container.decode([StatusCodesBasedTriggerData?]?.self, forKey: .statusCodes)
    }
    if container.contains(.slowRequests) {
        self.slowRequests = try container.decode(SlowRequestsBasedTriggerData?.self, forKey: .slowRequests)
    }
    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.requests != nil {try container.encode(self.requests as! RequestsBasedTriggerData?, forKey: .requests)}
    if self.privateBytesInKB != nil {try container.encode(self.privateBytesInKB, forKey: .privateBytesInKB)}
    if self.statusCodes != nil {try container.encode(self.statusCodes as! [StatusCodesBasedTriggerData?]?, forKey: .statusCodes)}
    if self.slowRequests != nil {try container.encode(self.slowRequests as! SlowRequestsBasedTriggerData?, forKey: .slowRequests)}
  }
}

extension DataFactory {
  public static func createAutoHealTriggersProtocol() -> AutoHealTriggersProtocol {
    return AutoHealTriggersData()
  }
}


// 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 AzureBlobStorageApplicationLogsConfigData : AzureBlobStorageApplicationLogsConfigProtocol {
    public var level: LogLevelEnum?
    public var sasUrl: String?
    public var retentionInDays: Int32?

        enum CodingKeys: String, CodingKey {case level = "level"
        case sasUrl = "sasUrl"
        case retentionInDays = "retentionInDays"
        }

  public init()  {
  }

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

extension DataFactory {
  public static func createAzureBlobStorageApplicationLogsConfigProtocol() -> AzureBlobStorageApplicationLogsConfigProtocol {
    return AzureBlobStorageApplicationLogsConfigData()
  }
}


// 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 AzureBlobStorageHttpLogsConfigData : AzureBlobStorageHttpLogsConfigProtocol {
    public var sasUrl: String?
    public var retentionInDays: Int32?
    public var enabled: Bool?

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

  public init()  {
  }

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

extension DataFactory {
  public static func createAzureBlobStorageHttpLogsConfigProtocol() -> AzureBlobStorageHttpLogsConfigProtocol {
    return AzureBlobStorageHttpLogsConfigData()
  }
}


// AzureResourceType enumerates the values for azure resource 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 AzureResourceTypeEnum: String, Codable
{
// TrafficManager specifies the traffic manager state for azure resource type.
    case TrafficManager = "TrafficManager"
// Website specifies the website state for azure resource type.
    case Website = "Website"
}


// 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 AzureTableStorageApplicationLogsConfigData : AzureTableStorageApplicationLogsConfigProtocol {
    public var level: LogLevelEnum?
    public var sasUrl: String

        enum CodingKeys: String, CodingKey {case level = "level"
        case sasUrl = "sasUrl"
        }

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

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

extension DataFactory {
  public static func createAzureTableStorageApplicationLogsConfigProtocol(sasUrl: String) -> AzureTableStorageApplicationLogsConfigProtocol {
    return AzureTableStorageApplicationLogsConfigData(sasUrl: sasUrl)
  }
}


// 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 BackupItemCollectionData : BackupItemCollectionProtocol {
    public var value: [BackupItemProtocol]
    public var _nextLink: String?

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

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

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

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

extension DataFactory {
  public static func createBackupItemCollectionProtocol(value: [BackupItemProtocol]) -> BackupItemCollectionProtocol {
    return BackupItemCollectionData(value: value)
  }
}


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

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

  public init()  {
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.id) {
        self.id = try container.decode(String?.self, forKey: .id)
    }
    if container.contains(.name) {
        self.name = try container.decode(String?.self, forKey: .name)
    }
    if container.contains(.kind) {
        self.kind = try container.decode(String?.self, forKey: .kind)
    }
    if container.contains(.type) {
        self.type = try container.decode(String?.self, forKey: .type)
    }
    if container.contains(.properties) {
        self.properties = try container.decode(BackupItemPropertiesData?.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.kind != nil {try container.encode(self.kind, forKey: .kind)}
    if self.type != nil {try container.encode(self.type, forKey: .type)}
    if self.properties != nil {try container.encode(self.properties as! BackupItemPropertiesData?, forKey: .properties)}
  }
}

extension DataFactory {
  public static func createBackupItemProtocol() -> BackupItemProtocol {
    return BackupItemData()
  }
}


// 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 BackupItemPropertiesData : BackupItemPropertiesProtocol {
    public var backupId: Int32?
    public var storageAccountUrl: String?
    public var blobName: String?
    public var name: String?
    public var status: BackupItemStatusEnum?
    public var sizeInBytes: Int64?
    public var created: Date?
    public var log: String?
    public var databases: [DatabaseBackupSettingProtocol?]?
    public var scheduled: Bool?
    public var lastRestoreTimeStamp: Date?
    public var finishedTimeStamp: Date?
    public var correlationId: String?
    public var websiteSizeInBytes: Int64?

        enum CodingKeys: String, CodingKey {case backupId = "id"
        case storageAccountUrl = "storageAccountUrl"
        case blobName = "blobName"
        case name = "name"
        case status = "status"
        case sizeInBytes = "sizeInBytes"
        case created = "created"
        case log = "log"
        case databases = "databases"
        case scheduled = "scheduled"
        case lastRestoreTimeStamp = "lastRestoreTimeStamp"
        case finishedTimeStamp = "finishedTimeStamp"
        case correlationId = "correlationId"
        case websiteSizeInBytes = "websiteSizeInBytes"
        }

  public init()  {
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.backupId) {
        self.backupId = try container.decode(Int32?.self, forKey: .backupId)
    }
    if container.contains(.storageAccountUrl) {
        self.storageAccountUrl = try container.decode(String?.self, forKey: .storageAccountUrl)
    }
    if container.contains(.blobName) {
        self.blobName = try container.decode(String?.self, forKey: .blobName)
    }
    if container.contains(.name) {
        self.name = try container.decode(String?.self, forKey: .name)
    }
    if container.contains(.status) {
        self.status = try container.decode(BackupItemStatusEnum?.self, forKey: .status)
    }
    if container.contains(.sizeInBytes) {
        self.sizeInBytes = try container.decode(Int64?.self, forKey: .sizeInBytes)
    }
    if container.contains(.created) {
        self.created = DateConverter.fromString(dateStr: (try container.decode(String?.self, forKey: .created)), format: .dateTime)
    }
    if container.contains(.log) {
        self.log = try container.decode(String?.self, forKey: .log)
    }
    if container.contains(.databases) {
        self.databases = try container.decode([DatabaseBackupSettingData?]?.self, forKey: .databases)
    }
    if container.contains(.scheduled) {
        self.scheduled = try container.decode(Bool?.self, forKey: .scheduled)
    }
    if container.contains(.lastRestoreTimeStamp) {
        self.lastRestoreTimeStamp = DateConverter.fromString(dateStr: (try container.decode(String?.self, forKey: .lastRestoreTimeStamp)), format: .dateTime)
    }
    if container.contains(.finishedTimeStamp) {
        self.finishedTimeStamp = DateConverter.fromString(dateStr: (try container.decode(String?.self, forKey: .finishedTimeStamp)), format: .dateTime)
    }
    if container.contains(.correlationId) {
        self.correlationId = try container.decode(String?.self, forKey: .correlationId)
    }
    if container.contains(.websiteSizeInBytes) {
        self.websiteSizeInBytes = try container.decode(Int64?.self, forKey: .websiteSizeInBytes)
    }
    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.backupId != nil {try container.encode(self.backupId, forKey: .backupId)}
    if self.storageAccountUrl != nil {try container.encode(self.storageAccountUrl, forKey: .storageAccountUrl)}
    if self.blobName != nil {try container.encode(self.blobName, forKey: .blobName)}
    if self.name != nil {try container.encode(self.name, forKey: .name)}
    if self.status != nil {try container.encode(self.status, forKey: .status)}
    if self.sizeInBytes != nil {try container.encode(self.sizeInBytes, forKey: .sizeInBytes)}
    if self.created != nil {
        try container.encode(DateConverter.toString(date: self.created!, format: .dateTime), forKey: .created)
    }
    if self.log != nil {try container.encode(self.log, forKey: .log)}
    if self.databases != nil {try container.encode(self.databases as! [DatabaseBackupSettingData?]?, forKey: .databases)}
    if self.scheduled != nil {try container.encode(self.scheduled, forKey: .scheduled)}
    if self.lastRestoreTimeStamp != nil {
        try container.encode(DateConverter.toString(date: self.lastRestoreTimeStamp!, format: .dateTime), forKey: .lastRestoreTimeStamp)
    }
    if self.finishedTimeStamp != nil {
        try container.encode(DateConverter.toString(date: self.finishedTimeStamp!, format: .dateTime), forKey: .finishedTimeStamp)
    }
    if self.correlationId != nil {try container.encode(self.correlationId, forKey: .correlationId)}
    if self.websiteSizeInBytes != nil {try container.encode(self.websiteSizeInBytes, forKey: .websiteSizeInBytes)}
  }
}

extension DataFactory {
  public static func createBackupItemPropertiesProtocol() -> BackupItemPropertiesProtocol {
    return BackupItemPropertiesData()
  }
}


// BackupItemStatus enumerates the values for backup item status.

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
public enum BackupItemStatusEnum: String, Codable
{
// Created specifies the created state for backup item status.
    case Created = "Created"
// Deleted specifies the deleted state for backup item status.
    case Deleted = "Deleted"
// DeleteFailed specifies the delete failed state for backup item status.
    case DeleteFailed = "DeleteFailed"
// DeleteInProgress specifies the delete in progress state for backup item status.
    case DeleteInProgress = "DeleteInProgress"
// Failed specifies the failed state for backup item status.
    case Failed = "Failed"
// InProgress specifies the in progress state for backup item status.
    case InProgress = "InProgress"
// PartiallySucceeded specifies the partially succeeded state for backup item status.
    case PartiallySucceeded = "PartiallySucceeded"
// Skipped specifies the skipped state for backup item status.
    case Skipped = "Skipped"
// Succeeded specifies the succeeded state for backup item status.
    case Succeeded = "Succeeded"
// TimedOut specifies the timed out state for backup item status.
    case TimedOut = "TimedOut"
}