# Generated by Django 6.0.3 on 2026-03-16 18:03

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='ReferralCommission',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('level', models.PositiveIntegerField(default=1)),
                ('percentage', models.DecimalField(decimal_places=2, default=10.0, max_digits=5)),
                ('is_active', models.BooleanField(default=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
            ],
            options={
                'verbose_name': 'Referral Commission',
                'verbose_name_plural': 'Referral Commissions',
                'ordering': ['level'],
            },
        ),
        migrations.CreateModel(
            name='ReferralEarning',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('amount', models.DecimalField(decimal_places=2, max_digits=15)),
                ('deposit_amount', models.DecimalField(decimal_places=2, default=0, max_digits=15)),
                ('is_credited', models.BooleanField(default=False)),
                ('notes', models.TextField(blank=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('commission', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='referrals.referralcommission')),
                ('referred_user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='referred_user_earnings', to=settings.AUTH_USER_MODEL)),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='user_referral_earnings', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': 'Referral Earning',
                'verbose_name_plural': 'Referral Earnings',
                'ordering': ['-created_at'],
            },
        ),
    ]
