# Generated by Django 5.2.9 on 2025-12-09 13:28

import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='Transaction',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('transaction_type', models.CharField(choices=[('deposit', 'Deposit'), ('withdrawal', 'Withdrawal'), ('investment', 'Investment'), ('reward', 'Reward'), ('commission', 'Commission')], max_length=20)),
                ('amount', models.DecimalField(decimal_places=8, max_digits=20)),
                ('status', models.CharField(choices=[('pending', 'Pending'), ('processing', 'Processing'), ('completed', 'Completed'), ('cancelled', 'Cancelled'), ('forfeited', 'Forfeited')], max_length=20)),
                ('balance_before', models.DecimalField(decimal_places=8, max_digits=20)),
                ('balance_after', models.DecimalField(decimal_places=8, max_digits=20)),
                ('blockchain', models.CharField(blank=True, db_index=True, help_text='Blockchain for deposits/withdrawals (e.g., tron, bnb).', max_length=50, null=True)),
                ('transaction_hash', models.CharField(blank=True, db_index=True, max_length=255, null=True)),
                ('data', models.JSONField(blank=True, default=dict)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='transactions', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'db_table': 'transactions',
                'indexes': [models.Index(fields=['user', 'transaction_type'], name='transaction_user_id_9aa2b1_idx'), models.Index(fields=['status', 'created_at'], name='transaction_status_94cf9d_idx'), models.Index(fields=['transaction_type', 'blockchain'], name='transaction_transac_94dc11_idx')],
            },
        ),
    ]
