/* Options: Date: 2025-09-10 19:25:59 SwiftVersion: 5.0 Version: 8.30 Tip: To override a DTO option, remove "//" prefix before updating BaseUrl: https://dev-optimization.power.dev //BaseClass: //AddModelExtensions: True //AddServiceStackTypes: True IncludeTypes: CommonOptimizerMonthlyRequest.* //ExcludeTypes: //ExcludeGenericBaseTypes: False //AddResponseStatus: False //AddImplicitVersion: //AddDescriptionAsComments: True //InitializeCollections: True //TreatTypesAsStrings: //DefaultImports: Foundation,ServiceStack */ import Foundation import ServiceStack // @Route("/optimizer/monthly", "POST") public class CommonOptimizerMonthlyRequest : MonthlyRequestBase, IReturn { public typealias Return = MonthlyApiStatusResponse public var month:Int public var group:BatteryScenarioKeyGroup public var key:BatteryScenarioKeyItem public var projectGroup:BatteryProjectGroup required public init(){ super.init() } private enum CodingKeys : String, CodingKey { case month case group case key case projectGroup } required public init(from decoder: Decoder) throws { try super.init(from: decoder) let container = try decoder.container(keyedBy: CodingKeys.self) month = try container.decodeIfPresent(Int.self, forKey: .month) group = try container.decodeIfPresent(BatteryScenarioKeyGroup.self, forKey: .group) key = try container.decodeIfPresent(BatteryScenarioKeyItem.self, forKey: .key) projectGroup = try container.decodeIfPresent(BatteryProjectGroup.self, forKey: .projectGroup) } public override func encode(to encoder: Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) if month != nil { try container.encode(month, forKey: .month) } if group != nil { try container.encode(group, forKey: .group) } if key != nil { try container.encode(key, forKey: .key) } if projectGroup != nil { try container.encode(projectGroup, forKey: .projectGroup) } } } public class MonthlyApiStatusResponse : Codable { public var failedCount:Int required public init(){} } public class BatteryScenarioKeyGroup : Codable { public var keyId:Int public var year:Int public var nodeId:Int public var provider:DataProvider public var zoneId:Int public var plantType:PowerPlantType public var solarId:Int public var windId:Int public var isServerless:Bool required public init(){} } public class BatteryScenarioKeyItem : Codable { public var projectId:String public var keyId:Int public var keyType:BatteryScenarioType public var recordKey:String public var jobStatus:Int public var status:Int public var minDate:Date public var maxDate:Date public var year:Int public var yoyStatus:Int public var usableCapacity:Double public var usableCapacityFactor:Double public var solarUsableCapacity:Double public var solarUsableCapacityFactor:Double public var baseMarket:PriceMarketType public var baseCapacityRate:Double public var capacityRate:Double public var solarCapacityRate:Double public var windCapacityRate:Double public var chargeEfficinecy:Double public var dischargeEfficinecy:Double public var nodeId:Int public var provider:DataProvider public var zoneId:Int public var lmpFileId:Int public var productionFileId:Int public var loadFileId:Int public var capacityFileId:Int public var plantType:PowerPlantType public var solarId:Int public var windId:Int public var ancillaryIncrementFactor:Double public var energyIncrementFactor:Double public var capacityIncrementFactor:Double required public init(){} } public enum BatteryProjectGroup : String, Codable { case Undefined case StandAlone case FTM case BTM } public enum DataProvider : Int, Codable { case Undefined = 0 case SPP = 1 case ERCOT = 2 case MISO = 3 case CAISO = 4 case PJM = 5 case ISONE = 6 case NYISO = 7 case NW = 8 case SW = 9 case SE = 10 case AESO = 11 case IESO = 12 case CENACE = 20 case NONISO = 99 case EIA = 100 case PNM = 150 case NREL = 200 case NOAA = 210 case ENTSOE = 1000 case EPIAS = 1010 case SELF = 10000 } public enum BooleanValue : String, Codable { case Undefined case Yes case No case Custom } public enum PriceMarketType : Int, Codable { case Undefined = 0 case Realtime = 1 case DayAhead = 10 case DART = 101 } public class BatteryProjectTodItem : Codable { public var month:Int public var weekDay:Int public var hour:Int public var price:Double // @Ignore() public var id:String required public init(){} } public enum RevenueStackingMode : String, Codable { case SolveWithoutAncillary case SolveWithAncillary } public class MonthlyRequestBase : Codable { public var projectId:String public var nodeAltId:Int public var iso:DataProvider public var useEnergy:BooleanValue public var useAncillary:BooleanValue public var useCapacityTod:Bool public var baseMarket:PriceMarketType public var capacityTODs:[BatteryProjectTodItem] = [] public var useRegup:Double public var useRegdown:Double public var useSpinning:Double public var useNonSpinning:Double public var paraciticLossesOperation:Double public var paraciticLossesResting:Double public var hvacLosses:Double public var acCablingLosses:Double public var transformatorLosses:Double public var otherLosses:Double public var representativeYear:Int public var incrementReferanceYear:Int public var useFutureData:Int public var maxDailyCycle:Double public var minDailyProfitPerMw:Double public var ancillaryFileId:Int public var lmpFileId:Int public var maxChargingPriceCap:Double public var maxDischargingPriceCap:Double public var maxAncillaryPriceCap:Double public var revenueStackingMode:RevenueStackingMode public var optimizationQuality:Int public var ensureExlusive:Int public var nodeRefId:Int public var useInternalSolver:Bool required public init(){} } public enum PowerPlantType : String, Codable { case Undefined case Solar case Wind case Hybrid } public enum BatteryScenarioType : String, Codable { case Undefined case Optimization case Sum case OptiSum case FullTod case CapacityTod }