""" Options: Date: 2025-04-04 17:55:28 Version: 5.140 Tip: To override a DTO option, remove "#" prefix before updating BaseUrl: https://api.clubmanagercentral.com #GlobalNamespace: #AddServiceStackTypes: True #AddResponseStatus: False #AddImplicitVersion: #AddDescriptionAsComments: True IncludeTypes: Command.AddMembershipCommandRequest.* #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 CustomAttributeValue: custom_attribute_id: int = 0 custom_attribute_value_id: Optional[int] = None instance_id: Optional[int] = None stored_value: Optional[str] = None type_name: Optional[str] = None read_only: bool = False class PreviousMembershipAction(str, Enum): NOTHING = 'Nothing' RENEWAL = 'Renewal' REPLACES = 'Replaces' ADDITIONAL = 'Additional' DELETE = 'Delete' class OffsetPeriod(str, Enum): DAY = 'Day' WEEK = 'Week' MONTH = 'Month' YEAR = 'Year' class PaymentType(IntEnum): DEPOSIT = 1 MEMBER_PAYMENT = 2 RECURRING = 3 PURCHASE = 4 class PaymentPeriod(str, Enum): SINGLE = 'Single' RECURRING = 'Recurring' class DirectDebitPeriod(IntEnum): DAILY = 0 MONTHLY = 1 QUARTERLY = 2 YEARLY = 3 WEEKLY = 4 SIX_MONTHLY = 5 TWO_WEEKLY = 6 EVERY_FOUR_WEEKS = 7 NONE = -1 class PaymentMethod(IntEnum): UNPAID = 1 CASH = 2 CARD = 3 CHEQUE = 4 RECURRING = 5 FAILED = 6 BACS = 7 ACCOUNT = 8 @dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE) @dataclass class MembershipPayment: name: Optional[str] = None payment_type: Optional[PaymentType] = None amount: Decimal = decimal.Decimal(0) payment_period: Optional[PaymentPeriod] = None direct_debit_period: Optional[DirectDebitPeriod] = None recurring: int = 0 starting_offset: int = 0 starting_offset_period: Optional[OffsetPeriod] = None start_date: Optional[datetime.datetime] = None payment_method: Optional[PaymentMethod] = None auto_recur: Optional[bool] = None pro_rata: Optional[bool] = None pro_rata_amount: Decimal = decimal.Decimal(0) pro_rata_start_date: datetime.datetime = datetime.datetime(1, 1, 1) pro_rata_payment_method: Optional[PaymentMethod] = None pro_rata_add_to_first_payment: Optional[bool] = None charge_per_license: bool = False @dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE) @dataclass class MembershipType: branch_id: Optional[int] = None start_date: Optional[datetime.datetime] = None end_date: Optional[datetime.datetime] = None length: int = 0 length_period: Optional[OffsetPeriod] = None payments: Optional[List[MembershipPayment]] = None add_to_balance: Optional[Decimal] = None sessions_remaining: Optional[int] = None classes_remaining: Optional[int] = None licenses_remaining: Optional[int] = None multi_site_access: bool = False member_limit: int = 0 definition: Optional[str] = None booking_access_only: bool = False class ICommandResult: pass @dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE) @dataclass class AddMembershipResult(ICommandResult): membership_id: int = 0 recurrence_id: Optional[int] = None has_recurring_payments: bool = False # @Route("/api/Command/AddMembershipCommand", "POST") @dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE) @dataclass class AddMembershipCommandRequest(IReturn[AddMembershipResult]): member_id: int = 0 user_id: int = 0 membership_type_id: int = 0 start_date: datetime.datetime = datetime.datetime(1, 1, 1) previous_membership_action: Optional[PreviousMembershipAction] = None externally_created: bool = False is_online_joining: bool = False membership_type: Optional[MembershipType] = None create_recurring_payments_only: bool = False membership_review_attributes: Optional[List[CustomAttributeValue]] = None registration_attributes: Optional[List[CustomAttributeValue]] = None fee_recurrence_disabled: bool = False expired: bool = False end_date: Optional[datetime.datetime] = None referer_member_id: Optional[int] = None promotion_id: Optional[int] = None recurring_amount: Optional[Decimal] = None recurring_start_date: Optional[datetime.datetime] = None payment_method_id: Optional[int] = None booking_id: Optional[int] = None