// 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 ApplicationUpdateParametersData : ApplicationUpdateParametersProtocol {
    public var allowUpdates: Bool?
    public var defaultVersion: String?
    public var displayName: String?

        enum CodingKeys: String, CodingKey {case allowUpdates = "allowUpdates"
        case defaultVersion = "defaultVersion"
        case displayName = "displayName"
        }

  public init()  {
  }

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

extension DataFactory {
  public static func createApplicationUpdateParametersProtocol() -> ApplicationUpdateParametersProtocol {
    return ApplicationUpdateParametersData()
  }
}
