/* Options: Date: 2024-11-24 13:47:23 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: BookingStatusEventsRequest.* //ExcludeTypes: //ExcludeGenericBaseTypes: False //AddResponseStatus: False //AddImplicitVersion: //AddDescriptionAsComments: True //InitializeCollections: True //TreatTypesAsStrings: //DefaultImports: Foundation,ServiceStack */ import Foundation import ServiceStack // @Route("/scheduling/booking-status-events", "GET") public class BookingStatusEventsRequest : BookingStatusEventsRequestDto, IReturn, IRestrictedApiRequest { public typealias Return = BookingStatusEventsResponse /** * 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 /** * Chain ID */ // @ApiMember(DataType="integer", Description="Chain ID", Name="ChainId", ParameterType="query") public var chainId:Int? /** * Store ID */ // @ApiMember(DataType="integer", Description="Store ID", Name="StoreId", ParameterType="query") public var storeId:Int? /** * UTC Format */ // @ApiMember(DataType="date", Description="UTC Format", IsRequired=true, Name="FromDate", ParameterType="query") public var fromDate:Date /** * Max 24 Hours (UTC Format) */ // @ApiMember(DataType="date", Description="Max 24 Hours (UTC Format)", IsRequired=true, Name="ToDate", ParameterType="query") public var toDate:Date /** * 0 = All, 1 = Classes, 2 = Services */ // @ApiMember(DataType="integer", Description="0 = All, 1 = Classes, 2 = Services", IsRequired=true, Name="BookingTypeFilter", ParameterType="query") public var bookingTypeFilter:Int /** * 0 = Any, 1 = Only Consults, 2 = Exclude Consults */ // @ApiMember(DataType="integer", Description="0 = Any, 1 = Only Consults, 2 = Exclude Consults", IsRequired=true, Name="ConsultFilter", ParameterType="query") public var consultFilter:Int /** * Leave blank for any, otherwise use ClubReady BookingStatus enum */ // @ApiMember(DataType="integer", Description="Leave blank for any, otherwise use ClubReady BookingStatus enum", Name="StatusFilter", ParameterType="query") public var statusFilter:Int? public var restrictedId:Int? public var restrictedResourceType:RestrictedResourceType required public init(){ super.init() } private enum CodingKeys : String, CodingKey { case apiKey case chainId case storeId case fromDate case toDate case bookingTypeFilter case consultFilter case statusFilter 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) chainId = try container.decodeIfPresent(Int.self, forKey: .chainId) storeId = try container.decodeIfPresent(Int.self, forKey: .storeId) fromDate = try container.decodeIfPresent(Date.self, forKey: .fromDate) toDate = try container.decodeIfPresent(Date.self, forKey: .toDate) bookingTypeFilter = try container.decodeIfPresent(Int.self, forKey: .bookingTypeFilter) consultFilter = try container.decodeIfPresent(Int.self, forKey: .consultFilter) statusFilter = try container.decodeIfPresent(Int.self, forKey: .statusFilter) 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 chainId != nil { try container.encode(chainId, forKey: .chainId) } if storeId != nil { try container.encode(storeId, forKey: .storeId) } if fromDate != nil { try container.encode(fromDate, forKey: .fromDate) } if toDate != nil { try container.encode(toDate, forKey: .toDate) } if bookingTypeFilter != nil { try container.encode(bookingTypeFilter, forKey: .bookingTypeFilter) } if consultFilter != nil { try container.encode(consultFilter, forKey: .consultFilter) } if statusFilter != nil { try container.encode(statusFilter, forKey: .statusFilter) } if restrictedId != nil { try container.encode(restrictedId, forKey: .restrictedId) } if restrictedResourceType != nil { try container.encode(restrictedResourceType, forKey: .restrictedResourceType) } } } public class BookingStatusEventsResponse : BookingStatusEventsResponseDto { public var success:Bool public var message:String public var bookingStatusEvents:[BookingStatusEventItem] = [] required public init(){ super.init() } private enum CodingKeys : String, CodingKey { case success case message case bookingStatusEvents } 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) bookingStatusEvents = try container.decodeIfPresent([BookingStatusEventItem].self, forKey: .bookingStatusEvents) ?? [] } 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 bookingStatusEvents.count > 0 { try container.encode(bookingStatusEvents, forKey: .bookingStatusEvents) } } } public enum RestrictedResourceType : String, Codable { case Store case Chain case User case Undefined } public class BookingStatusEventsRequestDto : ApiDtoBase { public var fromDate:Date public var toDate:Date public var bookingTypeFilter:Int public var consultFilter:Int public var statusFilter:Int? required public init(){ super.init() } private enum CodingKeys : String, CodingKey { case fromDate case toDate case bookingTypeFilter case consultFilter case statusFilter } required public init(from decoder: Decoder) throws { try super.init(from: decoder) let container = try decoder.container(keyedBy: CodingKeys.self) fromDate = try container.decodeIfPresent(Date.self, forKey: .fromDate) toDate = try container.decodeIfPresent(Date.self, forKey: .toDate) bookingTypeFilter = try container.decodeIfPresent(Int.self, forKey: .bookingTypeFilter) consultFilter = try container.decodeIfPresent(Int.self, forKey: .consultFilter) statusFilter = try container.decodeIfPresent(Int.self, forKey: .statusFilter) } public override func encode(to encoder: Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) if fromDate != nil { try container.encode(fromDate, forKey: .fromDate) } if toDate != nil { try container.encode(toDate, forKey: .toDate) } if bookingTypeFilter != nil { try container.encode(bookingTypeFilter, forKey: .bookingTypeFilter) } if consultFilter != nil { try container.encode(consultFilter, forKey: .consultFilter) } if statusFilter != nil { try container.encode(statusFilter, forKey: .statusFilter) } } } public protocol IRestrictedApiRequest : IApiKeyEndpoint { var restrictedId:Int? { get set } var restrictedResourceType:RestrictedResourceType { get set } } public protocol IApiKeyEndpoint { var apiKey:String { get set } } public class ApiDtoBase : Codable { public var apiKey:String public var storeId:Int? public var chainId:Int? required public init(){} } public class BookingStatusEventItem : Codable { public var chainId:Int? public var storeId:Int? public var userId:Int public var bookingId:Int public var classScheduleId:Int? public var serviceId:Int? public var sessionSizeId:Int? public var bookingDateTime:Date public var status:BookingStatus public var statusId:Int public var statusChanged:Date public var consult:Bool public var bookedFromWaitList:Bool required public init(){} } public class BookingStatusEventsResponseDto : ApiResponseBase { public var bookingStatusEvents:[BookingStatusEventItem] = [] required public init(){ super.init() } private enum CodingKeys : String, CodingKey { case bookingStatusEvents } required public init(from decoder: Decoder) throws { try super.init(from: decoder) let container = try decoder.container(keyedBy: CodingKeys.self) bookingStatusEvents = try container.decodeIfPresent([BookingStatusEventItem].self, forKey: .bookingStatusEvents) ?? [] } public override func encode(to encoder: Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) if bookingStatusEvents.count > 0 { try container.encode(bookingStatusEvents, forKey: .bookingStatusEvents) } } } public enum BookingStatus : Int, Codable { case Undefined = 0 case Unavailable = 1 case Open = 2 case CancelledWithinPolicy = 3 case CancelledOutsidePolicy = 4 case Completed = 5 case NoShow = 6 case RescheduledWithinPolicy = 8 case RescheduledByAdmin = 9 case CancelledByAdminNotCustomerFault = 10 case Pending = 11 case WaitListed = 12 case Error = -1 } public class ApiResponseBase : Codable { public var success:Bool public var message:String required public init(){} }