""" Options: Date: 2024-07-03 12:47:48 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: ResourceQuery.* #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 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 TimeException(ITimeException): # @ApiMember(Description="Time exception id") id: int = 0 """ Time exception id """ # @ApiMember(Description="Indicates whether or not the time exception is recurring") is_recurring: bool = False """ Indicates whether or not the time exception is recurring """ # @ApiMember(Description="Indicates whether the time exception is blocking the time or not") is_block: bool = False """ Indicates whether the time exception is blocking the time or not """ # @ApiMember(Description="The reason of the time exception, example: Vacation, doctors appointment, ...") reason_text: Optional[str] = None """ The reason of the time exception, example: Vacation, doctors appointment, ... """ # @ApiMember(Description="The public reason of the time exception, example: Vacation, doctors appointment, ...") reason_text_public: Optional[str] = None """ The public reason of the time exception, example: Vacation, doctors appointment, ... """ # @ApiMember(Description="Time exception start") from_: datetime.datetime = field(metadata=config(field_name='from'), default=datetime.datetime(1, 1, 1)) """ Time exception start """ # @ApiMember(Description="Time exception end") to: datetime.datetime = datetime.datetime(1, 1, 1) """ Time exception end """ # @ApiMember(Description="Resources that owns this exception") resource_ids: Optional[List[int]] = None """ Resources that owns this exception """ @dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE) @dataclass class BookedTime(IBookedTime): # @ApiMember(Description="Booking id") id: int = 0 """ Booking id """ # @ApiMember(Description="The booked service") service_id: int = 0 """ The booked service """ # @ApiMember(Description="Booking start") from_: datetime.datetime = field(metadata=config(field_name='from'), default=datetime.datetime(1, 1, 1)) """ Booking start """ # @ApiMember(Description="Booking end") to: datetime.datetime = datetime.datetime(1, 1, 1) """ Booking end """ # @ApiMember(Description="Number of booked spots") booked_spots: int = 0 """ Number of booked spots """ # @ApiMember(Description="Number of total spots for the service") total_spots: int = 0 """ Number of total spots for the service """ # @ApiMember(Description="The pause after the booking") pause_after_in_minutes: int = 0 """ The pause after the booking """ # @ApiMember(Description="The booking status") status_id: int = 0 """ The booking status """ status: Optional[BookingStatusEnum] = None # @ApiMember(Description="The customer the booking belongs to") customer: Optional[BookedCustomer] = None """ The customer the booking belongs to """ 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) @dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE) @dataclass class ResourceQueryResponse: # @ApiMember(Description="The resource id") id: int = 0 """ The resource id """ # @ApiMember(Description="The resource name") name: Optional[str] = None """ The resource name """ # @ApiMember(Description="The resource description") description: Optional[str] = None """ The resource description """ # @ApiMember(Description="If resource is active or not") active: bool = False """ If resource is active or not """ # @ApiMember(Description="The resource color in scheduler in hexadecimal color code. Example: #00b0f0 for blue.") color: Optional[str] = None """ The resource color in scheduler in hexadecimal color code. Example: #00b0f0 for blue. """ # @ApiMember(Description="The email of the resource") email: Optional[str] = None """ The email of the resource """ # @ApiMember(Description="The image url of the resource") image_url: Optional[str] = None """ The image url of the resource """ # @ApiMember(Description="The mobile phone number of the resource") mobile_phone: Optional[str] = None """ The mobile phone number of the resource """ # @ApiMember(Description="Used by example code locks to know what access group the resource is assigned to") access_group: Optional[str] = None """ Used by example code locks to know what access group the resource is assigned to """ # @ApiMember(Description="If the resource should receive email notification when booked") email_notification: bool = False """ If the resource should receive email notification when booked """ # @ApiMember(Description="If the resource should receive SMS notification when booked") sms_notification: bool = False """ If the resource should receive SMS notification when booked """ # @ApiMember(Description="If the resource should receive email reminders on bookings") send_email_reminder: Optional[bool] = None """ If the resource should receive email reminders on bookings """ # @ApiMember(Description="If the resource should receive SMS reminders on bookings") send_s_m_s_reminder: Optional[bool] = None """ If the resource should receive SMS reminders on bookings """ # @ApiMember(Description="The resource time exceptions") exceptions: Optional[List[TimeException]] = None """ The resource time exceptions """ # @ApiMember(Description="The resource bookings") bookings: Optional[List[BookedTime]] = None """ The resource bookings """ # @ApiMember(Description="Then date when the resource was created") created: datetime.datetime = datetime.datetime(1, 1, 1) """ Then date when the resource was created """ # @ApiMember(Description="Then date when the resource was updated") updated: datetime.datetime = datetime.datetime(1, 1, 1) """ Then date when the resource was updated """ response_status: Optional[ResponseStatus] = None # @Route("/resource", "GET") # @ApiResponse(Description="You were unauthorized to call this service", StatusCode=401) # @ApiResponse(Description="You have too low privilegies to call this service", StatusCode=403) # @ValidateRequest(Validator="IsAuthenticated") @dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE) @dataclass class ResourceQuery(QueryDb2[Resource, ResourceQueryResponse], IReturn[QueryResponse[ResourceQueryResponse]]): # @ApiMember(Description="Enter the company and id you want to see the information for a resource, if blank company id and you are an admin, your company id will be used. If blank id, all resources will be shown ", IsRequired=true, ParameterType="query") company_id: Optional[str] = None """ Enter the company and id you want to see the information for a resource, if blank company id and you are an admin, your company id will be used. If blank id, all resources will be shown """ id: Optional[int] = None active: Optional[bool] = None # @ApiMember(DataType="boolean", Description="If you want to include the exceptions for each resource, only allowed for administrators. Select between what dates in the parameters [ExceptionsQueryFromDate] and [ExceptionsQueryToDate] , if no dates added ", ParameterType="query") include_exceptions: bool = False """ If you want to include the exceptions for each resource, only allowed for administrators. Select between what dates in the parameters [ExceptionsQueryFromDate] and [ExceptionsQueryToDate] , if no dates added """ # @ApiMember(DataType="dateTime", Description="If [IncludeExceptions], choose what from and to date to search exceptions between, if nothing entered i will search from todays date.", ParameterType="query") exceptions_query_from_date: Optional[datetime.datetime] = None """ If [IncludeExceptions], choose what from and to date to search exceptions between, if nothing entered i will search from todays date. """ # @ApiMember(DataType="dateTime", Description="If [IncludeExceptions], choose what from and to date to search exceptions between, if nothing entered i will search to 1 year forward from todays date.", ParameterType="query") exceptions_query_to_date: Optional[datetime.datetime] = None """ If [IncludeExceptions], choose what from and to date to search exceptions between, if nothing entered i will search to 1 year forward from todays date. """ # @ApiMember(DataType="boolean", Description="If you want to include the bookings for each resource, only allowed for administrators. Select between what dates in the parameters [BookingsQueryFromDate] and [BookingsQueryToDate] , if nothing entered i will search to 1 year forward from todays date.", ParameterType="query") include_bookings: bool = False """ If you want to include the bookings for each resource, only allowed for administrators. Select between what dates in the parameters [BookingsQueryFromDate] and [BookingsQueryToDate] , if nothing entered i will search to 1 year forward from todays date. """ # @ApiMember(DataType="dateTime", Description="If [IncludeBookings], choose what from and to date to search bookings between, if nothing entered i will search from todays date.", ParameterType="query") bookings_query_from_date: Optional[datetime.datetime] = None """ If [IncludeBookings], choose what from and to date to search bookings between, if nothing entered i will search from todays date. """ # @ApiMember(DataType="dateTime", Description="If [IncludeBookings], choose what from and to date to search bookings between, if nothing entered i will search to 1 year forward from todays date.", ParameterType="query") bookings_query_to_date: Optional[datetime.datetime] = None """ If [IncludeBookings], choose what from and to date to search bookings between, if nothing entered i will search to 1 year forward from todays date. """