/* Options: Date: 2025-12-06 08:53:49 SwiftVersion: 5.0 Version: 8.0 Tip: To override a DTO option, remove "//" prefix before updating BaseUrl: https://cochraneplus-api-dev.happen.zone //BaseClass: //AddModelExtensions: True //AddServiceStackTypes: True IncludeTypes: SubmitThunderBoltAction.* //ExcludeTypes: //ExcludeGenericBaseTypes: False //AddResponseStatus: False //AddImplicitVersion: //AddDescriptionAsComments: True //InitializeCollections: True //TreatTypesAsStrings: //DefaultImports: Foundation,ServiceStack */ import Foundation import ServiceStack // @Route("/thunderbolt/submit", "POST") public class SubmitThunderBoltAction : ApiServiceRequest, IReturn { public typealias Return = SubmitThunderBoltActionResponse public var actionId:Int public var platform:ContactInteractionPlatform public var number:String public var email:String public var notes:String public var dateTime:Date public var contactId:Int required public init(){ super.init() } private enum CodingKeys : String, CodingKey { case actionId case platform case number case email case notes case dateTime case contactId } required public init(from decoder: Decoder) throws { try super.init(from: decoder) let container = try decoder.container(keyedBy: CodingKeys.self) actionId = try container.decodeIfPresent(Int.self, forKey: .actionId) platform = try container.decodeIfPresent(ContactInteractionPlatform.self, forKey: .platform) number = try container.decodeIfPresent(String.self, forKey: .number) email = try container.decodeIfPresent(String.self, forKey: .email) notes = try container.decodeIfPresent(String.self, forKey: .notes) dateTime = try container.decodeIfPresent(Date.self, forKey: .dateTime) contactId = try container.decodeIfPresent(Int.self, forKey: .contactId) } public override func encode(to encoder: Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) if actionId != nil { try container.encode(actionId, forKey: .actionId) } if platform != nil { try container.encode(platform, forKey: .platform) } if number != nil { try container.encode(number, forKey: .number) } if email != nil { try container.encode(email, forKey: .email) } if notes != nil { try container.encode(notes, forKey: .notes) } if dateTime != nil { try container.encode(dateTime, forKey: .dateTime) } if contactId != nil { try container.encode(contactId, forKey: .contactId) } } } public class SubmitThunderBoltActionResponse : GetThunderBoltActionsResponse { public var thunderboltActionEventId:Int required public init(){ super.init() } private enum CodingKeys : String, CodingKey { case thunderboltActionEventId } required public init(from decoder: Decoder) throws { try super.init(from: decoder) let container = try decoder.container(keyedBy: CodingKeys.self) thunderboltActionEventId = try container.decodeIfPresent(Int.self, forKey: .thunderboltActionEventId) } public override func encode(to encoder: Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) if thunderboltActionEventId != nil { try container.encode(thunderboltActionEventId, forKey: .thunderboltActionEventId) } } } public class ApiServiceRequest : IServiceRequest, IHasApiKey, IHasDeviceInfo, Codable { /** * The API Key required for authentication */ // @ApiMember(DataType="string", Description="The API Key required for authentication", IsRequired=true) public var apiKey:String /** * Latitude of the user making this request */ // @ApiMember(DataType="double", Description="Latitude of the user making this request") public var latitude:Double /** * Longitude of the user making this request */ // @ApiMember(DataType="double", Description="Longitude of the user making this request") public var longitude:Double required public init(){} } public protocol IServiceRequest { } public protocol IHasApiKey { var apiKey:String { get set } } public protocol IHasDeviceInfo { } public enum ContactInteractionPlatform : Int, Codable { case None = 0 case Whatsapp = 1 case Linkus = 2 case Mobile = 3 case Outlook = 4 case LinkedIn = 5 case Telegram = 6 case Signal = 7 case Sms = 8 } public class GetThunderBoltActionsResponse : ApiServiceResponse { public var dailyActionsNumber:Int public var supportingDocumentProbability:Int public var thunderBoltActions:[ThunderBoltActionData] = [] public var thunderBoltActionEvents:[ThunderBoltActionEventData] = [] public var contacts:[ContactData] = [] required public init(){ super.init() } private enum CodingKeys : String, CodingKey { case dailyActionsNumber case supportingDocumentProbability case thunderBoltActions case thunderBoltActionEvents case contacts } required public init(from decoder: Decoder) throws { try super.init(from: decoder) let container = try decoder.container(keyedBy: CodingKeys.self) dailyActionsNumber = try container.decodeIfPresent(Int.self, forKey: .dailyActionsNumber) supportingDocumentProbability = try container.decodeIfPresent(Int.self, forKey: .supportingDocumentProbability) thunderBoltActions = try container.decodeIfPresent([ThunderBoltActionData].self, forKey: .thunderBoltActions) ?? [] thunderBoltActionEvents = try container.decodeIfPresent([ThunderBoltActionEventData].self, forKey: .thunderBoltActionEvents) ?? [] contacts = try container.decodeIfPresent([ContactData].self, forKey: .contacts) ?? [] } public override func encode(to encoder: Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) if dailyActionsNumber != nil { try container.encode(dailyActionsNumber, forKey: .dailyActionsNumber) } if supportingDocumentProbability != nil { try container.encode(supportingDocumentProbability, forKey: .supportingDocumentProbability) } if thunderBoltActions.count > 0 { try container.encode(thunderBoltActions, forKey: .thunderBoltActions) } if thunderBoltActionEvents.count > 0 { try container.encode(thunderBoltActionEvents, forKey: .thunderBoltActionEvents) } if contacts.count > 0 { try container.encode(contacts, forKey: .contacts) } } }