# Generated by Django 5.2.6 on 2025-10-05 09:50

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


class Migration(migrations.Migration):

    dependencies = [
        ('recruitment', '0012_form_formsubmission_uploadedfile'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='FormField',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('label', models.CharField(help_text='Label for the field', max_length=200)),
                ('field_type', models.CharField(choices=[('text', 'Text Input'), ('email', 'Email'), ('phone', 'Phone'), ('textarea', 'Text Area'), ('file', 'File Upload'), ('date', 'Date Picker'), ('select', 'Dropdown'), ('radio', 'Radio Buttons'), ('checkbox', 'Checkboxes')], help_text='Type of the field', max_length=20)),
                ('placeholder', models.CharField(blank=True, help_text='Placeholder text', max_length=200)),
                ('required', models.BooleanField(default=False, help_text='Whether the field is required')),
                ('order', models.PositiveIntegerField(default=0, help_text='Order of the field in the stage')),
                ('is_predefined', models.BooleanField(default=False, help_text='Whether this is a default field')),
                ('options', models.JSONField(blank=True, default=list, help_text='Options for selection fields (stored as JSON array)')),
                ('file_types', models.CharField(blank=True, help_text="Allowed file types (comma-separated, e.g., '.pdf,.doc,.docx')", max_length=200)),
                ('max_file_size', models.PositiveIntegerField(default=5, help_text='Maximum file size in MB (default: 5MB)')),
            ],
            options={
                'verbose_name': 'Form Field',
                'verbose_name_plural': 'Form Fields',
                'ordering': ['order'],
            },
        ),
        migrations.CreateModel(
            name='FormStage',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(help_text='Name of the stage', max_length=200)),
                ('order', models.PositiveIntegerField(default=0, help_text='Order of the stage in the form')),
                ('is_predefined', models.BooleanField(default=False, help_text='Whether this is a default resume stage')),
            ],
            options={
                'verbose_name': 'Form Stage',
                'verbose_name_plural': 'Form Stages',
                'ordering': ['order'],
            },
        ),
        migrations.RemoveField(
            model_name='formsubmission',
            name='form',
        ),
        migrations.RemoveField(
            model_name='uploadedfile',
            name='submission',
        ),
        migrations.AlterModelOptions(
            name='formsubmission',
            options={'ordering': ['-submitted_at'], 'verbose_name': 'Form Submission', 'verbose_name_plural': 'Form Submissions'},
        ),
        migrations.RemoveField(
            model_name='formsubmission',
            name='ip_address',
        ),
        migrations.RemoveField(
            model_name='formsubmission',
            name='submission_data',
        ),
        migrations.RemoveField(
            model_name='formsubmission',
            name='user_agent',
        ),
        migrations.AddField(
            model_name='formsubmission',
            name='applicant_email',
            field=models.EmailField(blank=True, help_text='Email of the applicant', max_length=254),
        ),
        migrations.AddField(
            model_name='formsubmission',
            name='applicant_name',
            field=models.CharField(blank=True, help_text='Name of the applicant', max_length=200),
        ),
        migrations.AddField(
            model_name='formsubmission',
            name='submitted_by',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='form_submissions', to=settings.AUTH_USER_MODEL),
        ),
        migrations.CreateModel(
            name='FieldResponse',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('value', models.JSONField(blank=True, help_text='Response value (stored as JSON)', null=True)),
                ('uploaded_file', models.FileField(blank=True, null=True, upload_to='form_uploads/')),
                ('submission', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='responses', to='recruitment.formsubmission')),
                ('field', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='responses', to='recruitment.formfield')),
            ],
            options={
                'verbose_name': 'Field Response',
                'verbose_name_plural': 'Field Responses',
            },
        ),
        migrations.AddField(
            model_name='formfield',
            name='stage',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='fields', to='recruitment.formstage'),
        ),
        migrations.CreateModel(
            name='FormTemplate',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(help_text='Name of the form template', max_length=200)),
                ('description', models.TextField(blank=True, help_text='Description of the form template')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('is_active', models.BooleanField(default=True, help_text='Whether this template is active')),
                ('created_by', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='form_templates', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': 'Form Template',
                'verbose_name_plural': 'Form Templates',
                'ordering': ['-created_at'],
            },
        ),
        migrations.AddField(
            model_name='formstage',
            name='template',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='stages', to='recruitment.formtemplate'),
        ),
        migrations.AddField(
            model_name='formsubmission',
            name='template',
            field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, related_name='submissions', to='recruitment.formtemplate'),
            preserve_default=False,
        ),
        migrations.CreateModel(
            name='SharedFormTemplate',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('is_public', models.BooleanField(default=False, help_text='Whether this template is publicly available')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('shared_with', models.ManyToManyField(blank=True, related_name='shared_templates', to=settings.AUTH_USER_MODEL)),
                ('template', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='recruitment.formtemplate')),
            ],
            options={
                'verbose_name': 'Shared Form Template',
                'verbose_name_plural': 'Shared Form Templates',
            },
        ),
        migrations.DeleteModel(
            name='Form',
        ),
        migrations.DeleteModel(
            name='UploadedFile',
        ),
    ]
