""" Options: Date: 2024-12-03 18:39:05 Version: 8.23 Tip: To override a DTO option, remove "#" prefix before updating BaseUrl: https://api.bokamera.se #GlobalNamespace: #AddServiceStackTypes: True #AddResponseStatus: False #AddImplicitVersion: #AddDescriptionAsComments: True IncludeTypes: CreateBooking.* #ExcludeTypes: #DefaultImports: datetime,decimal,marshmallow.fields:*,servicestack:*,typing:*,dataclasses:dataclass/field,dataclasses_json:dataclass_json/LetterCase/Undefined/config,enum:Enum/IntEnum #DataClass: #DataClassJson: """ import datetime import decimal from marshmallow.fields import * from servicestack import * from typing import * from dataclasses import dataclass, field from dataclasses_json import dataclass_json, LetterCase, Undefined, config from enum import Enum, IntEnum @dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE) @dataclass class BookingStatusQueryResponse: id: int = 0 name: Optional[str] = None description: Optional[str] = None icon: Optional[str] = None color: Optional[str] = None class BookingStatusEnum(IntEnum): BOOKED = 1 UNBOOKED = 2 RESERVED = 3 CANCELED = 4 AWAITING_PAYMENT = 5 AWAITING_PAYMENT_NO_TIME_LIMIT = 6 PAYED = 7 AWAITING_PAYMENT_REQUEST_FROM_ADMIN = 8 AWAITING_PAYMENT_FROM_PROVIDER = 9 INVOICED = 10 @dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE) @dataclass class AddCustomField: id: int = 0 value: Optional[str] = None class PaymentOptions(str, Enum): DEFAULT_SETTING = 'DefaultSetting' BOOK_WITHOUT_PAYMENT = 'BookWithoutPayment' BOOK_WITH_PAYMENT_MESSAGE_TO_CUSTOMER = 'BookWithPaymentMessageToCustomer' BOOK_WITH_MANUAL_PAYMENT = 'BookWithManualPayment' @dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE) @dataclass class CustomerToHandle: customer_id: Optional[str] = None firstname: Optional[str] = None lastname: Optional[str] = None email: Optional[str] = None phone: Optional[str] = None subscribed_to_newsletter: bool = False @dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE) @dataclass class ResourceToBook: resource_type_id: int = 0 resource_id: int = 0 @dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE) @dataclass class CreateBookingBase: # @ApiMember(Description="The company id, if empty will use the company id for the user you are logged in with.") company_id: Optional[str] = None """ The company id, if empty will use the company id for the user you are logged in with. """ # @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.") customer_id: Optional[str] = None """ 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 company requires to be authenticated or a pin code entered to book on a specific customer, enter it here.") pin_code: Optional[str] = None """ If company requires to be authenticated or a pin code entered to book on a specific customer, enter it here. """ # @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. ") customer: Optional[CustomerToHandle] = None """ 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="The service to be booked", IsRequired=true) service_id: int = 0 """ The service to be booked """ # @ApiMember(Description="If you want to add comments to a booking you can add them here, this comments are never shared with the customer") booked_comments: Optional[str] = None """ 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 the booking that is sent to the customer, you can add them here. Comments will be sent in the booking confirmation") comments_to_customer: Optional[str] = None """ 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 """ resources: Optional[List[ResourceToBook]] = None # @ApiMember(Description="Rebate codes applied to booking") rebate_code_ids: Optional[List[int]] = None """ Rebate codes applied to booking """ # @ApiMember(Description="If you want to send Email reminder") send_email_reminder: Optional[bool] = None """ If you want to send Email reminder """ # @ApiMember(Description="If you want to send SMS reminder") send_sms_reminder: Optional[bool] = None """ If you want to send SMS reminder """ # @ApiMember(Description="If you want to send SMS confirmation") send_sms_confirmation: Optional[bool] = None """ If you want to send SMS confirmation """ # @ApiMember(Description="Only admins are allowed to not send an email confirmation. Default is true") send_email_confirmation: Optional[bool] = None """ Only admins are allowed to not send an email confirmation. Default is true """ # @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).") payment_option: Optional[PaymentOptions] = None """ 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 Custom Fields are added to the booking, here you will send the id and the value for each custom field to be saved") custom_fields: Optional[List[AddCustomField]] = None """ 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 customer, here you will send the id and the value for each custom field to be updated") customer_custom_fields: Optional[List[AddCustomField]] = None """ 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 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") allow_booking_outside_schedules: bool = False """ 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 """ class IInterval: from_: datetime.datetime = field(metadata=config(field_name='from'), default=datetime.datetime(1, 1, 1)) to: datetime.datetime = datetime.datetime(1, 1, 1) @dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE) @dataclass class GroupBookingSettings: active: bool = False min: int = 0 max: int = 0 @dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE) @dataclass class MultipleResourceSettings: active: bool = False min: int = 0 max: int = 0 @dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE) @dataclass class ServiceInfoResponse: id: int = 0 name: Optional[str] = None description: Optional[str] = None image_url: Optional[str] = None length_in_minutes: Optional[int] = None max_number_of_spots_per_booking: int = 0 min_number_of_spots_per_booking: int = 0 group_booking: Optional[GroupBookingSettings] = None multiple_resource: Optional[MultipleResourceSettings] = None is_group_booking: bool = False is_payment_enabled: bool = False @dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE) @dataclass class CustomFieldValueResponse: value: Optional[str] = None @dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE) @dataclass class CustomFieldConfigData: # @ApiMember(Description="Custom field id") id: int = 0 """ Custom field id """ # @ApiMember(Description="Configuration name. Example: 'Number of persons'.") name: Optional[str] = None """ Configuration name. Example: 'Number of persons'. """ # @ApiMember(Description="Custom field description. Example: 'For how many persons is this booking?'") description: Optional[str] = None """ Custom field description. Example: 'For how many persons is this booking?' """ # @ApiMember(Description="Field width. Example: 20 for 20px") width: Optional[int] = None """ Field width. Example: 20 for 20px """ # @ApiMember(Description="Data field of custom field. Valid values are: TextBox, ... Example: 'TextBox'") data_type: Optional[str] = None """ Data field of custom field. Valid values are: TextBox, ... Example: 'TextBox' """ # @ApiMember(Description="Default value of the field. Example: '3'") default_value: Optional[str] = None """ Default value of the field. Example: '3' """ # @ApiMember(Description="Determines if the field is required to have a value or not") is_mandatory: bool = False """ Determines if the field is required to have a value or not """ # @ApiMember(Description="Error message shown to the user if the field data is required but not entered") mandatory_error_message: Optional[str] = None """ Error message shown to the user if the field data is required but not entered """ # @ApiMember(Description="Max lenght of the field") max_length: int = 0 """ Max lenght of the field """ # @ApiMember(Description="If the field should have multiple lines") multiple_line_text: bool = False """ If the field should have multiple lines """ # @ApiMember(Description="Regular expression used for validation of the field") reg_ex: Optional[str] = None """ Regular expression used for validation of the field """ # @ApiMember(Description="Error message shown if the regular expression validation failed") reg_ex_error_message: Optional[str] = None """ Error message shown if the regular expression validation failed """ # @ApiMember(Description="The values to select from if Datatype is DropDown for this custom field") values: Optional[List[CustomFieldValueResponse]] = None """ The values to select from if Datatype is DropDown for this custom field """ @dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE) @dataclass class CustomFieldDataResponse: id: int = 0 column: Optional[str] = None name: Optional[str] = None description: Optional[str] = None value: Optional[str] = None # @ApiMember(Description="Data field of custom field. Valid values are: TextBox, ... Example: 'TextBox'") data_type: Optional[str] = None """ Data field of custom field. Valid values are: TextBox, ... Example: 'TextBox' """ @dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE) @dataclass class BookedResource: id: int = 0 name: Optional[str] = None color: Optional[str] = None image_url: Optional[str] = None email: Optional[str] = None mobile_phone: Optional[str] = None access_group: Optional[str] = None email_notification: bool = False sms_notification: bool = False email_reminder: bool = False sms_reminder: bool = False @dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE) @dataclass class BookedResourceType: # @ApiMember(Description="The resource type id") id: int = 0 """ The resource type id """ # @ApiMember(Description="The resource type name") name: Optional[str] = None """ The resource type name """ # @ApiMember(Description="The resources inside resource type") resources: Optional[List[BookedResource]] = None """ The resources inside resource type """ @dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE) @dataclass class BookedCompany: id: Optional[str] = None name: Optional[str] = None logo_type: Optional[str] = None category: Optional[str] = None street1: Optional[str] = None street2: Optional[str] = None zip_code: Optional[str] = None city: Optional[str] = None country_id: Optional[str] = None longitude: Optional[str] = None latitude: Optional[str] = None phone: Optional[str] = None email: Optional[str] = None home_page: Optional[str] = None site_path: Optional[str] = None is_favorite: bool = False payment_provider_id: Optional[int] = None @dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE) @dataclass class BookedCustomer: id: Optional[str] = None firstname: Optional[str] = None lastname: Optional[str] = None email: Optional[str] = None phone: Optional[str] = None facebook_user_name: Optional[str] = None image_url: Optional[str] = None corporate_identity_number: Optional[str] = None invoice_address1: Optional[str] = None invoice_address2: Optional[str] = None invoice_city: Optional[str] = None invoice_postal_code: Optional[str] = None invoice_country_code: Optional[str] = None @dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE) @dataclass class CurrencyInfoResponse: # @ApiMember(Description="The currency id") id: Optional[str] = None """ The currency id """ # @ApiMember(Description="The currency id") name: Optional[str] = None """ The currency id """ # @ApiMember(Description="The currency id") currency_sign: Optional[str] = None """ The currency id """ @dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE) @dataclass class BookingPaymentLogQueryResponse: # @ApiMember(Description="The booking payment log id") id: int = 0 """ The booking payment log id """ # @ApiMember(Description="The booking id") booking_id: int = 0 """ The booking id """ # @ApiMember(Description="The payment reference id") payment_reference_id: Optional[str] = None """ The payment reference id """ # @ApiMember(Description="The payment order item reference id") order_item_reference_id: Optional[str] = None """ The payment order item reference id """ # @ApiMember(Description="The payment reference id") payment_provider_id: Optional[int] = None """ The payment reference id """ # @ApiMember(Description="The payment amount") amount: float = 0.0 """ The payment amount """ # @ApiMember(Description="The payment VAT in percent") vat: Decimal = decimal.Decimal(0) """ The payment VAT in percent """ # @ApiMember(Description="The payment amount that is credited") amount_credited: float = 0.0 """ The payment amount that is credited """ # @ApiMember(Description="The payment currency id") currency_id: Optional[str] = None """ The payment currency id """ # @ApiMember(Description="The payment currency info") currency_info: Optional[CurrencyInfoResponse] = None """ The payment currency info """ # @ApiMember(Description="Comments that could be added to the event log item") comments: Optional[str] = None """ Comments that could be added to the event log item """ # @ApiMember(Description="The date when the payment items was created") created: datetime.datetime = datetime.datetime(1, 1, 1) """ The date when the payment items was created """ # @ApiMember(Description="The date when the payment items was update") updated: datetime.datetime = datetime.datetime(1, 1, 1) """ The date when the payment items was update """ @dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE) @dataclass class BookingCheckoutQueryResponse: # @ApiMember(Description="The checkout id") id: Optional[str] = None """ The checkout id """ # @ApiMember(Description="The booking id") booking_id: int = 0 """ The booking id """ # @ApiMember(Description="The purchase id") purchase_id: Optional[int] = None """ The purchase id """ # @ApiMember(Description="The payment checkout expiration datetime") expiration_time: Optional[datetime.datetime] = None """ The payment checkout expiration datetime """ # @ApiMember(Description="The payment snippet code") snippet: Optional[str] = None """ The payment snippet code """ # @ApiMember(Description="The payment status") status: Optional[str] = None """ The payment status """ # @ApiMember(Description="Log message") message: Optional[str] = None """ Log message """ # @ApiMember(Description="When the checkout log item was created") created: datetime.datetime = datetime.datetime(1, 1, 1) """ When the checkout log item was created """ # @ApiMember(Description="When the checkout log item was updated") updated: datetime.datetime = datetime.datetime(1, 1, 1) """ When the checkout log item was updated """ @dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE) @dataclass class ExternalReferenceResponse: company_id: Optional[str] = None id: Optional[str] = None owner_id: Optional[str] = None reference_type: Optional[str] = None external_data: Optional[str] = None created_by: Optional[str] = None updated: datetime.datetime = datetime.datetime(1, 1, 1) created: datetime.datetime = datetime.datetime(1, 1, 1) @dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE) @dataclass class BookingCalendarExportStatus: calendar_id: Optional[str] = None booking_id: int = 0 synced: Optional[bool] = None @dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE) @dataclass class BookingLogQueryResponse: # @ApiMember(Description="The booking log id") id: int = 0 """ The booking log id """ # @ApiMember(Description="The booking id") booking_id: int = 0 """ The booking id """ # @ApiMember(Description="The type of event") event_type_id: int = 0 """ The type of event """ # @ApiMember(Description="The type of event") event_type: Optional[BookingLogEventTypeResponse] = None """ The type of event """ # @ApiMember(Description="Comments that could be added to the event log item") comments: Optional[str] = None """ Comments that could be added to the event log item """ # @ApiMember(Description="The user created the event") user_name: Optional[str] = None """ The user created the event """ # @ApiMember(Description="Then date when the event occured") created: datetime.datetime = datetime.datetime(1, 1, 1) """ Then date when the event occured """ @dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE) @dataclass class BookedQuantity: # @ApiMember(Description="The quantity Id") id: int = 0 """ The quantity Id """ # @ApiMember(Description="The quantity for booked on this price category") quantity: int = 0 """ The quantity for booked on this price category """ # @ApiMember(Description="The price") price: Optional[float] = None """ The price """ # @ApiMember(Description="The price bofore rebate codes") price_before_rebate: Optional[float] = None """ The price bofore rebate codes """ # @ApiMember(Description="The price currency") currency_id: Optional[str] = None """ The price currency """ # @ApiMember(Description="The price sign") price_sign: Optional[str] = None """ The price sign """ # @ApiMember(Description="The price category") category: Optional[str] = None """ The price category """ # @ApiMember(Description="The price VAT in percent") vat: Optional[Decimal] = None """ The price VAT in percent """ # @ApiMember(Description="The price text to display") price_text: Optional[str] = None """ The price text to display """ # @ApiMember(Description="If the quantity you add should occupy a spot. Default is true. If no it will only be a row that includes price information.") occupies_spot: bool = False """ If the quantity you add should occupy a spot. Default is true. If no it will only be a row that includes price information. """ @dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE) @dataclass class BookingQueryResponse: id: int = 0 company_id: Optional[str] = None from_: datetime.datetime = field(metadata=config(field_name='from'), default=datetime.datetime(1, 1, 1)) to: datetime.datetime = datetime.datetime(1, 1, 1) status: Optional[BookingStatusEnum] = None status_id: int = 0 status_name: Optional[str] = None status_info: Optional[BookingStatusQueryResponse] = None send_email_reminder: bool = False send_sms_reminder: bool = False send_sms_confirmation: bool = False send_email_confirmation: bool = False last_time_to_un_book: Optional[datetime.datetime] = None custom_fields: Optional[List[CustomFieldConfigData]] = None custom_field_values: Optional[List[CustomFieldDataResponse]] = None booked_resource_types: Optional[List[BookedResourceType]] = None company: Optional[BookedCompany] = None customer: Optional[BookedCustomer] = None quantities: Optional[List[BookedQuantity]] = None service: Optional[ServiceInfoResponse] = None payment_expiration: Optional[datetime.datetime] = None log: Optional[List[BookingLogQueryResponse]] = None payment_log: Optional[List[BookingPaymentLogQueryResponse]] = None checkout_log: Optional[List[BookingCheckoutQueryResponse]] = None external_reference: Optional[List[ExternalReferenceResponse]] = None response_status: Optional[ResponseStatus] = None calendar_export_status: Optional[BookingCalendarExportStatus] = None length_in_minutes: Optional[int] = None booked_by: Optional[str] = None booked_comments: Optional[str] = None unbooked_comments: Optional[str] = None comments_to_customer: Optional[str] = None created_date: datetime.datetime = datetime.datetime(1, 1, 1) updated_date: datetime.datetime = datetime.datetime(1, 1, 1) unbooked_on: Optional[datetime.datetime] = None cancellation_code: Optional[str] = None rating_code: Optional[str] = None # @Route("/bookings", "POST") # @ApiResponse(Description="You were unauthorized to call this service", StatusCode=401) @dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE) @dataclass class CreateBooking(CreateBookingBase, IReturn[BookingQueryResponse], IInterval): # @ApiMember(Description="The datetime you want to start the booking.", IsRequired=true) from_: datetime.datetime = field(metadata=config(field_name='from'), default=datetime.datetime(1, 1, 1)) """ The datetime you want to start the booking. """ # @ApiMember(Description="The datetime you want to end the booking.", IsRequired=true) to: datetime.datetime = datetime.datetime(1, 1, 1) """ The datetime you want to end the booking. """ # @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.") quantities: Optional[List[QuantityToBook]] = None """ 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. """