// 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 OutputFileData : OutputFileProtocol {
    public var filePattern: String
    public var destination: OutputFileDestinationProtocol
    public var uploadOptions: OutputFileUploadOptionsProtocol

        enum CodingKeys: String, CodingKey {case filePattern = "filePattern"
        case destination = "destination"
        case uploadOptions = "uploadOptions"
        }

  public init(filePattern: String, destination: OutputFileDestinationProtocol, uploadOptions: OutputFileUploadOptionsProtocol)  {
    self.filePattern = filePattern
    self.destination = destination
    self.uploadOptions = uploadOptions
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      self.filePattern = try container.decode(String.self, forKey: .filePattern)
    self.destination = try container.decode(OutputFileDestinationData.self, forKey: .destination)
    self.uploadOptions = try container.decode(OutputFileUploadOptionsData.self, forKey: .uploadOptions)
    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.filePattern, forKey: .filePattern)
    try container.encode(self.destination as! OutputFileDestinationData, forKey: .destination)
    try container.encode(self.uploadOptions as! OutputFileUploadOptionsData, forKey: .uploadOptions)
  }
}

extension DataFactory {
  public static func createOutputFileProtocol(filePattern: String, destination: OutputFileDestinationProtocol, uploadOptions: OutputFileUploadOptionsProtocol) -> OutputFileProtocol {
    return OutputFileData(filePattern: filePattern, destination: destination, uploadOptions: uploadOptions)
  }
}
