/* Options: Date: 2024-11-24 14:05:17 SwiftVersion: 5.0 Version: 6.50 Tip: To override a DTO option, remove "//" prefix before updating BaseUrl: https://clubready.com/api/current //BaseClass: //AddModelExtensions: True //AddServiceStackTypes: True IncludeTypes: ClassRosterRequest.* //ExcludeTypes: //ExcludeGenericBaseTypes: False //AddResponseStatus: False //AddImplicitVersion: //AddDescriptionAsComments: True //InitializeCollections: True //TreatTypesAsStrings: //DefaultImports: Foundation,ServiceStack */ import Foundation import ServiceStack // @Route("/scheduling/class-roster", "GET") public class ClassRosterRequest : ClassRosterRequestDto, IReturn, IRestrictedApiRequest { public typealias Return = ClassRosterResponse /** * Api Key - grants access to resources */ // @ApiMember(DataType="string", Description="Api Key - grants access to resources", IsRequired=true, Name="ApiKey", ParameterType="query") public var apiKey:String /** * Store Id or Chain Id is required */ // @ApiMember(DataType="integer", Description="Store Id or Chain Id is required", Name="StoreId", ParameterType="query") public var storeId:Int? /** * Store Id or Chain Id is required */ // @ApiMember(DataType="integer", Description="Store Id or Chain Id is required", Name="ChainId", ParameterType="query") public var chainId:Int? /** * Class Schedule ID */ // @ApiMember(DataType="integer", Description="Class Schedule ID", IsRequired=true, Name="ClassScheduleId", ParameterType="query") public var classScheduleId:Int public var restrictedId:Int? public var restrictedResourceType:RestrictedResourceType required public init(){ super.init() } private enum CodingKeys : String, CodingKey { case apiKey case storeId case chainId case classScheduleId case restrictedId case restrictedResourceType } required public init(from decoder: Decoder) throws { try super.init(from: decoder) let container = try decoder.container(keyedBy: CodingKeys.self) apiKey = try container.decodeIfPresent(String.self, forKey: .apiKey) storeId = try container.decodeIfPresent(Int.self, forKey: .storeId) chainId = try container.decodeIfPresent(Int.self, forKey: .chainId) classScheduleId = try container.decodeIfPresent(Int.self, forKey: .classScheduleId) restrictedId = try container.decodeIfPresent(Int.self, forKey: .restrictedId) restrictedResourceType = try container.decodeIfPresent(RestrictedResourceType.self, forKey: .restrictedResourceType) } public override func encode(to encoder: Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) if apiKey != nil { try container.encode(apiKey, forKey: .apiKey) } if storeId != nil { try container.encode(storeId, forKey: .storeId) } if chainId != nil { try container.encode(chainId, forKey: .chainId) } if classScheduleId != nil { try container.encode(classScheduleId, forKey: .classScheduleId) } if restrictedId != nil { try container.encode(restrictedId, forKey: .restrictedId) } if restrictedResourceType != nil { try container.encode(restrictedResourceType, forKey: .restrictedResourceType) } } } public class ClassRosterResponse : ClassRosterResponseDto { public var success:Bool public var message:String public var classDate:Date public var freeSpots:Int public var maxSpots:Int public var totalBooked:Int public var locationType:String public var virtualLink:String public var classRoster:[ClassRosterItem] = [] public var waitList:[ClassRosterItem] = [] required public init(){ super.init() } private enum CodingKeys : String, CodingKey { case success case message case classDate case freeSpots case maxSpots case totalBooked case locationType case virtualLink case classRoster case waitList } required public init(from decoder: Decoder) throws { try super.init(from: decoder) let container = try decoder.container(keyedBy: CodingKeys.self) success = try container.decodeIfPresent(Bool.self, forKey: .success) message = try container.decodeIfPresent(String.self, forKey: .message) classDate = try container.decodeIfPresent(Date.self, forKey: .classDate) freeSpots = try container.decodeIfPresent(Int.self, forKey: .freeSpots) maxSpots = try container.decodeIfPresent(Int.self, forKey: .maxSpots) totalBooked = try container.decodeIfPresent(Int.self, forKey: .totalBooked) locationType = try container.decodeIfPresent(String.self, forKey: .locationType) virtualLink = try container.decodeIfPresent(String.self, forKey: .virtualLink) classRoster = try container.decodeIfPresent([ClassRosterItem].self, forKey: .classRoster) ?? [] waitList = try container.decodeIfPresent([ClassRosterItem].self, forKey: .waitList) ?? [] } public override func encode(to encoder: Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) if success != nil { try container.encode(success, forKey: .success) } if message != nil { try container.encode(message, forKey: .message) } if classDate != nil { try container.encode(classDate, forKey: .classDate) } if freeSpots != nil { try container.encode(freeSpots, forKey: .freeSpots) } if maxSpots != nil { try container.encode(maxSpots, forKey: .maxSpots) } if totalBooked != nil { try container.encode(totalBooked, forKey: .totalBooked) } if locationType != nil { try container.encode(locationType, forKey: .locationType) } if virtualLink != nil { try container.encode(virtualLink, forKey: .virtualLink) } if classRoster.count > 0 { try container.encode(classRoster, forKey: .classRoster) } if waitList.count > 0 { try container.encode(waitList, forKey: .waitList) } } } public enum RestrictedResourceType : String, Codable { case Store case Chain case User case Undefined } public protocol IRestrictedApiRequest : IApiKeyEndpoint { var restrictedId:Int? { get set } var restrictedResourceType:RestrictedResourceType { get set } } public protocol IApiKeyEndpoint { var apiKey:String { get set } } public class ClassRosterRequestDto : ApiDtoBase { public var classScheduleId:Int required public init(){ super.init() } private enum CodingKeys : String, CodingKey { case classScheduleId } required public init(from decoder: Decoder) throws { try super.init(from: decoder) let container = try decoder.container(keyedBy: CodingKeys.self) classScheduleId = try container.decodeIfPresent(Int.self, forKey: .classScheduleId) } public override func encode(to encoder: Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) if classScheduleId != nil { try container.encode(classScheduleId, forKey: .classScheduleId) } } } public class ApiDtoBase : Codable { public var apiKey:String public var storeId:Int? public var chainId:Int? required public init(){} } public class ClassRosterItem : Codable { public var bookingId:Int public var userId:Int public var firstName:String public var lastName:String public var email:String public var phone:String public var bookingMade:Date public var firstTimeBooking:Bool public var packageName:String public var packageId:Int? public var leadTypeName:String public var leadTypeId:Int? public var isMember:Bool public var memberExpiration:Date? public var creditType:ClassRosterCreditType public var creditsRemaining:Int public var nextCreditExpiration:Date? public var bookingStatusId:Int16? public var bookingStatusDescription:String required public init(){} } public class ClassRosterResponseDto : ApiResponseBase { public var classRoster:[ClassRosterItem] = [] public var waitList:[ClassRosterItem] = [] required public init(){ super.init() } private enum CodingKeys : String, CodingKey { case classRoster case waitList } required public init(from decoder: Decoder) throws { try super.init(from: decoder) let container = try decoder.container(keyedBy: CodingKeys.self) classRoster = try container.decodeIfPresent([ClassRosterItem].self, forKey: .classRoster) ?? [] waitList = try container.decodeIfPresent([ClassRosterItem].self, forKey: .waitList) ?? [] } public override func encode(to encoder: Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) if classRoster.count > 0 { try container.encode(classRoster, forKey: .classRoster) } if waitList.count > 0 { try container.encode(waitList, forKey: .waitList) } } } public class ApiResponseBase : Codable { public var success:Bool public var message:String required public init(){} } public enum ClassRosterCreditType : Int, Codable { case Uninitialized = 0 case PaidCredit = 1 case FreeCredit = 2 case AmenityCredit = 3 case MembershipTypeCredit = 4 case ClassPassCredit = 5 case Error = -1 }