# Generated by Django 5.2.1 on 2026-07-23 08:51

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


class Migration(migrations.Migration):

    dependencies = [
        ('certifications', '0002_certificationapplication_payment_kind_and_more'),
    ]

    operations = [
        migrations.CreateModel(
            name='TestingCenter',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=200)),
                ('slug', models.SlugField(blank=True, max_length=220, unique=True)),
                ('address', models.TextField()),
                ('city', models.CharField(max_length=100)),
                ('phone', models.CharField(blank=True, max_length=40)),
                ('email', models.EmailField(blank=True, max_length=254)),
                ('map_url', models.URLField(blank=True, help_text='Google Maps or similar link.')),
                ('directions', models.TextField(blank=True, help_text='How to find the center, parking, what to bring.')),
                ('is_active', models.BooleanField(default=True)),
                ('sort_order', models.PositiveIntegerField(default=0)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
            ],
            options={
                'ordering': ['sort_order', 'city', 'name'],
            },
        ),
        migrations.AddField(
            model_name='certificationapplication',
            name='exam_mode',
            field=models.CharField(blank=True, choices=[('center', 'At testing center (in person)'), ('remote', 'Online remote (live proctor meeting)')], default='', help_text='center = in-person at a testing center; remote = online with live proctor.', max_length=20),
        ),
        migrations.AddField(
            model_name='certificationapplication',
            name='scheduled_at',
            field=models.DateTimeField(blank=True, null=True),
        ),
        migrations.AddField(
            model_name='certificationprogram',
            name='allow_center_exam',
            field=models.BooleanField(default=True, help_text='Candidates may book an in-person slot at a TSN Digital testing center.'),
        ),
        migrations.AddField(
            model_name='certificationprogram',
            name='allow_remote_exam',
            field=models.BooleanField(default=True, help_text='Candidates may take the exam online with a live remote proctor meeting.'),
        ),
        migrations.AlterField(
            model_name='certificationapplication',
            name='status',
            field=models.CharField(choices=[('pending_payment', 'Pending certification fee'), ('paid', 'Paid — schedule your test'), ('awaiting_proctor', 'Proctor unlocked — start exam'), ('in_exam', 'Exam in progress'), ('passed', 'Passed'), ('failed', 'Failed'), ('pending_reattempt_payment', 'Pending reattempt fee'), ('certified', 'Certificate issued')], default='pending_payment', max_length=40),
        ),
        migrations.AlterField(
            model_name='certificationprogram',
            name='require_proctor',
            field=models.BooleanField(default=True, help_text='Exams must be unlocked with a live teacher/consultant code (remote meeting or at the center).'),
        ),
        migrations.AddField(
            model_name='certificationapplication',
            name='testing_center',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='applications', to='certifications.testingcenter'),
        ),
        migrations.CreateModel(
            name='TestScheduleSlot',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('date', models.DateField()),
                ('start_time', models.TimeField()),
                ('end_time', models.TimeField()),
                ('capacity', models.PositiveIntegerField(default=20)),
                ('is_active', models.BooleanField(default=True)),
                ('notes', models.CharField(blank=True, max_length=255)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('center', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='slots', to='certifications.testingcenter')),
                ('program', models.ForeignKey(blank=True, help_text='Leave blank to allow any certification program.', null=True, on_delete=django.db.models.deletion.CASCADE, related_name='schedule_slots', to='certifications.certificationprogram')),
            ],
            options={
                'ordering': ['date', 'start_time'],
            },
        ),
        migrations.AddField(
            model_name='certificationapplication',
            name='schedule_slot',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='bookings', to='certifications.testscheduleslot'),
        ),
        migrations.AddIndex(
            model_name='testscheduleslot',
            index=models.Index(fields=['date', 'center'], name='certificati_date_6f3aa9_idx'),
        ),
    ]
