
    t0=i]                    l    d Z ddlmZ ddlmZ ddlmZ  G d dej                        Z G d de      Z	y	)
z&Django models for wallet transactions.    )annotations)Decimal)modelsc                     e Zd ZdZ ej
                  ddd      Z ej                  dd      Z ej                  dd      Z	 ej
                  d	d
dgd      Z
 ej                  ddd      Z ej                  ddd      Z ej                  dddd      Z ej                   ddd      Z ej$                  ddd      Z ej(                  edd      Z G d d      Zd dZy)!AbstractWalletTransactiona  
    Abstract base model for storing wallet transaction records.
    
    Extend this model if you want to customize the table name or field definitions.
    When you extend this abstract model with a custom db_table, only ONE table
    will be created (your custom table), not the default wallet_transactions table.
    
    Example:
        class CustomWalletTransaction(AbstractWalletTransaction):
            amount = models.DecimalField(max_digits=20, decimal_places=8)
            balance = models.DecimalField(max_digits=20, decimal_places=8)
            
            class Meta:
                db_table = "custom_wallet_trans"  # Only this table will be created
    2   TzBWallet type / point type (e.g., 'credit_balance', 'reward_points'))
max_lengthdb_index	help_textzDInitiator ID - user who performed this transaction (-100 for system))r
   r   zUser ID - owner of the wallet   )cz
Credit/Add)dzDebit/Deductz:Transaction type: 'c' for credit/add, 'd' for debit/deduct)r	   choicesr         zTransaction amount)
max_digitsdecimal_placesr   zBalance after this transactionzGTransaction type code (integer constant, e.g., 1000 for wallet-deposit))r
   nullblankr    zRemarks/description)r   defaultr   zCreation date/time)auto_now_addr
   r   z Additional fields stored as JSON)r   r   r   c                      e Zd ZdZ ej
                  ddg       ej
                  ddg       ej
                  ddg       ej
                  ddg      gZdgZy	)
AbstractWalletTransaction.MetaTuidwtype)fieldscdate
trans_typeiidz-cdateN)__name__
__module____qualname__abstractr   Indexindexesordering     V/home/cursorai/projects/telegram-earn/packages/wallet_utils/src/wallet_utils/models.pyMetar   M   sc    FLL 01FLL 01FLL, 78FLL 01	
 :r)   r+   c                    | j                   j                          d| j                   d| j                   d| j                   S )N z - User )typeupperamountr   r   )selfs    r*   __str__z!AbstractWalletTransaction.__str__W   s7    ))//#$Adkk]!DJJ<xzRRr)   N)returnstr)r!   r"   r#   __doc__r   	CharFieldr   BigIntegerFieldr    r   r.   DecimalFieldr0   balanceIntegerFieldr   	TextFielddescrDateTimeFieldr   	JSONFielddict
extra_datar+   r2   r(   r)   r*   r   r   
   s<     FVE
 !&
 
 XC !&
 
 1C 6$&;<ND
 !V  &F
 "f!!2G
 %$$[	J F'E
 !F  &E
 "!!4J Sr)   r   c                  :    e Zd ZdZ G d dej
                        Zy)WalletTransactiona  
    Concrete model for storing wallet transaction records.
    
    This is the default implementation that creates the 'wallet_transactions' table.
    Use this model directly, or extend AbstractWalletTransaction for custom implementations.
    
    If you extend AbstractWalletTransaction with a custom db_table, only your custom
    table will be created (not this one), as long as you skip running wallet_utils
    migrations or exclude this model from migrations.
    c                      e Zd ZdZy)WalletTransaction.Metawallet_transactionsN)r!   r"   r#   db_tabler(   r)   r*   r+   rD   g   s    (r)   r+   N)r!   r"   r#   r5   r   r+   r(   r)   r*   rB   rB   [   s    	)(-- )r)   rB   N)
r5   
__future__r   decimalr   	django.dbr   Modelr   rB   r(   r)   r*   <module>rK      s3    , "  NS NSb)1 )r)   