/* Options: Date: 2025-03-13 17:59:13 SwiftVersion: 5.0 Version: 8.23 Tip: To override a DTO option, remove "//" prefix before updating BaseUrl: https://testapi.bokamera.se //BaseClass: //AddModelExtensions: True //AddServiceStackTypes: True IncludeTypes: CompanyIncentiveQuery.* //ExcludeTypes: //ExcludeGenericBaseTypes: False //AddResponseStatus: False //AddImplicitVersion: //AddDescriptionAsComments: True //InitializeCollections: True //TreatTypesAsStrings: //DefaultImports: Foundation,ServiceStack */ import Foundation import ServiceStack // @Route("/companies/{CompanyId}/incentives", "GET") // @ValidateRequest(Validator="IsAuthenticated") // @ApiResponse(Description="You were unauthorized to call this service", StatusCode=401) public class CompanyIncentiveQuery : IReturn, ICompany, Codable { public typealias Return = CompanyIncentivesQueryResponse /** * The company id, if empty will use the company id for the user you are logged in with. */ // @ApiMember(Description="The company id, if empty will use the company id for the user you are logged in with.", IsRequired=true, ParameterType="path") public var companyId:String? required public init(){} } public class CompanyIncentivesQueryResponse : Codable { public var incentives:IList public var companyId:String required public init(){} } public protocol ICompany { var companyId:String? { get set } } public class CompanyIncentiveResponse : Codable { public var id:Int public var heading:String public var storageUrl:String public var successButtonText:String public var actionId:Int public var initialDelayInSeconds:Int public var maxDisplayCount:Int? public var validFrom:Date public var validTo:Date public var action:IncentiveAction public var payload:String required public init(){} } public class BaseModel : Codable { required public init(){} } public class IncentiveAction : BaseModel { public var id:Int public var actionType:IncentiveActionType public var page:String public var segment:String public var element:String required public init(){ super.init() } private enum CodingKeys : String, CodingKey { case id case actionType case page case segment case element } required public init(from decoder: Decoder) throws { try super.init(from: decoder) let container = try decoder.container(keyedBy: CodingKeys.self) id = try container.decodeIfPresent(Int.self, forKey: .id) actionType = try container.decodeIfPresent(IncentiveActionType.self, forKey: .actionType) page = try container.decodeIfPresent(String.self, forKey: .page) segment = try container.decodeIfPresent(String.self, forKey: .segment) element = try container.decodeIfPresent(String.self, forKey: .element) } public override func encode(to encoder: Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) if id != nil { try container.encode(id, forKey: .id) } if actionType != nil { try container.encode(actionType, forKey: .actionType) } if page != nil { try container.encode(page, forKey: .page) } if segment != nil { try container.encode(segment, forKey: .segment) } if element != nil { try container.encode(element, forKey: .element) } } } public enum IncentiveActionType : Int, Codable { case Upgrade = 1 case AddOn = 2 case Information = 3 }