import Foundation
import azureSwiftRuntime
public protocol ReservationsDetailsListByReservationOrderAndReservation  {
    var nextLink: String? { get }
    var hasAdditionalPages : Bool { get }
    var headerParameters: [String: String] { get set }
    var reservationOrderId : String { get set }
    var reservationId : String { get set }
    var filter : String { get set }
    var apiVersion : String { get set }
    func execute(client: RuntimeClient,
    completionHandler: @escaping (ReservationDetailsListResultProtocol?, Error?) -> Void) -> Void ;
}

extension Commands.ReservationsDetails {
// ListByReservationOrderAndReservation lists the reservations details for provided date range.
    internal class ListByReservationOrderAndReservationCommand : BaseCommand, ReservationsDetailsListByReservationOrderAndReservation {
        var nextLink: String?
        public var hasAdditionalPages : Bool {
        get {
            return nextLink != nil
        }
    }
        public var reservationOrderId : String
        public var reservationId : String
        public var filter : String
        public var apiVersion = "2018-01-31"

        public init(reservationOrderId: String, reservationId: String, filter: String) {
            self.reservationOrderId = reservationOrderId
            self.reservationId = reservationId
            self.filter = filter
            super.init()
            self.method = "Get"
            self.isLongRunningOperation = false
            self.path = "/providers/Microsoft.Capacity/reservationorders/{reservationOrderId}/reservations/{reservationId}/providers/Microsoft.Consumption/reservationDetails"
            self.headerParameters = ["Content-Type":"application/json; charset=utf-8"]
        }

        public override func preCall()  {
            self.pathParameters["{reservationOrderId}"] = String(describing: self.reservationOrderId)
            self.pathParameters["{reservationId}"] = String(describing: self.reservationId)
            self.queryParameters["$filter"] = String(describing: self.filter)
            self.queryParameters["api-version"] = String(describing: self.apiVersion)

        }

        public override func returnFunc(data: Data) throws -> Decodable? {
            let contentType = "application/json"
            if let mimeType = MimeType.getType(forStr: contentType) {
                let decoder = try CoderFactory.decoder(for: mimeType)
                if var pageDecoder = decoder as? PageDecoder {
                    pageDecoder.isPagedData = true
                    pageDecoder.nextLinkName = "NextLink"
                }
                let result = try decoder.decode(ReservationDetailsListResultData?.self, from: data)
                if var pageDecoder = decoder as? PageDecoder {
                    self.nextLink = pageDecoder.nextLink
                }
                return result;
            }
            throw DecodeError.unknownMimeType
        }
        public func execute(client: RuntimeClient,
            completionHandler: @escaping (ReservationDetailsListResultProtocol?, Error?) -> Void) -> Void {
            if self.nextLink != nil {
                self.path = nextLink!
                self.nextLink = nil;
                self.pathType = .absolute
            }
            client.executeAsync(command: self) {
                (result: ReservationDetailsListResultData?, error: Error?) in
                completionHandler(result, error)
            }
        }
    }
}


// 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.

// ReservationsSummaries is the consumption management client provides access to consumption resources for Azure
// Enterprise Subscriptions.
import Foundation
import azureSwiftRuntime
extension Commands {
public struct ReservationsSummaries {
    public static func ListByReservationOrder(reservationOrderId: String, grain: DatagrainEnum) -> ReservationsSummariesListByReservationOrder {
        return ListByReservationOrderCommand(reservationOrderId: reservationOrderId, grain: grain)
    }
    public static func ListByReservationOrderAndReservation(reservationOrderId: String, reservationId: String, grain: DatagrainEnum) -> ReservationsSummariesListByReservationOrderAndReservation {
        return ListByReservationOrderAndReservationCommand(reservationOrderId: reservationOrderId, reservationId: reservationId, grain: grain)
    }
}
}


import Foundation
import azureSwiftRuntime
public protocol ReservationsSummariesListByReservationOrder  {
    var nextLink: String? { get }
    var hasAdditionalPages : Bool { get }
    var headerParameters: [String: String] { get set }
    var reservationOrderId : String { get set }
    var grain : DatagrainEnum { get set }
    var filter : String? { get set }
    var apiVersion : String { get set }
    func execute(client: RuntimeClient,
    completionHandler: @escaping (ReservationSummariesListResultProtocol?, Error?) -> Void) -> Void ;
}

extension Commands.ReservationsSummaries {
// ListByReservationOrder lists the reservations summaries for daily or monthly grain.
    internal class ListByReservationOrderCommand : BaseCommand, ReservationsSummariesListByReservationOrder {
        var nextLink: String?
        public var hasAdditionalPages : Bool {
        get {
            return nextLink != nil
        }
    }
        public var reservationOrderId : String
        public var grain : DatagrainEnum
        public var filter : String?
        public var apiVersion = "2018-01-31"

        public init(reservationOrderId: String, grain: DatagrainEnum) {
            self.reservationOrderId = reservationOrderId
            self.grain = grain
            super.init()
            self.method = "Get"
            self.isLongRunningOperation = false
            self.path = "/providers/Microsoft.Capacity/reservationorders/{reservationOrderId}/providers/Microsoft.Consumption/reservationSummaries"
            self.headerParameters = ["Content-Type":"application/json; charset=utf-8"]
        }

        public override func preCall()  {
            self.pathParameters["{reservationOrderId}"] = String(describing: self.reservationOrderId)
            self.queryParameters["grain"] = String(describing: self.grain)
            if self.filter != nil { queryParameters["$filter"] = String(describing: self.filter!) }
            self.queryParameters["api-version"] = String(describing: self.apiVersion)

        }

        public override func returnFunc(data: Data) throws -> Decodable? {
            let contentType = "application/json"
            if let mimeType = MimeType.getType(forStr: contentType) {
                let decoder = try CoderFactory.decoder(for: mimeType)
                if var pageDecoder = decoder as? PageDecoder {
                    pageDecoder.isPagedData = true
                    pageDecoder.nextLinkName = "NextLink"
                }
                let result = try decoder.decode(ReservationSummariesListResultData?.self, from: data)
                if var pageDecoder = decoder as? PageDecoder {
                    self.nextLink = pageDecoder.nextLink
                }
                return result;
            }
            throw DecodeError.unknownMimeType
        }
        public func execute(client: RuntimeClient,
            completionHandler: @escaping (ReservationSummariesListResultProtocol?, Error?) -> Void) -> Void {
            if self.nextLink != nil {
                self.path = nextLink!
                self.nextLink = nil;
                self.pathType = .absolute
            }
            client.executeAsync(command: self) {
                (result: ReservationSummariesListResultData?, error: Error?) in
                completionHandler(result, error)
            }
        }
    }
}


import Foundation
import azureSwiftRuntime
public protocol ReservationsSummariesListByReservationOrderAndReservation  {
    var nextLink: String? { get }
    var hasAdditionalPages : Bool { get }
    var headerParameters: [String: String] { get set }
    var reservationOrderId : String { get set }
    var reservationId : String { get set }
    var grain : DatagrainEnum { get set }
    var filter : String? { get set }
    var apiVersion : String { get set }
    func execute(client: RuntimeClient,
    completionHandler: @escaping (ReservationSummariesListResultProtocol?, Error?) -> Void) -> Void ;
}

extension Commands.ReservationsSummaries {
// ListByReservationOrderAndReservation lists the reservations summaries for daily or monthly grain.
    internal class ListByReservationOrderAndReservationCommand : BaseCommand, ReservationsSummariesListByReservationOrderAndReservation {
        var nextLink: String?
        public var hasAdditionalPages : Bool {
        get {
            return nextLink != nil
        }
    }
        public var reservationOrderId : String
        public var reservationId : String
        public var grain : DatagrainEnum
        public var filter : String?
        public var apiVersion = "2018-01-31"

        public init(reservationOrderId: String, reservationId: String, grain: DatagrainEnum) {
            self.reservationOrderId = reservationOrderId
            self.reservationId = reservationId
            self.grain = grain
            super.init()
            self.method = "Get"
            self.isLongRunningOperation = false
            self.path = "/providers/Microsoft.Capacity/reservationorders/{reservationOrderId}/reservations/{reservationId}/providers/Microsoft.Consumption/reservationSummaries"
            self.headerParameters = ["Content-Type":"application/json; charset=utf-8"]
        }

        public override func preCall()  {
            self.pathParameters["{reservationOrderId}"] = String(describing: self.reservationOrderId)
            self.pathParameters["{reservationId}"] = String(describing: self.reservationId)
            self.queryParameters["grain"] = String(describing: self.grain)
            if self.filter != nil { queryParameters["$filter"] = String(describing: self.filter!) }
            self.queryParameters["api-version"] = String(describing: self.apiVersion)

        }

        public override func returnFunc(data: Data) throws -> Decodable? {
            let contentType = "application/json"
            if let mimeType = MimeType.getType(forStr: contentType) {
                let decoder = try CoderFactory.decoder(for: mimeType)
                if var pageDecoder = decoder as? PageDecoder {
                    pageDecoder.isPagedData = true
                    pageDecoder.nextLinkName = "NextLink"
                }
                let result = try decoder.decode(ReservationSummariesListResultData?.self, from: data)
                if var pageDecoder = decoder as? PageDecoder {
                    self.nextLink = pageDecoder.nextLink
                }
                return result;
            }
            throw DecodeError.unknownMimeType
        }
        public func execute(client: RuntimeClient,
            completionHandler: @escaping (ReservationSummariesListResultProtocol?, Error?) -> Void) -> Void {
            if self.nextLink != nil {
                self.path = nextLink!
                self.nextLink = nil;
                self.pathType = .absolute
            }
            client.executeAsync(command: self) {
                (result: ReservationSummariesListResultData?, error: Error?) in
                completionHandler(result, error)
            }
        }
    }
}


// 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.

// UsageDetails is the consumption management client provides access to consumption resources for Azure Enterprise
// Subscriptions.
import Foundation
import azureSwiftRuntime
extension Commands {
public struct UsageDetails {
    public static func List(subscriptionId: String) -> UsageDetailsList {
        return ListCommand(subscriptionId: subscriptionId)
    }
    public static func ListByBillingPeriod(subscriptionId: String, billingPeriodName: String) -> UsageDetailsListByBillingPeriod {
        return ListByBillingPeriodCommand(subscriptionId: subscriptionId, billingPeriodName: billingPeriodName)
    }
}
}


import Foundation
import azureSwiftRuntime
public protocol UsageDetailsList  {
    var nextLink: String? { get }
    var hasAdditionalPages : Bool { get }
    var headerParameters: [String: String] { get set }
    var subscriptionId : String { get set }
    var expand : String? { get set }
    var filter : String? { get set }
    var skiptoken : String? { get set }
    var top : Int32? { get set }
    var apiVersion : String { get set }
    func execute(client: RuntimeClient,
    completionHandler: @escaping (UsageDetailsListResultProtocol?, Error?) -> Void) -> Void ;
}

extension Commands.UsageDetails {
// List lists the usage details for a scope by billing period. Usage details are available via this API only for May 1,
// 2014 or later.
    internal class ListCommand : BaseCommand, UsageDetailsList {
        var nextLink: String?
        public var hasAdditionalPages : Bool {
        get {
            return nextLink != nil
        }
    }
        public var subscriptionId : String
        public var expand : String?
        public var filter : String?
        public var skiptoken : String?
        public var top : Int32?
        public var apiVersion = "2018-01-31"

        public init(subscriptionId: String) {
            self.subscriptionId = subscriptionId
            super.init()
            self.method = "Get"
            self.isLongRunningOperation = false
            self.path = "/subscriptions/{subscriptionId}/providers/Microsoft.Consumption/usageDetails"
            self.headerParameters = ["Content-Type":"application/json; charset=utf-8"]
        }

        public override func preCall()  {
            self.pathParameters["{subscriptionId}"] = String(describing: self.subscriptionId)
            if self.expand != nil { queryParameters["$expand"] = String(describing: self.expand!) }
            if self.filter != nil { queryParameters["$filter"] = String(describing: self.filter!) }
            if self.skiptoken != nil { queryParameters["$skiptoken"] = String(describing: self.skiptoken!) }
            if self.top != nil { queryParameters["$top"] = String(describing: self.top!) }
            self.queryParameters["api-version"] = String(describing: self.apiVersion)

        }

        public override func returnFunc(data: Data) throws -> Decodable? {
            let contentType = "application/json"
            if let mimeType = MimeType.getType(forStr: contentType) {
                let decoder = try CoderFactory.decoder(for: mimeType)
                if var pageDecoder = decoder as? PageDecoder {
                    pageDecoder.isPagedData = true
                    pageDecoder.nextLinkName = "NextLink"
                }
                let result = try decoder.decode(UsageDetailsListResultData?.self, from: data)
                if var pageDecoder = decoder as? PageDecoder {
                    self.nextLink = pageDecoder.nextLink
                }
                return result;
            }
            throw DecodeError.unknownMimeType
        }
        public func execute(client: RuntimeClient,
            completionHandler: @escaping (UsageDetailsListResultProtocol?, Error?) -> Void) -> Void {
            if self.nextLink != nil {
                self.path = nextLink!
                self.nextLink = nil;
                self.pathType = .absolute
            }
            client.executeAsync(command: self) {
                (result: UsageDetailsListResultData?, error: Error?) in
                completionHandler(result, error)
            }
        }
    }
}


import Foundation
import azureSwiftRuntime
public protocol UsageDetailsListByBillingPeriod  {
    var nextLink: String? { get }
    var hasAdditionalPages : Bool { get }
    var headerParameters: [String: String] { get set }
    var subscriptionId : String { get set }
    var billingPeriodName : String { get set }
    var expand : String? { get set }
    var filter : String? { get set }
    var skiptoken : String? { get set }
    var top : Int32? { get set }
    var apiVersion : String { get set }
    func execute(client: RuntimeClient,
    completionHandler: @escaping (UsageDetailsListResultProtocol?, Error?) -> Void) -> Void ;
}

extension Commands.UsageDetails {
// ListByBillingPeriod lists the usage details for a scope by billing period. Usage details are available via this API
// only for May 1, 2014 or later.
    internal class ListByBillingPeriodCommand : BaseCommand, UsageDetailsListByBillingPeriod {
        var nextLink: String?
        public var hasAdditionalPages : Bool {
        get {
            return nextLink != nil
        }
    }
        public var subscriptionId : String
        public var billingPeriodName : String
        public var expand : String?
        public var filter : String?
        public var skiptoken : String?
        public var top : Int32?
        public var apiVersion = "2018-01-31"

        public init(subscriptionId: String, billingPeriodName: String) {
            self.subscriptionId = subscriptionId
            self.billingPeriodName = billingPeriodName
            super.init()
            self.method = "Get"
            self.isLongRunningOperation = false
            self.path = "/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}/providers/Microsoft.Consumption/usageDetails"
            self.headerParameters = ["Content-Type":"application/json; charset=utf-8"]
        }

        public override func preCall()  {
            self.pathParameters["{subscriptionId}"] = String(describing: self.subscriptionId)
            self.pathParameters["{billingPeriodName}"] = String(describing: self.billingPeriodName)
            if self.expand != nil { queryParameters["$expand"] = String(describing: self.expand!) }
            if self.filter != nil { queryParameters["$filter"] = String(describing: self.filter!) }
            if self.skiptoken != nil { queryParameters["$skiptoken"] = String(describing: self.skiptoken!) }
            if self.top != nil { queryParameters["$top"] = String(describing: self.top!) }
            self.queryParameters["api-version"] = String(describing: self.apiVersion)

        }

        public override func returnFunc(data: Data) throws -> Decodable? {
            let contentType = "application/json"
            if let mimeType = MimeType.getType(forStr: contentType) {
                let decoder = try CoderFactory.decoder(for: mimeType)
                if var pageDecoder = decoder as? PageDecoder {
                    pageDecoder.isPagedData = true
                    pageDecoder.nextLinkName = "NextLink"
                }
                let result = try decoder.decode(UsageDetailsListResultData?.self, from: data)
                if var pageDecoder = decoder as? PageDecoder {
                    self.nextLink = pageDecoder.nextLink
                }
                return result;
            }
            throw DecodeError.unknownMimeType
        }
        public func execute(client: RuntimeClient,
            completionHandler: @escaping (UsageDetailsListResultProtocol?, Error?) -> Void) -> Void {
            if self.nextLink != nil {
                self.path = nextLink!
                self.nextLink = nil;
                self.pathType = .absolute
            }
            client.executeAsync(command: self) {
                (result: UsageDetailsListResultData?, error: Error?) in
                completionHandler(result, error)
            }
        }
    }
}


// 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 BudgetData : BudgetProtocol, ProxyResourceProtocol {
    public var id: String?
    public var name: String?
    public var type: String?
    public var eTag: String?
    public var properties: BudgetPropertiesProtocol?

        enum CodingKeys: String, CodingKey {case id = "id"
        case name = "name"
        case type = "type"
        case eTag = "eTag"
        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(.type) {
        self.type = try container.decode(String?.self, forKey: .type)
    }
    if container.contains(.eTag) {
        self.eTag = try container.decode(String?.self, forKey: .eTag)
    }
    if container.contains(.properties) {
        self.properties = try container.decode(BudgetPropertiesData?.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.type != nil {try container.encode(self.type, forKey: .type)}
    if self.eTag != nil {try container.encode(self.eTag, forKey: .eTag)}
    if self.properties != nil {try container.encode(self.properties as! BudgetPropertiesData?, forKey: .properties)}
  }
}

extension DataFactory {
  public static func createBudgetProtocol() -> BudgetProtocol {
    return BudgetData()
  }
}


// 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 BudgetPropertiesData : BudgetPropertiesProtocol {
    public var category: CategoryTypeEnum
    public var amount: Decimal
    public var timeGrain: TimeGrainTypeEnum
    public var timePeriod: BudgetTimePeriodProtocol
    public var filters: FiltersProtocol?
    public var currentSpend: CurrentSpendProtocol?
    public var notifications: [String:NotificationProtocol?]?

        enum CodingKeys: String, CodingKey {case category = "category"
        case amount = "amount"
        case timeGrain = "timeGrain"
        case timePeriod = "timePeriod"
        case filters = "filters"
        case currentSpend = "currentSpend"
        case notifications = "notifications"
        }

  public init(category: CategoryTypeEnum, amount: Decimal, timeGrain: TimeGrainTypeEnum, timePeriod: BudgetTimePeriodProtocol)  {
    self.category = category
    self.amount = amount
    self.timeGrain = timeGrain
    self.timePeriod = timePeriod
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      self.category = try container.decode(CategoryTypeEnum.self, forKey: .category)
    self.amount = try container.decode(Decimal.self, forKey: .amount)
    self.timeGrain = try container.decode(TimeGrainTypeEnum.self, forKey: .timeGrain)
    self.timePeriod = try container.decode(BudgetTimePeriodData.self, forKey: .timePeriod)
    if container.contains(.filters) {
        self.filters = try container.decode(FiltersData?.self, forKey: .filters)
    }
    if container.contains(.currentSpend) {
        self.currentSpend = try container.decode(CurrentSpendData?.self, forKey: .currentSpend)
    }
    if container.contains(.notifications) {
        self.notifications = try container.decode([String:NotificationData?]?.self, forKey: .notifications)
    }
    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.category, forKey: .category)
    try container.encode(self.amount, forKey: .amount)
    try container.encode(self.timeGrain, forKey: .timeGrain)
    try container.encode(self.timePeriod as! BudgetTimePeriodData, forKey: .timePeriod)
    if self.filters != nil {try container.encode(self.filters as! FiltersData?, forKey: .filters)}
    if self.currentSpend != nil {try container.encode(self.currentSpend as! CurrentSpendData?, forKey: .currentSpend)}
    if self.notifications != nil {try container.encode(self.notifications, forKey: .notifications)}
  }
}

extension DataFactory {
  public static func createBudgetPropertiesProtocol(category: CategoryTypeEnum, amount: Decimal, timeGrain: TimeGrainTypeEnum, timePeriod: BudgetTimePeriodProtocol) -> BudgetPropertiesProtocol {
    return BudgetPropertiesData(category: category, amount: amount, timeGrain: timeGrain, timePeriod: timePeriod)
  }
}


// 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 BudgetsListResultData : BudgetsListResultProtocol {
    public var value: [BudgetProtocol?]?
    public var _nextLink: String?

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

  public init()  {
  }

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

extension DataFactory {
  public static func createBudgetsListResultProtocol() -> BudgetsListResultProtocol {
    return BudgetsListResultData()
  }
}


// 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 BudgetTimePeriodData : BudgetTimePeriodProtocol {
    public var startDate: Date
    public var endDate: Date?

        enum CodingKeys: String, CodingKey {case startDate = "startDate"
        case endDate = "endDate"
        }

  public init(startDate: Date)  {
    self.startDate = startDate
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
          self.startDate = DateConverter.fromString(dateStr: (try container.decode(String?.self, forKey: .startDate)), format: .dateTime)!
    if container.contains(.endDate) {
        self.endDate = DateConverter.fromString(dateStr: (try container.decode(String?.self, forKey: .endDate)), 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)
    try container.encode(DateConverter.toString(date: self.startDate, format: .dateTime), forKey: .startDate)
    if self.endDate != nil {
        try container.encode(DateConverter.toString(date: self.endDate!, format: .dateTime), forKey: .endDate)
    }
  }
}

extension DataFactory {
  public static func createBudgetTimePeriodProtocol(startDate: Date) -> BudgetTimePeriodProtocol {
    return BudgetTimePeriodData(startDate: startDate)
  }
}


// CategoryType enumerates the values for category 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 CategoryTypeEnum: String, Codable
{
// Cost specifies the cost state for category type.
    case Cost = "Cost"
// Usage specifies the usage state for category type.
    case Usage = "Usage"
}


// 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 CurrentSpendData : CurrentSpendProtocol {
    public var amount: Decimal?
    public var unit: String?

        enum CodingKeys: String, CodingKey {case amount = "amount"
        case unit = "unit"
        }

  public init()  {
  }

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

extension DataFactory {
  public static func createCurrentSpendProtocol() -> CurrentSpendProtocol {
    return CurrentSpendData()
  }
}


// Datagrain enumerates the values for datagrain.

// 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 DatagrainEnum: String, Codable
{
// DailyGrain specifies the daily grain state for datagrain.
    case DailyGrain = "daily"
// MonthlyGrain specifies the monthly grain state for datagrain.
    case MonthlyGrain = "monthly"
}


// 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 ErrorDetailsData : ErrorDetailsProtocol {
    public var code: String?
    public var message: String?

        enum CodingKeys: String, CodingKey {case code = "code"
        case message = "message"
        }

  public init()  {
  }

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

extension DataFactory {
  public static func createErrorDetailsProtocol() -> ErrorDetailsProtocol {
    return ErrorDetailsData()
  }
}


// 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 ErrorResponseData : ErrorResponseProtocol {
    public var error: ErrorDetailsProtocol?

        enum CodingKeys: String, CodingKey {case error = "error"
        }

  public init()  {
  }

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

extension DataFactory {
  public static func createErrorResponseProtocol() -> ErrorResponseProtocol {
    return ErrorResponseData()
  }
}


// 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 FiltersData : FiltersProtocol {
    public var resourceGroups: [String]?
    public var resources: [String]?
    public var meters: [String]?

        enum CodingKeys: String, CodingKey {case resourceGroups = "resourceGroups"
        case resources = "resources"
        case meters = "meters"
        }

  public init()  {
  }

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

extension DataFactory {
  public static func createFiltersProtocol() -> FiltersProtocol {
    return FiltersData()
  }
}


// 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 MarketplaceData : MarketplaceProtocol, ResourceProtocol {
    public var id: String?
    public var name: String?
    public var type: String?
    public var tags: [String:String]?
    public var properties: MarketplacePropertiesProtocol?

        enum CodingKeys: String, CodingKey {case id = "id"
        case name = "name"
        case type = "type"
        case tags = "tags"
        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(.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(MarketplacePropertiesData?.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.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! MarketplacePropertiesData?, forKey: .properties)}
  }
}

extension DataFactory {
  public static func createMarketplaceProtocol() -> MarketplaceProtocol {
    return MarketplaceData()
  }
}


// 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 MarketplacePropertiesData : MarketplacePropertiesProtocol {
    public var billingPeriodId: String?
    public var usageStart: Date?
    public var usageEnd: Date?
    public var resourceRate: Decimal?
    public var offerName: String?
    public var resourceGroup: String?
    public var orderNumber: String?
    public var instanceName: String?
    public var instanceId: String?
    public var currency: String?
    public var consumedQuantity: Decimal?
    public var unitOfMeasure: String?
    public var pretaxCost: Decimal?
    public var isEstimated: Bool?
    public var meterId: String?
    public var subscriptionGuid: String?
    public var subscriptionName: String?
    public var accountName: String?
    public var departmentName: String?
    public var consumedService: String?
    public var costCenter: String?
    public var additionalProperties: String?
    public var publisherName: String?
    public var planName: String?

        enum CodingKeys: String, CodingKey {case billingPeriodId = "billingPeriodId"
        case usageStart = "usageStart"
        case usageEnd = "usageEnd"
        case resourceRate = "resourceRate"
        case offerName = "offerName"
        case resourceGroup = "resourceGroup"
        case orderNumber = "orderNumber"
        case instanceName = "instanceName"
        case instanceId = "instanceId"
        case currency = "currency"
        case consumedQuantity = "consumedQuantity"
        case unitOfMeasure = "unitOfMeasure"
        case pretaxCost = "pretaxCost"
        case isEstimated = "isEstimated"
        case meterId = "meterId"
        case subscriptionGuid = "subscriptionGuid"
        case subscriptionName = "subscriptionName"
        case accountName = "accountName"
        case departmentName = "departmentName"
        case consumedService = "consumedService"
        case costCenter = "costCenter"
        case additionalProperties = "additionalProperties"
        case publisherName = "publisherName"
        case planName = "planName"
        }

  public init()  {
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.billingPeriodId) {
        self.billingPeriodId = try container.decode(String?.self, forKey: .billingPeriodId)
    }
    if container.contains(.usageStart) {
        self.usageStart = DateConverter.fromString(dateStr: (try container.decode(String?.self, forKey: .usageStart)), format: .dateTime)
    }
    if container.contains(.usageEnd) {
        self.usageEnd = DateConverter.fromString(dateStr: (try container.decode(String?.self, forKey: .usageEnd)), format: .dateTime)
    }
    if container.contains(.resourceRate) {
        self.resourceRate = try container.decode(Decimal?.self, forKey: .resourceRate)
    }
    if container.contains(.offerName) {
        self.offerName = try container.decode(String?.self, forKey: .offerName)
    }
    if container.contains(.resourceGroup) {
        self.resourceGroup = try container.decode(String?.self, forKey: .resourceGroup)
    }
    if container.contains(.orderNumber) {
        self.orderNumber = try container.decode(String?.self, forKey: .orderNumber)
    }
    if container.contains(.instanceName) {
        self.instanceName = try container.decode(String?.self, forKey: .instanceName)
    }
    if container.contains(.instanceId) {
        self.instanceId = try container.decode(String?.self, forKey: .instanceId)
    }
    if container.contains(.currency) {
        self.currency = try container.decode(String?.self, forKey: .currency)
    }
    if container.contains(.consumedQuantity) {
        self.consumedQuantity = try container.decode(Decimal?.self, forKey: .consumedQuantity)
    }
    if container.contains(.unitOfMeasure) {
        self.unitOfMeasure = try container.decode(String?.self, forKey: .unitOfMeasure)
    }
    if container.contains(.pretaxCost) {
        self.pretaxCost = try container.decode(Decimal?.self, forKey: .pretaxCost)
    }
    if container.contains(.isEstimated) {
        self.isEstimated = try container.decode(Bool?.self, forKey: .isEstimated)
    }
    if container.contains(.meterId) {
        self.meterId = try container.decode(String?.self, forKey: .meterId)
    }
    if container.contains(.subscriptionGuid) {
        self.subscriptionGuid = try container.decode(String?.self, forKey: .subscriptionGuid)
    }
    if container.contains(.subscriptionName) {
        self.subscriptionName = try container.decode(String?.self, forKey: .subscriptionName)
    }
    if container.contains(.accountName) {
        self.accountName = try container.decode(String?.self, forKey: .accountName)
    }
    if container.contains(.departmentName) {
        self.departmentName = try container.decode(String?.self, forKey: .departmentName)
    }
    if container.contains(.consumedService) {
        self.consumedService = try container.decode(String?.self, forKey: .consumedService)
    }
    if container.contains(.costCenter) {
        self.costCenter = try container.decode(String?.self, forKey: .costCenter)
    }
    if container.contains(.additionalProperties) {
        self.additionalProperties = try container.decode(String?.self, forKey: .additionalProperties)
    }
    if container.contains(.publisherName) {
        self.publisherName = try container.decode(String?.self, forKey: .publisherName)
    }
    if container.contains(.planName) {
        self.planName = try container.decode(String?.self, forKey: .planName)
    }
    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.billingPeriodId != nil {try container.encode(self.billingPeriodId, forKey: .billingPeriodId)}
    if self.usageStart != nil {
        try container.encode(DateConverter.toString(date: self.usageStart!, format: .dateTime), forKey: .usageStart)
    }
    if self.usageEnd != nil {
        try container.encode(DateConverter.toString(date: self.usageEnd!, format: .dateTime), forKey: .usageEnd)
    }
    if self.resourceRate != nil {try container.encode(self.resourceRate, forKey: .resourceRate)}
    if self.offerName != nil {try container.encode(self.offerName, forKey: .offerName)}
    if self.resourceGroup != nil {try container.encode(self.resourceGroup, forKey: .resourceGroup)}
    if self.orderNumber != nil {try container.encode(self.orderNumber, forKey: .orderNumber)}
    if self.instanceName != nil {try container.encode(self.instanceName, forKey: .instanceName)}
    if self.instanceId != nil {try container.encode(self.instanceId, forKey: .instanceId)}
    if self.currency != nil {try container.encode(self.currency, forKey: .currency)}
    if self.consumedQuantity != nil {try container.encode(self.consumedQuantity, forKey: .consumedQuantity)}
    if self.unitOfMeasure != nil {try container.encode(self.unitOfMeasure, forKey: .unitOfMeasure)}
    if self.pretaxCost != nil {try container.encode(self.pretaxCost, forKey: .pretaxCost)}
    if self.isEstimated != nil {try container.encode(self.isEstimated, forKey: .isEstimated)}
    if self.meterId != nil {try container.encode(self.meterId, forKey: .meterId)}
    if self.subscriptionGuid != nil {try container.encode(self.subscriptionGuid, forKey: .subscriptionGuid)}
    if self.subscriptionName != nil {try container.encode(self.subscriptionName, forKey: .subscriptionName)}
    if self.accountName != nil {try container.encode(self.accountName, forKey: .accountName)}
    if self.departmentName != nil {try container.encode(self.departmentName, forKey: .departmentName)}
    if self.consumedService != nil {try container.encode(self.consumedService, forKey: .consumedService)}
    if self.costCenter != nil {try container.encode(self.costCenter, forKey: .costCenter)}
    if self.additionalProperties != nil {try container.encode(self.additionalProperties, forKey: .additionalProperties)}
    if self.publisherName != nil {try container.encode(self.publisherName, forKey: .publisherName)}
    if self.planName != nil {try container.encode(self.planName, forKey: .planName)}
  }
}

extension DataFactory {
  public static func createMarketplacePropertiesProtocol() -> MarketplacePropertiesProtocol {
    return MarketplacePropertiesData()
  }
}


// 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 MarketplacesListResultData : MarketplacesListResultProtocol {
    public var value: [MarketplaceProtocol?]?
    public var _nextLink: String?

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

  public init()  {
  }

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

extension DataFactory {
  public static func createMarketplacesListResultProtocol() -> MarketplacesListResultProtocol {
    return MarketplacesListResultData()
  }
}


// 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 MeterDetailsData : MeterDetailsProtocol {
    public var meterName: String?
    public var meterCategory: String?
    public var meterSubCategory: String?
    public var unit: String?
    public var meterLocation: String?
    public var totalIncludedQuantity: Decimal?
    public var pretaxStandardRate: Decimal?

        enum CodingKeys: String, CodingKey {case meterName = "meterName"
        case meterCategory = "meterCategory"
        case meterSubCategory = "meterSubCategory"
        case unit = "unit"
        case meterLocation = "meterLocation"
        case totalIncludedQuantity = "totalIncludedQuantity"
        case pretaxStandardRate = "pretaxStandardRate"
        }

  public init()  {
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.meterName) {
        self.meterName = try container.decode(String?.self, forKey: .meterName)
    }
    if container.contains(.meterCategory) {
        self.meterCategory = try container.decode(String?.self, forKey: .meterCategory)
    }
    if container.contains(.meterSubCategory) {
        self.meterSubCategory = try container.decode(String?.self, forKey: .meterSubCategory)
    }
    if container.contains(.unit) {
        self.unit = try container.decode(String?.self, forKey: .unit)
    }
    if container.contains(.meterLocation) {
        self.meterLocation = try container.decode(String?.self, forKey: .meterLocation)
    }
    if container.contains(.totalIncludedQuantity) {
        self.totalIncludedQuantity = try container.decode(Decimal?.self, forKey: .totalIncludedQuantity)
    }
    if container.contains(.pretaxStandardRate) {
        self.pretaxStandardRate = try container.decode(Decimal?.self, forKey: .pretaxStandardRate)
    }
    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.meterName != nil {try container.encode(self.meterName, forKey: .meterName)}
    if self.meterCategory != nil {try container.encode(self.meterCategory, forKey: .meterCategory)}
    if self.meterSubCategory != nil {try container.encode(self.meterSubCategory, forKey: .meterSubCategory)}
    if self.unit != nil {try container.encode(self.unit, forKey: .unit)}
    if self.meterLocation != nil {try container.encode(self.meterLocation, forKey: .meterLocation)}
    if self.totalIncludedQuantity != nil {try container.encode(self.totalIncludedQuantity, forKey: .totalIncludedQuantity)}
    if self.pretaxStandardRate != nil {try container.encode(self.pretaxStandardRate, forKey: .pretaxStandardRate)}
  }
}

extension DataFactory {
  public static func createMeterDetailsProtocol() -> MeterDetailsProtocol {
    return MeterDetailsData()
  }
}


// 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 NotificationData : NotificationProtocol {
    public var enabled: Bool
    public var _operator: OperatorTypeEnum
    public var threshold: Decimal
    public var contactEmails: [String]
    public var contactRoles: [String]?
    public var contactGroups: [String]?

        enum CodingKeys: String, CodingKey {case enabled = "enabled"
        case _operator = "operator"
        case threshold = "threshold"
        case contactEmails = "contactEmails"
        case contactRoles = "contactRoles"
        case contactGroups = "contactGroups"
        }

  public init(enabled: Bool, _operator: OperatorTypeEnum, threshold: Decimal, contactEmails: [String])  {
    self.enabled = enabled
    self._operator = _operator
    self.threshold = threshold
    self.contactEmails = contactEmails
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      self.enabled = try container.decode(Bool.self, forKey: .enabled)
    self._operator = try container.decode(OperatorTypeEnum.self, forKey: ._operator)
    self.threshold = try container.decode(Decimal.self, forKey: .threshold)
    self.contactEmails = try container.decode([String].self, forKey: .contactEmails)
    if container.contains(.contactRoles) {
        self.contactRoles = try container.decode([String]?.self, forKey: .contactRoles)
    }
    if container.contains(.contactGroups) {
        self.contactGroups = try container.decode([String]?.self, forKey: .contactGroups)
    }
    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.enabled, forKey: .enabled)
    try container.encode(self._operator, forKey: ._operator)
    try container.encode(self.threshold, forKey: .threshold)
    try container.encode(self.contactEmails as! [String], forKey: .contactEmails)
    if self.contactRoles != nil {try container.encode(self.contactRoles as! [String]?, forKey: .contactRoles)}
    if self.contactGroups != nil {try container.encode(self.contactGroups as! [String]?, forKey: .contactGroups)}
  }
}

extension DataFactory {
  public static func createNotificationProtocol(enabled: Bool, _operator: OperatorTypeEnum, threshold: Decimal, contactEmails: [String]) -> NotificationProtocol {
    return NotificationData(enabled: enabled, _operator: _operator, threshold: threshold, contactEmails: contactEmails)
  }
}


// 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 OperationData : OperationProtocol {
    public var name: String?
    public var display: OperationDisplayProtocol?

        enum CodingKeys: String, CodingKey {case name = "name"
        case display = "display"
        }

  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(.display) {
        self.display = try container.decode(OperationDisplayData?.self, forKey: .display)
    }
    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.display != nil {try container.encode(self.display as! OperationDisplayData?, forKey: .display)}
  }
}

extension DataFactory {
  public static func createOperationProtocol() -> OperationProtocol {
    return OperationData()
  }
}


// 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 OperationDisplayData : OperationDisplayProtocol {
    public var provider: String?
    public var resource: String?
    public var operation: String?

        enum CodingKeys: String, CodingKey {case provider = "provider"
        case resource = "resource"
        case operation = "operation"
        }

  public init()  {
  }

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

extension DataFactory {
  public static func createOperationDisplayProtocol() -> OperationDisplayProtocol {
    return OperationDisplayData()
  }
}


// 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 OperationListResultData : OperationListResultProtocol {
    public var value: [OperationProtocol?]?
    public var _nextLink: String?

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

  public init()  {
  }

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

extension DataFactory {
  public static func createOperationListResultProtocol() -> OperationListResultProtocol {
    return OperationListResultData()
  }
}


// OperatorType enumerates the values for operator 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 OperatorTypeEnum: String, Codable
{
// EqualTo specifies the equal to state for operator type.
    case EqualTo = "EqualTo"
// GreaterThan specifies the greater than state for operator type.
    case GreaterThan = "GreaterThan"
// GreaterThanOrEqualTo specifies the greater than or equal to state for operator type.
    case GreaterThanOrEqualTo = "GreaterThanOrEqualTo"
}


// 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 PriceSheetModelData : PriceSheetModelProtocol {
    public var pricesheets: [PriceSheetPropertiesProtocol?]?
    public var _nextLink: String?

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

  public init()  {
  }

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

extension DataFactory {
  public static func createPriceSheetModelProtocol() -> PriceSheetModelProtocol {
    return PriceSheetModelData()
  }
}


// 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 PriceSheetPropertiesData : PriceSheetPropertiesProtocol {
    public var billingPeriodId: String?
    public var meterId: String?
    public var meterDetails: MeterDetailsProtocol?
    public var unitOfMeasure: String?
    public var includedQuantity: Decimal?
    public var partNumber: String?
    public var unitPrice: Decimal?
    public var currencyCode: String?

        enum CodingKeys: String, CodingKey {case billingPeriodId = "billingPeriodId"
        case meterId = "meterId"
        case meterDetails = "meterDetails"
        case unitOfMeasure = "unitOfMeasure"
        case includedQuantity = "includedQuantity"
        case partNumber = "partNumber"
        case unitPrice = "unitPrice"
        case currencyCode = "currencyCode"
        }

  public init()  {
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.billingPeriodId) {
        self.billingPeriodId = try container.decode(String?.self, forKey: .billingPeriodId)
    }
    if container.contains(.meterId) {
        self.meterId = try container.decode(String?.self, forKey: .meterId)
    }
    if container.contains(.meterDetails) {
        self.meterDetails = try container.decode(MeterDetailsData?.self, forKey: .meterDetails)
    }
    if container.contains(.unitOfMeasure) {
        self.unitOfMeasure = try container.decode(String?.self, forKey: .unitOfMeasure)
    }
    if container.contains(.includedQuantity) {
        self.includedQuantity = try container.decode(Decimal?.self, forKey: .includedQuantity)
    }
    if container.contains(.partNumber) {
        self.partNumber = try container.decode(String?.self, forKey: .partNumber)
    }
    if container.contains(.unitPrice) {
        self.unitPrice = try container.decode(Decimal?.self, forKey: .unitPrice)
    }
    if container.contains(.currencyCode) {
        self.currencyCode = try container.decode(String?.self, forKey: .currencyCode)
    }
    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.billingPeriodId != nil {try container.encode(self.billingPeriodId, forKey: .billingPeriodId)}
    if self.meterId != nil {try container.encode(self.meterId, forKey: .meterId)}
    if self.meterDetails != nil {try container.encode(self.meterDetails as! MeterDetailsData?, forKey: .meterDetails)}
    if self.unitOfMeasure != nil {try container.encode(self.unitOfMeasure, forKey: .unitOfMeasure)}
    if self.includedQuantity != nil {try container.encode(self.includedQuantity, forKey: .includedQuantity)}
    if self.partNumber != nil {try container.encode(self.partNumber, forKey: .partNumber)}
    if self.unitPrice != nil {try container.encode(self.unitPrice, forKey: .unitPrice)}
    if self.currencyCode != nil {try container.encode(self.currencyCode, forKey: .currencyCode)}
  }
}

extension DataFactory {
  public static func createPriceSheetPropertiesProtocol() -> PriceSheetPropertiesProtocol {
    return PriceSheetPropertiesData()
  }
}


// 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 PriceSheetResultData : PriceSheetResultProtocol, ResourceProtocol {
    public var id: String?
    public var name: String?
    public var type: String?
    public var tags: [String:String]?
    public var properties: PriceSheetModelProtocol?

        enum CodingKeys: String, CodingKey {case id = "id"
        case name = "name"
        case type = "type"
        case tags = "tags"
        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(.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(PriceSheetModelData?.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.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! PriceSheetModelData?, forKey: .properties)}
  }
}

extension DataFactory {
  public static func createPriceSheetResultProtocol() -> PriceSheetResultProtocol {
    return PriceSheetResultData()
  }
}


// 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 ProxyResourceData : ProxyResourceProtocol {
    public var id: String?
    public var name: String?
    public var type: String?
    public var eTag: String?

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

  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(.type) {
        self.type = try container.decode(String?.self, forKey: .type)
    }
    if container.contains(.eTag) {
        self.eTag = try container.decode(String?.self, forKey: .eTag)
    }
    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.type != nil {try container.encode(self.type, forKey: .type)}
    if self.eTag != nil {try container.encode(self.eTag, forKey: .eTag)}
  }
}

extension DataFactory {
  public static func createProxyResourceProtocol() -> ProxyResourceProtocol {
    return ProxyResourceData()
  }
}


// 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 ReservationDetailsData : ReservationDetailsProtocol, ResourceProtocol {
    public var id: String?
    public var name: String?
    public var type: String?
    public var tags: [String:String]?
    public var properties: ReservationDetailsPropertiesProtocol?

        enum CodingKeys: String, CodingKey {case id = "id"
        case name = "name"
        case type = "type"
        case tags = "tags"
        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(.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(ReservationDetailsPropertiesData?.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.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! ReservationDetailsPropertiesData?, forKey: .properties)}
  }
}

extension DataFactory {
  public static func createReservationDetailsProtocol() -> ReservationDetailsProtocol {
    return ReservationDetailsData()
  }
}


// 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 ReservationDetailsListResultData : ReservationDetailsListResultProtocol {
    public var value: [ReservationDetailsProtocol?]?
    public var _nextLink: String?

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

  public init()  {
  }

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

extension DataFactory {
  public static func createReservationDetailsListResultProtocol() -> ReservationDetailsListResultProtocol {
    return ReservationDetailsListResultData()
  }
}


// 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 ReservationDetailsPropertiesData : ReservationDetailsPropertiesProtocol {
    public var reservationOrderId: String?
    public var reservationId: String?
    public var skuName: String?
    public var reservedHours: Decimal?
    public var usageDate: Date?
    public var usedHours: Decimal?
    public var instanceId: String?
    public var totalReservedQuantity: Decimal?

        enum CodingKeys: String, CodingKey {case reservationOrderId = "reservationOrderId"
        case reservationId = "reservationId"
        case skuName = "skuName"
        case reservedHours = "reservedHours"
        case usageDate = "usageDate"
        case usedHours = "usedHours"
        case instanceId = "instanceId"
        case totalReservedQuantity = "totalReservedQuantity"
        }

  public init()  {
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.reservationOrderId) {
        self.reservationOrderId = try container.decode(String?.self, forKey: .reservationOrderId)
    }
    if container.contains(.reservationId) {
        self.reservationId = try container.decode(String?.self, forKey: .reservationId)
    }
    if container.contains(.skuName) {
        self.skuName = try container.decode(String?.self, forKey: .skuName)
    }
    if container.contains(.reservedHours) {
        self.reservedHours = try container.decode(Decimal?.self, forKey: .reservedHours)
    }
    if container.contains(.usageDate) {
        self.usageDate = DateConverter.fromString(dateStr: (try container.decode(String?.self, forKey: .usageDate)), format: .dateTime)
    }
    if container.contains(.usedHours) {
        self.usedHours = try container.decode(Decimal?.self, forKey: .usedHours)
    }
    if container.contains(.instanceId) {
        self.instanceId = try container.decode(String?.self, forKey: .instanceId)
    }
    if container.contains(.totalReservedQuantity) {
        self.totalReservedQuantity = try container.decode(Decimal?.self, forKey: .totalReservedQuantity)
    }
    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.reservationOrderId != nil {try container.encode(self.reservationOrderId, forKey: .reservationOrderId)}
    if self.reservationId != nil {try container.encode(self.reservationId, forKey: .reservationId)}
    if self.skuName != nil {try container.encode(self.skuName, forKey: .skuName)}
    if self.reservedHours != nil {try container.encode(self.reservedHours, forKey: .reservedHours)}
    if self.usageDate != nil {
        try container.encode(DateConverter.toString(date: self.usageDate!, format: .dateTime), forKey: .usageDate)
    }
    if self.usedHours != nil {try container.encode(self.usedHours, forKey: .usedHours)}
    if self.instanceId != nil {try container.encode(self.instanceId, forKey: .instanceId)}
    if self.totalReservedQuantity != nil {try container.encode(self.totalReservedQuantity, forKey: .totalReservedQuantity)}
  }
}

extension DataFactory {
  public static func createReservationDetailsPropertiesProtocol() -> ReservationDetailsPropertiesProtocol {
    return ReservationDetailsPropertiesData()
  }
}


// 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 ReservationSummariesData : ReservationSummariesProtocol, ResourceProtocol {
    public var id: String?
    public var name: String?
    public var type: String?
    public var tags: [String:String]?
    public var properties: ReservationSummariesPropertiesProtocol?

        enum CodingKeys: String, CodingKey {case id = "id"
        case name = "name"
        case type = "type"
        case tags = "tags"
        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(.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(ReservationSummariesPropertiesData?.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.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! ReservationSummariesPropertiesData?, forKey: .properties)}
  }
}

extension DataFactory {
  public static func createReservationSummariesProtocol() -> ReservationSummariesProtocol {
    return ReservationSummariesData()
  }
}


// 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 ReservationSummariesListResultData : ReservationSummariesListResultProtocol {
    public var value: [ReservationSummariesProtocol?]?
    public var _nextLink: String?

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

  public init()  {
  }

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

extension DataFactory {
  public static func createReservationSummariesListResultProtocol() -> ReservationSummariesListResultProtocol {
    return ReservationSummariesListResultData()
  }
}


// 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 ReservationSummariesPropertiesData : ReservationSummariesPropertiesProtocol {
    public var reservationOrderId: String?
    public var reservationId: String?
    public var skuName: String?
    public var reservedHours: Decimal?
    public var usageDate: Date?
    public var usedHours: Decimal?
    public var minUtilizationPercentage: Decimal?
    public var avgUtilizationPercentage: Decimal?
    public var maxUtilizationPercentage: Decimal?

        enum CodingKeys: String, CodingKey {case reservationOrderId = "reservationOrderId"
        case reservationId = "reservationId"
        case skuName = "skuName"
        case reservedHours = "reservedHours"
        case usageDate = "usageDate"
        case usedHours = "usedHours"
        case minUtilizationPercentage = "minUtilizationPercentage"
        case avgUtilizationPercentage = "avgUtilizationPercentage"
        case maxUtilizationPercentage = "maxUtilizationPercentage"
        }

  public init()  {
  }

  public init(from decoder: Decoder) throws {
    let container = try decoder.container(keyedBy: CodingKeys.self)
      if container.contains(.reservationOrderId) {
        self.reservationOrderId = try container.decode(String?.self, forKey: .reservationOrderId)
    }
    if container.contains(.reservationId) {
        self.reservationId = try container.decode(String?.self, forKey: .reservationId)
    }
    if container.contains(.skuName) {
        self.skuName = try container.decode(String?.self, forKey: .skuName)
    }
    if container.contains(.reservedHours) {
        self.reservedHours = try container.decode(Decimal?.self, forKey: .reservedHours)
    }
    if container.contains(.usageDate) {
        self.usageDate = DateConverter.fromString(dateStr: (try container.decode(String?.self, forKey: .usageDate)), format: .dateTime)
    }
    if container.contains(.usedHours) {
        self.usedHours = try container.decode(Decimal?.self, forKey: .usedHours)
    }
    if container.contains(.minUtilizationPercentage) {
        self.minUtilizationPercentage = try container.decode(Decimal?.self, forKey: .minUtilizationPercentage)
    }
    if container.contains(.avgUtilizationPercentage) {
        self.avgUtilizationPercentage = try container.decode(Decimal?.self, forKey: .avgUtilizationPercentage)
    }
    if container.contains(.maxUtilizationPercentage) {
        self.maxUtilizationPercentage = try container.decode(Decimal?.self, forKey: .maxUtilizationPercentage)
    }
    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.reservationOrderId != nil {try container.encode(self.reservationOrderId, forKey: .reservationOrderId)}
    if self.reservationId != nil {try container.encode(self.reservationId, forKey: .reservationId)}
    if self.skuName != nil {try container.encode(self.skuName, forKey: .skuName)}
    if self.reservedHours != nil {try container.encode(self.reservedHours, forKey: .reservedHours)}
    if self.usageDate != nil {
        try container.encode(DateConverter.toString(date: self.usageDate!, format: .dateTime), forKey: .usageDate)
    }
    if self.usedHours != nil {try container.encode(self.usedHours, forKey: .usedHours)}
    if self.minUtilizationPercentage != nil {try container.encode(self.minUtilizationPercentage, forKey: .minUtilizationPercentage)}
    if self.avgUtilizationPercentage != nil {try container.encode(self.avgUtilizationPercentage, forKey: .avgUtilizationPercentage)}
    if self.maxUtilizationPercentage != nil {try container.encode(self.maxUtilizationPercentage, forKey: .maxUtilizationPercentage)}
  }
}

extension DataFactory {
  public static func createReservationSummariesPropertiesProtocol() -> ReservationSummariesPropertiesProtocol {
    return ReservationSummariesPropertiesData()
  }
}


// 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 ResourceData : ResourceProtocol {
    public var id: String?
    public var name: String?
    public var type: String?
    public var tags: [String:String]?

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

  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(.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 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.type != nil {try container.encode(self.type, forKey: .type)}
    if self.tags != nil {try container.encode(self.tags, forKey: .tags)}
  }
}

extension DataFactory {
  public static func createResourceProtocol() -> ResourceProtocol {
    return ResourceData()
  }
}


// TimeGrainType enumerates the values for time grain 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 TimeGrainTypeEnum: String, Codable
{
// Annually specifies the annually state for time grain type.
    case Annually = "Annually"
// Monthly specifies the monthly state for time grain type.
    case Monthly = "Monthly"
// Quarterly specifies the quarterly state for time grain type.
    case Quarterly = "Quarterly"
}


// 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 UsageDetailData : UsageDetailProtocol, ResourceProtocol {
    public var id: String?
    public var name: String?
    public var type: String?
    public var tags: [String:String]?
    public var properties: UsageDetailPropertiesProtocol?

        enum CodingKeys: String, CodingKey {case id = "id"
        case name = "name"
        case type = "type"
        case tags = "tags"
        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(.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(UsageDetailPropertiesData?.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.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! UsageDetailPropertiesData?, forKey: .properties)}
  }
}

extension DataFactory {
  public static func createUsageDetailProtocol() -> UsageDetailProtocol {
    return UsageDetailData()
  }
}