// 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 AzureVmDiskDetailsData : AzureVmDiskDetailsProtocol {
    public var vhdType: String?
    public var vhdId: String?
    public var vhdName: String?
    public var maxSizeMB: String?
    public var targetDiskLocation: String?
    public var targetDiskName: String?
    public var lunId: String?

        enum CodingKeys: String, CodingKey {case vhdType = "vhdType"
        case vhdId = "vhdId"
        case vhdName = "vhdName"
        case maxSizeMB = "maxSizeMB"
        case targetDiskLocation = "targetDiskLocation"
        case targetDiskName = "targetDiskName"
        case lunId = "lunId"
        }

  public init()  {
  }

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

extension DataFactory {
  public static func createAzureVmDiskDetailsProtocol() -> AzureVmDiskDetailsProtocol {
    return AzureVmDiskDetailsData()
  }
}
