// 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 StampCapacityData : StampCapacityProtocol {
    public var name: String?
    public var availableCapacity: Int64?
    public var totalCapacity: Int64?
    public var unit: String?
    public var computeMode: ComputeModeOptionsEnum?
    public var workerSize: WorkerSizeOptionsEnum?
    public var workerSizeId: Int32?
    public var excludeFromCapacityAllocation: Bool?
    public var isApplicableForAllComputeModes: Bool?
    public var siteMode: String?

        enum CodingKeys: String, CodingKey {case name = "name"
        case availableCapacity = "availableCapacity"
        case totalCapacity = "totalCapacity"
        case unit = "unit"
        case computeMode = "computeMode"
        case workerSize = "workerSize"
        case workerSizeId = "workerSizeId"
        case excludeFromCapacityAllocation = "excludeFromCapacityAllocation"
        case isApplicableForAllComputeModes = "isApplicableForAllComputeModes"
        case siteMode = "siteMode"
        }

  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(.availableCapacity) {
        self.availableCapacity = try container.decode(Int64?.self, forKey: .availableCapacity)
    }
    if container.contains(.totalCapacity) {
        self.totalCapacity = try container.decode(Int64?.self, forKey: .totalCapacity)
    }
    if container.contains(.unit) {
        self.unit = try container.decode(String?.self, forKey: .unit)
    }
    if container.contains(.computeMode) {
        self.computeMode = try container.decode(ComputeModeOptionsEnum?.self, forKey: .computeMode)
    }
    if container.contains(.workerSize) {
        self.workerSize = try container.decode(WorkerSizeOptionsEnum?.self, forKey: .workerSize)
    }
    if container.contains(.workerSizeId) {
        self.workerSizeId = try container.decode(Int32?.self, forKey: .workerSizeId)
    }
    if container.contains(.excludeFromCapacityAllocation) {
        self.excludeFromCapacityAllocation = try container.decode(Bool?.self, forKey: .excludeFromCapacityAllocation)
    }
    if container.contains(.isApplicableForAllComputeModes) {
        self.isApplicableForAllComputeModes = try container.decode(Bool?.self, forKey: .isApplicableForAllComputeModes)
    }
    if container.contains(.siteMode) {
        self.siteMode = try container.decode(String?.self, forKey: .siteMode)
    }
    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.availableCapacity != nil {try container.encode(self.availableCapacity, forKey: .availableCapacity)}
    if self.totalCapacity != nil {try container.encode(self.totalCapacity, forKey: .totalCapacity)}
    if self.unit != nil {try container.encode(self.unit, forKey: .unit)}
    if self.computeMode != nil {try container.encode(self.computeMode, forKey: .computeMode)}
    if self.workerSize != nil {try container.encode(self.workerSize, forKey: .workerSize)}
    if self.workerSizeId != nil {try container.encode(self.workerSizeId, forKey: .workerSizeId)}
    if self.excludeFromCapacityAllocation != nil {try container.encode(self.excludeFromCapacityAllocation, forKey: .excludeFromCapacityAllocation)}
    if self.isApplicableForAllComputeModes != nil {try container.encode(self.isApplicableForAllComputeModes, forKey: .isApplicableForAllComputeModes)}
    if self.siteMode != nil {try container.encode(self.siteMode, forKey: .siteMode)}
  }
}

extension DataFactory {
  public static func createStampCapacityProtocol() -> StampCapacityProtocol {
    return StampCapacityData()
  }
}
