# Generated by Django 6.0.5 on 2026-08-06 07:59

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='FormDefinition',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100, verbose_name='表单名称')),
                ('submit_button_text', models.CharField(default='提交', max_length=50, verbose_name='提交按钮文案')),
                ('success_message', models.CharField(default='提交成功，我们会尽快与您联系。', max_length=200, verbose_name='提交成功提示')),
                ('notification_email', models.EmailField(blank=True, max_length=254, verbose_name='通知邮箱')),
            ],
            options={
                'verbose_name': '线索表单',
                'verbose_name_plural': '线索表单',
            },
        ),
        migrations.CreateModel(
            name='FormDefinitionField',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('sort_order', models.IntegerField(blank=True, editable=False, null=True)),
                ('label', models.CharField(max_length=100, verbose_name='字段标签')),
                ('field_key', models.SlugField(help_text='提交数据中使用的 key，例如 name / email / phone', verbose_name='字段标识')),
                ('field_type', models.CharField(choices=[('text', '单行文本'), ('textarea', '多行文本'), ('email', '邮箱'), ('tel', '电话'), ('select', '下拉选择')], default='text', max_length=20, verbose_name='字段类型')),
                ('required', models.BooleanField(default=True, verbose_name='是否必填')),
                ('choices', models.CharField(blank=True, help_text='逗号分隔，仅“下拉选择”类型使用', max_length=255, verbose_name='可选项')),
                ('form', modelcluster.fields.ParentalKey(on_delete=django.db.models.deletion.CASCADE, related_name='fields', to='forms.formdefinition')),
            ],
            options={
                'ordering': ['sort_order'],
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Lead',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('data', models.JSONField(default=dict, verbose_name='提交数据')),
                ('source_url', models.URLField(blank=True, verbose_name='来源页面')),
                ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='提交时间')),
                ('form', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='leads', to='forms.formdefinition', verbose_name='来源表单')),
            ],
            options={
                'verbose_name': '线索',
                'verbose_name_plural': '线索',
                'ordering': ['-created_at'],
            },
        ),
    ]
