""" Options: Date: 2024-07-03 12:58:37 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: TestRecurringSchedule.* #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 class ICompany: company_id: 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 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 BaseModel: pass @dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE) @dataclass class CustomFieldValue(BaseModel): # @Required() company_id: Optional[str] = None id: int = 0 # @Required() value: Optional[str] = None # @Required() active: bool = False sort_order: Optional[int] = None modified_date: Optional[datetime.datetime] = None @dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE) @dataclass class CustomField(BaseModel): # @Required() table: Optional[str] = None # @Required() column: Optional[str] = None # @Required() data_type: Optional[str] = None # @Required() description: Optional[str] = None # @Required() active: bool = False modified_date: Optional[datetime.datetime] = None id: int = 0 @dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE) @dataclass class RegEx(BaseModel): # @Required() name: Optional[str] = None # @Required() description: Optional[str] = None # @Required() reg_ex_code: Optional[str] = None error_message: Optional[str] = None modified_date: Optional[datetime.datetime] = None id: int = 0 @dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE) @dataclass class CustomFieldServiceRelation(BaseModel): # @Required() company_id: Optional[str] = None id: int = 0 # @Required() custom_field_config_id: int = 0 # @Required() service_id: int = 0 modified_date: Optional[datetime.datetime] = None @dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE) @dataclass class CustomFieldConfig(BaseModel): # @Ignore() values: Optional[List[CustomFieldValue]] = None custom_field: Optional[CustomField] = None # @Ignore() reg_ex: Optional[RegEx] = None # @Ignore() services: Optional[List[Service]] = None custom_field_service_relation: Optional[List[CustomFieldServiceRelation]] = None # @Required() company_id: Optional[str] = None id: int = 0 group_id: Optional[int] = None # @Required() field_id: int = 0 # @Required() icon_id: int = 0 reg_ex_id: Optional[int] = None # @Required() name: Optional[str] = None # @Required() description: Optional[str] = None # @Required() datatype: Optional[str] = None # @Required() max_length: int = 0 # @Required() is_public: bool = False # @Required() is_hidden: bool = False # @Required() is_mandatory: bool = False default_value: Optional[str] = None reg_ex_error_message: Optional[str] = None mandatory_error_message: Optional[str] = None width: Optional[int] = None # @Required() multiple_line_text: bool = False modified_date: Optional[datetime.datetime] = None class ITimeException(IInterval): id: int = 0 reason_text: Optional[str] = None is_block: bool = False reason_text_public: Optional[str] = None is_recurring: bool = False resource_ids: Optional[List[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 class IBookedTime(IInterval): id: int = 0 service_id: int = 0 booked_spots: int = 0 total_spots: int = 0 pause_after_in_minutes: int = 0 status: Optional[BookingStatusEnum] = None status_id: int = 0 customer: Optional[BookedCustomer] = None @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 Resource(BaseModel, ICustomFieldTable, IBaseModelCreated, IBaseModelUpdated): # @Ignore() priority: int = 0 # @Ignore() schedules: Optional[IList[ISchedule]] = None # @Ignore() exceptions: Optional[IList[ITimeException]] = None # @Ignore() bookings: Optional[IList[IBookedTime]] = None # @Ignore() custom_fields_config: Optional[IList[CustomFieldConfig]] = None # @Ignore() custom_fields_data: Optional[IList[CustomFieldDataResponse]] = None # @Required() company_id: Optional[str] = None id: int = 0 # @Required() name: Optional[str] = None # @Required() active: bool = False description: Optional[str] = None image_url: Optional[str] = None # @Required() updated_date: datetime.datetime = datetime.datetime(1, 1, 1) # @Required() created_date: datetime.datetime = datetime.datetime(1, 1, 1) # @Required() color: Optional[str] = None email: Optional[str] = None mobile_phone: Optional[str] = None email_notification: Optional[bool] = None sms_notification: Optional[bool] = None # @Required() send_s_m_s_reminder: bool = False # @Required() send_email_reminder: bool = False modified_date: Optional[datetime.datetime] = None access_group: Optional[str] = None text_field1: Optional[str] = None text_field2: Optional[str] = None text_field3: Optional[str] = None text_field4: Optional[str] = None text_field5: Optional[str] = None text_field6: Optional[str] = None text_field7: Optional[str] = None text_field8: Optional[str] = None text_field9: Optional[str] = None text_field10: Optional[str] = None text_field11: Optional[str] = None text_field12: Optional[str] = None text_field13: Optional[str] = None text_field14: Optional[str] = None text_field15: Optional[str] = None text_field16: Optional[str] = None text_field17: Optional[str] = None text_field18: Optional[str] = None text_field19: Optional[str] = None text_field20: Optional[str] = None class ScheduleType(str, Enum): NOT_DEFINED = 'NotDefined' RECURRING_SCHEDULE = 'RecurringSchedule' DATE_SCHEDULE = 'DateSchedule' class ISchedule: resources: Optional[IList[Resource]] = None type: Optional[ScheduleType] = None active: bool = False is_resource_specific: bool = False @dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE) @dataclass class AddRecurringScheduleDate: # @ApiMember(Description="The date for the schedule opening (only date part is used here", IsRequired=true) date: datetime.datetime = datetime.datetime(1, 1, 1) """ The date for the schedule opening (only date part is used here """ # @ApiMember(Description="The time for the schedule opening hours (starttime)", IsRequired=true) start_time: datetime.timedelta = datetime.timedelta() """ The time for the schedule opening hours (starttime) """ # @ApiMember(Description="The time for the schedule opening hours (endtime)", IsRequired=true) end_time: datetime.timedelta = datetime.timedelta() """ The time for the schedule opening hours (endtime) """ @dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE) @dataclass class ScheduleException: start_time: datetime.timedelta = datetime.timedelta() end_time: datetime.timedelta = datetime.timedelta() @dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE) @dataclass class AddScheduleService: # @ApiMember(Description="The service id", IsRequired=true) id: int = 0 """ The service id """ @dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE) @dataclass class ExceptionText: reason: Optional[str] = None reason_public: Optional[str] = None @dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE) @dataclass class AvailableTimesSum(IAvailableTime): from_: datetime.datetime = field(metadata=config(field_name='from'), default=datetime.datetime(1, 1, 1)) to: datetime.datetime = datetime.datetime(1, 1, 1) free: int = 0 free_spots: int = 0 exception_texts: Optional[List[ExceptionText]] = None class ICustomFieldTable: custom_fields_config: Optional[IList[CustomFieldConfig]] = None custom_fields_data: Optional[IList[CustomFieldDataResponse]] = None text_field1: Optional[str] = None text_field2: Optional[str] = None text_field3: Optional[str] = None text_field4: Optional[str] = None text_field5: Optional[str] = None text_field6: Optional[str] = None text_field7: Optional[str] = None text_field8: Optional[str] = None text_field9: Optional[str] = None text_field10: Optional[str] = None text_field11: Optional[str] = None text_field12: Optional[str] = None text_field13: Optional[str] = None text_field14: Optional[str] = None text_field15: Optional[str] = None text_field16: Optional[str] = None text_field17: Optional[str] = None text_field18: Optional[str] = None text_field19: Optional[str] = None text_field20: Optional[str] = None class IBaseModelUpdated: updated_date: datetime.datetime = datetime.datetime(1, 1, 1) class IBaseModelCreated: created_date: datetime.datetime = datetime.datetime(1, 1, 1) class IAvailableTime(IInterval): free: int = 0 @dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE) @dataclass class AvailableTimesResponse: company_id: Optional[str] = None service_id: int = 0 times_free_text_single: Optional[str] = None times_free_text_multiple: Optional[str] = None times: Optional[List[AvailableTimesSum]] = None # @Route("/schedules/recurring/test", "POST") # @ApiResponse(Description="You were unauthorized to call this service", StatusCode=401) # @ValidateRequest(Validator="IsAuthenticated") @dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE) @dataclass class TestRecurringSchedule(IReturn[AvailableTimesResponse], ICompany, IInterval): # @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(DataType="dateTime", Description="From what datetime to show available times", IsRequired=true, ParameterType="query") from_: datetime.datetime = field(metadata=config(field_name='from'), default=datetime.datetime(1, 1, 1)) """ From what datetime to show available times """ # @ApiMember(DataType="dateTime", Description="To what datetime to show available times", IsRequired=true, ParameterType="query") to: datetime.datetime = datetime.datetime(1, 1, 1) """ To what datetime to show available times """ # @ApiMember(Description="The Service Duration to be faked if there is no Service selected") duration: Optional[int] = None """ The Service Duration to be faked if there is no Service selected """ # @ApiMember(Description="Time interval for available times. Here you set the interval at which times should appear. For example, if you select the range 15minutes, and your service has an duration of 1 hour and opening hours are 9AM to 6PM you will see the following suggested times: 09AM-10PM 09:15AM-10:15PM, 09:30AM-10:30PM , ..... 04:45PM-05:45, 05:00PM-06:00PM", IsRequired=true) time_interval: int = 0 """ Time interval for available times. Here you set the interval at which times should appear. For example, if you select the range 15minutes, and your service has an duration of 1 hour and opening hours are 9AM to 6PM you will see the following suggested times: 09AM-10PM 09:15AM-10:15PM, 09:30AM-10:30PM , ..... 04:45PM-05:45, 05:00PM-06:00PM """ # @ApiMember(Description="Allow bookings end time exceeds the opening hours Here you can choose whether it should be possible to make a reservation exceeding the opening hours. This should be ticked when a service duration is longer than 24 hours (possible to book over midnight).", IsRequired=true) enable_booking_until_closing_time: bool = False """ Allow bookings end time exceeds the opening hours Here you can choose whether it should be possible to make a reservation exceeding the opening hours. This should be ticked when a service duration is longer than 24 hours (possible to book over midnight). """ # @ApiMember(Description="The timestamp to which the schedule is valid from", IsRequired=true) valid_from: datetime.datetime = datetime.datetime(1, 1, 1) """ The timestamp to which the schedule is valid from """ # @ApiMember(Description="The timestamp to which the schedule is valid to", IsRequired=true) valid_to: datetime.datetime = datetime.datetime(1, 1, 1) """ The timestamp to which the schedule is valid to """ # @ApiMember(Description="The time for the schedule opening hours (starttime)", IsRequired=true) start_time: datetime.timedelta = datetime.timedelta() """ The time for the schedule opening hours (starttime) """ # @ApiMember(Description="The time for the schedule opening hours (endtime)", IsRequired=true) end_time: datetime.timedelta = datetime.timedelta() """ The time for the schedule opening hours (endtime) """ # @ApiMember(Description="The number of days the schedule is valid from todays date", IsRequired=true) number_of_schedule_days: int = 0 """ The number of days the schedule is valid from todays date """ # @ApiMember(Description="If recurring, an array indicating which days of the week the schedule recures on where 1 = Monday .. 7 = Sunday. When recurring then the time portion of the Fields From and To indicates the time of day the recurrence occurs") days_of_week: Optional[List[int]] = None """ If recurring, an array indicating which days of the week the schedule recures on where 1 = Monday .. 7 = Sunday. When recurring then the time portion of the Fields From and To indicates the time of day the recurrence occurs """ # @ApiMember(Description="If not recuring, an array indicating which dates that are open for the schedule.") schedule_dates: Optional[List[AddRecurringScheduleDate]] = None """ If not recuring, an array indicating which dates that are open for the schedule. """ # @ApiMember(Description="Schedule exceptions. For example closed on lunch time between 12AM and 1PM. These times will be removed from the recurring schedule.") exceptions: Optional[List[ScheduleException]] = None """ Schedule exceptions. For example closed on lunch time between 12AM and 1PM. These times will be removed from the recurring schedule. """ # @ApiMember() services: Optional[List[AddScheduleService]] = None # @ApiMember() resources: Optional[List[Resource]] = None