/* Options: Date: 2026-01-26 18:22:06 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: UserLogin.* //ExcludeTypes: //ExcludeGenericBaseTypes: False //AddResponseStatus: False //AddImplicitVersion: //AddDescriptionAsComments: True //InitializeCollections: True //TreatTypesAsStrings: //DefaultImports: Foundation,ServiceStack */ import Foundation import ServiceStack // @Route("/user/login", "POST") public class UserLogin : ApiServiceRequest, IReturn { public typealias Return = UserLoginResponse public var username:String public var password:String public var utcOffset:Int required public init(){ super.init() } private enum CodingKeys : String, CodingKey { case username case password case utcOffset } required public init(from decoder: Decoder) throws { try super.init(from: decoder) let container = try decoder.container(keyedBy: CodingKeys.self) username = try container.decodeIfPresent(String.self, forKey: .username) password = try container.decodeIfPresent(String.self, forKey: .password) utcOffset = try container.decodeIfPresent(Int.self, forKey: .utcOffset) } public override func encode(to encoder: Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) if username != nil { try container.encode(username, forKey: .username) } if password != nil { try container.encode(password, forKey: .password) } if utcOffset != nil { try container.encode(utcOffset, forKey: .utcOffset) } } } public class UserLoginResponse : ApiServiceResponse { public var allowAttendanceOnLaptop:Bool public var profileImageUrl:String public var friendlyName:String public var systemUserId:Int public var username:String public var permissions:SystemUserPermission public var settings:AppSettings public var startLatitude:Double public var startLongitude:Double public var hasStartLocation:Bool public var endLatitude:Double public var endLongitude:Double public var hasEndLocation:Bool public var isSalesPerson:Bool public var feelingStatusMappings:[String] = [] public var hasAiPermissions:Bool public var refreshToken:String public var isManagerOrPromotedTo:Bool public var isTemplateApprover:Bool public var outstandingApprovals:Int required public init(){ super.init() } private enum CodingKeys : String, CodingKey { case allowAttendanceOnLaptop case profileImageUrl case friendlyName case systemUserId case username case permissions case settings case startLatitude case startLongitude case hasStartLocation case endLatitude case endLongitude case hasEndLocation case isSalesPerson case feelingStatusMappings case hasAiPermissions case refreshToken case isManagerOrPromotedTo case isTemplateApprover case outstandingApprovals } required public init(from decoder: Decoder) throws { try super.init(from: decoder) let container = try decoder.container(keyedBy: CodingKeys.self) allowAttendanceOnLaptop = try container.decodeIfPresent(Bool.self, forKey: .allowAttendanceOnLaptop) profileImageUrl = try container.decodeIfPresent(String.self, forKey: .profileImageUrl) friendlyName = try container.decodeIfPresent(String.self, forKey: .friendlyName) systemUserId = try container.decodeIfPresent(Int.self, forKey: .systemUserId) username = try container.decodeIfPresent(String.self, forKey: .username) permissions = try container.decodeIfPresent(SystemUserPermission.self, forKey: .permissions) settings = try container.decodeIfPresent(AppSettings.self, forKey: .settings) startLatitude = try container.decodeIfPresent(Double.self, forKey: .startLatitude) startLongitude = try container.decodeIfPresent(Double.self, forKey: .startLongitude) hasStartLocation = try container.decodeIfPresent(Bool.self, forKey: .hasStartLocation) endLatitude = try container.decodeIfPresent(Double.self, forKey: .endLatitude) endLongitude = try container.decodeIfPresent(Double.self, forKey: .endLongitude) hasEndLocation = try container.decodeIfPresent(Bool.self, forKey: .hasEndLocation) isSalesPerson = try container.decodeIfPresent(Bool.self, forKey: .isSalesPerson) feelingStatusMappings = try container.decodeIfPresent([String].self, forKey: .feelingStatusMappings) ?? [] hasAiPermissions = try container.decodeIfPresent(Bool.self, forKey: .hasAiPermissions) refreshToken = try container.decodeIfPresent(String.self, forKey: .refreshToken) isManagerOrPromotedTo = try container.decodeIfPresent(Bool.self, forKey: .isManagerOrPromotedTo) isTemplateApprover = try container.decodeIfPresent(Bool.self, forKey: .isTemplateApprover) outstandingApprovals = try container.decodeIfPresent(Int.self, forKey: .outstandingApprovals) } public override func encode(to encoder: Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) if allowAttendanceOnLaptop != nil { try container.encode(allowAttendanceOnLaptop, forKey: .allowAttendanceOnLaptop) } if profileImageUrl != nil { try container.encode(profileImageUrl, forKey: .profileImageUrl) } if friendlyName != nil { try container.encode(friendlyName, forKey: .friendlyName) } if systemUserId != nil { try container.encode(systemUserId, forKey: .systemUserId) } if username != nil { try container.encode(username, forKey: .username) } if permissions != nil { try container.encode(permissions, forKey: .permissions) } if settings != nil { try container.encode(settings, forKey: .settings) } if startLatitude != nil { try container.encode(startLatitude, forKey: .startLatitude) } if startLongitude != nil { try container.encode(startLongitude, forKey: .startLongitude) } if hasStartLocation != nil { try container.encode(hasStartLocation, forKey: .hasStartLocation) } if endLatitude != nil { try container.encode(endLatitude, forKey: .endLatitude) } if endLongitude != nil { try container.encode(endLongitude, forKey: .endLongitude) } if hasEndLocation != nil { try container.encode(hasEndLocation, forKey: .hasEndLocation) } if isSalesPerson != nil { try container.encode(isSalesPerson, forKey: .isSalesPerson) } if feelingStatusMappings.count > 0 { try container.encode(feelingStatusMappings, forKey: .feelingStatusMappings) } if hasAiPermissions != nil { try container.encode(hasAiPermissions, forKey: .hasAiPermissions) } if refreshToken != nil { try container.encode(refreshToken, forKey: .refreshToken) } if isManagerOrPromotedTo != nil { try container.encode(isManagerOrPromotedTo, forKey: .isManagerOrPromotedTo) } if isTemplateApprover != nil { try container.encode(isTemplateApprover, forKey: .isTemplateApprover) } if outstandingApprovals != nil { try container.encode(outstandingApprovals, forKey: .outstandingApprovals) } } } 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 class SystemUserPermission : Codable { public var meeting:Bool public var journey:Bool public var attendance:Bool public var notificationCenter:Bool public var internalRating:Bool public var debrief:Bool public var thunderBoltActions:Bool public var onTheMove:Bool required public init(){} } public class AppSettings : Codable { public var allowAbstainRatings:Bool public var showMoodIndicatorOnApp:Bool public var takePhotoForAnalysis:Bool required public init(){} } public class ApiServiceResponse : IServiceResponse, Codable { public var Description:String public var heading:String public var wasSuccessful:Bool //modelState:Object ignored. Type could not be extended in Swift required public init(){} }