# Generated by Django 5.2 on 2026-01-25 21:52

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


class Migration(migrations.Migration):

    dependencies = [
        ('api', '0267_add_fbp_and_user_agent_to_attribution'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.AddField(
            model_name='taskcredit',
            name='comments',
            field=models.TextField(blank=True, default='', help_text='Optional notes about this credit grant (e.g., reason for compensation, promo details)'),
        ),
        migrations.AddField(
            model_name='userattribution',
            name='referrer_code',
            field=models.CharField(blank=True, default='', help_text='Referral code used at signup (direct referral from another user)', max_length=32),
        ),
        migrations.AddField(
            model_name='userattribution',
            name='signup_template_code',
            field=models.CharField(blank=True, default='', help_text='Template code if user signed up via a shared agent template', max_length=64),
        ),
        migrations.AlterField(
            model_name='taskcredit',
            name='grant_type',
            field=models.CharField(choices=[('Plan', 'Plan'), ('Compensation', 'Compensation'), ('Promo', 'Promo'), ('task_pack', 'Task Pack'), ('referral', 'Referral'), ('referral_shared', 'Referral (Shared Agent)')], default='Plan', help_text='Type of grant for these credits (e.g., PLAN, COMPENSATION, PROMO, TASK_PACK)', max_length=32),
        ),
        migrations.CreateModel(
            name='UserReferral',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('referral_code', models.CharField(db_index=True, help_text='Unique code this user shares to refer others', max_length=12, unique=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='referral', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': 'User Referral',
                'verbose_name_plural': 'User Referrals',
            },
        ),
    ]
