# Generated by Django 4.2.7 on 2025-08-19 10:27

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='JobPosting',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(max_length=200)),
                ('description', models.TextField()),
                ('requirements', models.TextField()),
                ('location', models.CharField(max_length=200)),
                ('application_deadline', models.DateTimeField()),
                ('status', models.CharField(choices=[('draft', 'Draft'), ('published', 'Published'), ('closed', 'Closed'), ('archived', 'Archived')], default='draft', max_length=20)),
                ('salary_range', models.CharField(blank=True, max_length=100)),
                ('employment_type', models.CharField(choices=[('full_time', 'Full Time'), ('part_time', 'Part Time'), ('contract', 'Contract'), ('internship', 'Internship')], default='full_time', max_length=50)),
                ('experience_level', models.CharField(choices=[('entry', 'Entry Level'), ('mid', 'Mid Level'), ('senior', 'Senior Level'), ('executive', 'Executive')], default='mid', max_length=50)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('posted_by', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='job_postings', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'ordering': ['-created_at'],
            },
        ),
        migrations.CreateModel(
            name='Application',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('applicant_name', models.CharField(max_length=200)),
                ('applicant_email', models.EmailField(max_length=254)),
                ('applicant_phone', models.CharField(max_length=20)),
                ('membership_number', models.CharField(blank=True, max_length=50, null=True)),
                ('cover_letter', models.TextField()),
                ('resume', models.FileField(upload_to=jobs.models.application_file_path)),
                ('additional_documents', models.FileField(blank=True, null=True, upload_to=jobs.models.application_file_path)),
                ('status', models.CharField(choices=[('submitted', 'Submitted'), ('under_review', 'Under Review'), ('shortlisted', 'Shortlisted'), ('interviewed', 'Interviewed'), ('accepted', 'Accepted'), ('rejected', 'Rejected')], default='submitted', max_length=20)),
                ('submitted_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('admin_notes', models.TextField(blank=True)),
                ('job', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='applications', to='jobs.jobposting')),
                ('user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='applications', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'ordering': ['-submitted_at'],
            },
        ),
        migrations.AddIndex(
            model_name='jobposting',
            index=models.Index(fields=['status', 'application_deadline'], name='jobs_jobpos_status_75fddf_idx'),
        ),
        migrations.AddIndex(
            model_name='jobposting',
            index=models.Index(fields=['posted_by'], name='jobs_jobpos_posted__6dc327_idx'),
        ),
        migrations.AddIndex(
            model_name='jobposting',
            index=models.Index(fields=['created_at'], name='jobs_jobpos_created_d079a9_idx'),
        ),
        migrations.AddIndex(
            model_name='application',
            index=models.Index(fields=['job', 'status'], name='jobs_applic_job_id_a25382_idx'),
        ),
        migrations.AddIndex(
            model_name='application',
            index=models.Index(fields=['applicant_email'], name='jobs_applic_applica_eecbcb_idx'),
        ),
        migrations.AddIndex(
            model_name='application',
            index=models.Index(fields=['membership_number'], name='jobs_applic_members_b69d7a_idx'),
        ),
        migrations.AddIndex(
            model_name='application',
            index=models.Index(fields=['submitted_at'], name='jobs_applic_submitt_cd5fcd_idx'),
        ),
        migrations.AlterUniqueTogether(
            name='application',
            unique_together={('job', 'applicant_email')},
        ),
    ]
