# Generated by Django 3.2.23 on 2025-11-28 09:19

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


class Migration(migrations.Migration):

    dependencies = [
        ('crm', '0003_banner_project'),
    ]

    operations = [
        migrations.AddField(
            model_name='coupon',
            name='applicable_projects',
            field=models.ManyToManyField(blank=True, related_name='coupons', to='crm.Project', verbose_name='适用项目'),
        ),
        migrations.AddField(
            model_name='coupon',
            name='issue_type',
            field=models.CharField(choices=[('manual', '手动发放'), ('registration', '注册赠送'), ('project', '指定项目')], default='manual', max_length=20, verbose_name='发放类型'),
        ),
        migrations.CreateModel(
            name='StudentCoupon',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('status', models.CharField(choices=[('assigned', '已分配'), ('used', '已使用'), ('expired', '已过期')], default='assigned', max_length=20, verbose_name='状态')),
                ('assigned_at', models.DateTimeField(auto_now_add=True, verbose_name='分配时间')),
                ('used_at', models.DateTimeField(blank=True, null=True, verbose_name='使用时间')),
                ('coupon', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='assignments', to='crm.coupon', verbose_name='优惠券')),
                ('student', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='student_coupons', to='crm.student', verbose_name='学员')),
            ],
            options={
                'verbose_name': '学员优惠券',
                'verbose_name_plural': '学员优惠券',
                'ordering': ['-assigned_at'],
            },
        ),
    ]
