/* Options: Date: 2024-11-21 11:33:10 SwiftVersion: 5.0 Version: 8.23 Tip: To override a DTO option, remove "//" prefix before updating BaseUrl: https://api.bokamera.se //BaseClass: //AddModelExtensions: True //AddServiceStackTypes: True IncludeTypes: CreateBookings.* //ExcludeTypes: //ExcludeGenericBaseTypes: False //AddResponseStatus: False //AddImplicitVersion: //AddDescriptionAsComments: True //InitializeCollections: True //TreatTypesAsStrings: //DefaultImports: Foundation,ServiceStack */ import Foundation import ServiceStack // @Route("/bookings/repeat", "POST") // @ApiResponse(Description="You were unauthorized to call this service", StatusCode=401) public class CreateBookings : CreateBookingBase, IReturn { public typealias Return = CreateBookingsResponse /** * Set the dates you want to book and it's quantities. It's an array of dates and quantities. */ // @ApiMember(DataType="List", Description="Set the dates you want to book and it's quantities. It's an array of dates and quantities.", IsRequired=true) public var datesToRepeat:[DatesToRepeat] = [] required public init(){ super.init() } private enum CodingKeys : String, CodingKey { case datesToRepeat } required public init(from decoder: Decoder) throws { try super.init(from: decoder) let container = try decoder.container(keyedBy: CodingKeys.self) datesToRepeat = try container.decodeIfPresent([DatesToRepeat].self, forKey: .datesToRepeat) ?? [] } public override func encode(to encoder: Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) if datesToRepeat.count > 0 { try container.encode(datesToRepeat, forKey: .datesToRepeat) } } } public class CreateBookingsResponse : Codable { /** * The datetime you want to end the booking. */ // @ApiMember(Description="The datetime you want to end the booking.", IsRequired=true) public var created:[BookingQueryResponse] = [] /** * The dates that didn't work to book. */ // @ApiMember(Description="The dates that didn't work to book.", IsRequired=true) public var failed:[FailedBookings] = [] public var responseStatus:ResponseStatus required public init(){} } public class AddCustomField : Codable { public var id:Int public var value:String required public init(){} } public enum PaymentOptions : String, Codable { case DefaultSetting case BookWithoutPayment case BookWithPaymentMessageToCustomer case BookWithManualPayment } public class DatesToRepeat : IInterval, Codable { /** * Booking start */ // @ApiMember(Description="Booking start") public var from:Date /** * Booking end */ // @ApiMember(Description="Booking end") public var to:Date /** * Set the number of spots you want to book. You add number of spots per price category. Multiple spots require that the service has GroupBooking enabled. Default is one spot. */ // @ApiMember(Description="Set the number of spots you want to book. You add number of spots per price category. Multiple spots require that the service has GroupBooking enabled. Default is one spot.") public var quantities:[QuantityToBook] = [] required public init(){} } public class CustomerToHandle : Codable { public var customerId:String? public var firstname:String public var lastname:String public var email:String public var phone:String public var subscribedToNewsletter:Bool required public init(){} } public class ResourceToBook : Codable { public var resourceTypeId:Int public var resourceId:Int required public init(){} } public class CreateBookingBase : Codable { /** * The company id, if empty will use the company id for the user you are logged in with. */ // @ApiMember(Description="The company id, if empty will use the company id for the user you are logged in with.") public var companyId:String? /** * If you want to book on an existing customer instead of CustomerToBook info set the CustomerId here. Set Empty Guid (00000000-0000-0000-0000-000000000000) if you want to book without any customer, this is only allowed by admin. The customer id is shown in the customer list named as id. When booking as customer (no admin) leave this field blank. */ // @ApiMember(Description="If you want to book on an existing customer instead of CustomerToBook info set the CustomerId here. Set Empty Guid (00000000-0000-0000-0000-000000000000) if you want to book without any customer, this is only allowed by admin. The customer id is shown in the customer list named as id. When booking as customer (no admin) leave this field blank.") public var customerId:String? /** * If company requires to be authenticated or a pin code entered to book on a specific customer, enter it here. */ // @ApiMember(Description="If company requires to be authenticated or a pin code entered to book on a specific customer, enter it here.") public var pinCode:String /** * If you want to book with customer information instead of the Customer Id send the customer information here. Note: If customer profile already exists with the same email the information will not be changed, instead the provided information will be added as BookingsComments if it differs from the ordinairy profile. */ // @ApiMember(Description="If you want to book with customer information instead of the Customer Id send the customer information here. Note: If customer profile already exists with the same email the information will not be changed, instead the provided information will be added as BookingsComments if it differs from the ordinairy profile. ") public var customer:CustomerToHandle /** * The service to be booked */ // @ApiMember(Description="The service to be booked", IsRequired=true) public var serviceId:Int /** * If you want to add comments to a booking you can add them here, this comments are never shared with the customer */ // @ApiMember(Description="If you want to add comments to a booking you can add them here, this comments are never shared with the customer") public var bookedComments:String /** * If you want to add comments to the booking that is sent to the customer, you can add them here. Comments will be sent in the booking confirmation */ // @ApiMember(Description="If you want to add comments to the booking that is sent to the customer, you can add them here. Comments will be sent in the booking confirmation") public var commentsToCustomer:String public var resources:[ResourceToBook] = [] /** * Rebate codes applied to booking */ // @ApiMember(Description="Rebate codes applied to booking") public var rebateCodeIds:[Int] = [] /** * If you want to send Email reminder */ // @ApiMember(Description="If you want to send Email reminder") public var sendEmailReminder:Bool? /** * If you want to send SMS reminder */ // @ApiMember(Description="If you want to send SMS reminder") public var sendSmsReminder:Bool? /** * If you want to send SMS confirmation */ // @ApiMember(Description="If you want to send SMS confirmation") public var sendSmsConfirmation:Bool? /** * Only admins are allowed to not send an email confirmation. Default is true */ // @ApiMember(Description="Only admins are allowed to not send an email confirmation. Default is true") public var sendEmailConfirmation:Bool? /** * If payment is enabled and you're an administrator, optional to choose payment option, if empty then the default settings will be used. Following payment options exists. DefaultSetting = 0, BookWithoutPayment = 1 (will be direcyly booked without payment), BookWithPaymentMessageToCustomer = 2 (will set status AwaitingPayment and send payment instructions to customer), BookWithManualPayment = 3 (Will set status AwaitingPaymentNoTimeLimit and Admin will need to manually mark the booking as payed when recieved payment). */ // @ApiMember(Description="If payment is enabled and you're an administrator, optional to choose payment option, if empty then the default settings will be used. Following payment options exists. DefaultSetting = 0, BookWithoutPayment = 1 (will be direcyly booked without payment), BookWithPaymentMessageToCustomer = 2 (will set status AwaitingPayment and send payment instructions to customer), BookWithManualPayment = 3 (Will set status AwaitingPaymentNoTimeLimit and Admin will need to manually mark the booking as payed when recieved payment).") public var paymentOption:PaymentOptions /** * If Custom Fields are added to the booking, here you will send the id and the value for each custom field to be saved */ // @ApiMember(Description="If Custom Fields are added to the booking, here you will send the id and the value for each custom field to be saved") public var customFields:[AddCustomField] = [] /** * If Custom Fields are added to the customer, here you will send the id and the value for each custom field to be updated */ // @ApiMember(Description="If Custom Fields are added to the customer, here you will send the id and the value for each custom field to be updated") public var customerCustomFields:[AddCustomField] = [] /** * If want to allow to book outside the service schedules. This means you can book a time after the schedule opening hours as long as the resource are available. This is only allowed by administrators */ // @ApiMember(Description="If want to allow to book outside the service schedules. This means you can book a time after the schedule opening hours as long as the resource are available. This is only allowed by administrators") public var allowBookingOutsideSchedules:Bool required public init(){} } public protocol IInterval { var from:Date { get set } var to:Date { get set } } public class FailedBookings : Codable { public var from:Date public var to:Date public var reason:String /** * Set the number of spots you want to book. You add number of spots per price category. Multiple spots require that the service has GroupBooking enabled. Default is one spot. */ // @ApiMember(Description="Set the number of spots you want to book. You add number of spots per price category. Multiple spots require that the service has GroupBooking enabled. Default is one spot.") public var quantities:[QuantityToBook] = [] required public init(){} } public class BookingQueryResponse : Codable { public var id:Int public var companyId:String public var from:Date public var to:Date public var status:BookingStatusEnum public var statusId:Int public var statusName:String public var statusInfo:BookingStatusQueryResponse public var sendEmailReminder:Bool public var sendSmsReminder:Bool public var sendSmsConfirmation:Bool public var sendEmailConfirmation:Bool public var lastTimeToUnBook:Date? public var customFields:[CustomFieldConfigData] = [] public var customFieldValues:[CustomFieldDataResponse] = [] public var bookedResourceTypes:[BookedResourceType] = [] public var company:BookedCompany public var customer:BookedCustomer public var quantities:[BookedQuantity] = [] public var service:ServiceInfoResponse public var paymentExpiration:Date? public var log:[BookingLogQueryResponse] = [] public var paymentLog:[BookingPaymentLogQueryResponse] = [] public var checkoutLog:[BookingCheckoutQueryResponse] = [] public var externalReference:[ExternalReferenceResponse] = [] public var responseStatus:ResponseStatus public var calendarExportStatus:BookingCalendarExportStatus public var lengthInMinutes:Int? public var bookedBy:String public var bookedComments:String public var unbookedComments:String public var commentsToCustomer:String public var createdDate:Date public var updatedDate:Date public var unbookedOn:Date? public var cancellationCode:String public var ratingCode:String required public init(){} }