/* Options: Date: 2025-12-06 08:52:58 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: GetDashboardInfo.* //ExcludeTypes: //ExcludeGenericBaseTypes: False //AddResponseStatus: False //AddImplicitVersion: //AddDescriptionAsComments: True //InitializeCollections: True //TreatTypesAsStrings: //DefaultImports: Foundation,ServiceStack */ import Foundation import ServiceStack // @Route("/dashboard/info", "GET") public class GetDashboardInfo : ApiServiceRequest, IReturn { public typealias Return = GetDashboardInfoResponse required public init(){ super.init() } required public init(from decoder: Decoder) throws { try super.init(from: decoder) } public override func encode(to encoder: Encoder) throws { try super.encode(to: encoder) } } public class GetDashboardInfoResponse : ApiServiceResponse { public var unreadNotificationCount:Int public var nextMeetingDate:String public var totalMeetingsToday:Int public var outstandingRatingsCount:Int public var usersAverageRating:Double public var hasSharedRatings:Bool public var isSalesPerson:Bool public var usersRatingTotalVotes:Int public var usersRatingPosition:Int public var teamIds:[Int] = [] public var nextMeeting:MeetingData public var attendanceEventType:AttendanceEventType public var outstandingDebriefsToReviewCount:Int public var outstandingTemplateApprovalsCount:Int required public init(){ super.init() } private enum CodingKeys : String, CodingKey { case unreadNotificationCount case nextMeetingDate case totalMeetingsToday case outstandingRatingsCount case usersAverageRating case hasSharedRatings case isSalesPerson case usersRatingTotalVotes case usersRatingPosition case teamIds case nextMeeting case attendanceEventType case outstandingDebriefsToReviewCount case outstandingTemplateApprovalsCount } required public init(from decoder: Decoder) throws { try super.init(from: decoder) let container = try decoder.container(keyedBy: CodingKeys.self) unreadNotificationCount = try container.decodeIfPresent(Int.self, forKey: .unreadNotificationCount) nextMeetingDate = try container.decodeIfPresent(String.self, forKey: .nextMeetingDate) totalMeetingsToday = try container.decodeIfPresent(Int.self, forKey: .totalMeetingsToday) outstandingRatingsCount = try container.decodeIfPresent(Int.self, forKey: .outstandingRatingsCount) usersAverageRating = try container.decodeIfPresent(Double.self, forKey: .usersAverageRating) hasSharedRatings = try container.decodeIfPresent(Bool.self, forKey: .hasSharedRatings) isSalesPerson = try container.decodeIfPresent(Bool.self, forKey: .isSalesPerson) usersRatingTotalVotes = try container.decodeIfPresent(Int.self, forKey: .usersRatingTotalVotes) usersRatingPosition = try container.decodeIfPresent(Int.self, forKey: .usersRatingPosition) teamIds = try container.decodeIfPresent([Int].self, forKey: .teamIds) ?? [] nextMeeting = try container.decodeIfPresent(MeetingData.self, forKey: .nextMeeting) attendanceEventType = try container.decodeIfPresent(AttendanceEventType.self, forKey: .attendanceEventType) outstandingDebriefsToReviewCount = try container.decodeIfPresent(Int.self, forKey: .outstandingDebriefsToReviewCount) outstandingTemplateApprovalsCount = try container.decodeIfPresent(Int.self, forKey: .outstandingTemplateApprovalsCount) } public override func encode(to encoder: Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) if unreadNotificationCount != nil { try container.encode(unreadNotificationCount, forKey: .unreadNotificationCount) } if nextMeetingDate != nil { try container.encode(nextMeetingDate, forKey: .nextMeetingDate) } if totalMeetingsToday != nil { try container.encode(totalMeetingsToday, forKey: .totalMeetingsToday) } if outstandingRatingsCount != nil { try container.encode(outstandingRatingsCount, forKey: .outstandingRatingsCount) } if usersAverageRating != nil { try container.encode(usersAverageRating, forKey: .usersAverageRating) } if hasSharedRatings != nil { try container.encode(hasSharedRatings, forKey: .hasSharedRatings) } if isSalesPerson != nil { try container.encode(isSalesPerson, forKey: .isSalesPerson) } if usersRatingTotalVotes != nil { try container.encode(usersRatingTotalVotes, forKey: .usersRatingTotalVotes) } if usersRatingPosition != nil { try container.encode(usersRatingPosition, forKey: .usersRatingPosition) } if teamIds.count > 0 { try container.encode(teamIds, forKey: .teamIds) } if nextMeeting != nil { try container.encode(nextMeeting, forKey: .nextMeeting) } if attendanceEventType != nil { try container.encode(attendanceEventType, forKey: .attendanceEventType) } if outstandingDebriefsToReviewCount != nil { try container.encode(outstandingDebriefsToReviewCount, forKey: .outstandingDebriefsToReviewCount) } if outstandingTemplateApprovalsCount != nil { try container.encode(outstandingTemplateApprovalsCount, forKey: .outstandingTemplateApprovalsCount) } } } 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 AttendanceEventType : Int, Codable { case ClockOut = 0 case ClockIn = 1 case StartLunch = 2 case EndLunch = 3 case StartBreak = 4 case EndBreak = 5 } public class MeetingData : Codable { public var meetingId:Int public var startTime:String public var arrivalTime:String public var leftTime:String public var duration:String public var showTimeFields:Bool public var arrivalStatus:String public var email:String public var hasEmail:Bool public var contactName:String public var latitude:Double public var longitude:Double public var location:String public var address:String public var subject:String public var Description:String public var endTime:String public var company:String public var contactNumber:String public var hasContactNumber:Bool public var hasLocation:Bool public var setBy:String public var virtualOrInPerson:String 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(){} }