# Generated by Django 6.0.6 on 2026-07-10 10:39

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('candidates', '0009_emailoptout'),
        ('jobs', '0012_linkedinauth'),
        ('pipeline', '0009_shortlist_shortlistitem'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='AICall',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('hunar_call_id', models.CharField(blank=True, db_index=True, default='', max_length=100)),
                ('status', models.CharField(choices=[('QUEUED', 'Queued'), ('DIALING', 'Dialing'), ('IN_PROGRESS', 'In Progress'), ('COMPLETED', 'Completed'), ('NO_ANSWER', 'No Answer'), ('FAILED', 'Failed')], db_index=True, default='QUEUED', max_length=20)),
                ('attempts', models.PositiveSmallIntegerField(default=0)),
                ('started_at', models.DateTimeField(blank=True, null=True)),
                ('ended_at', models.DateTimeField(blank=True, null=True)),
                ('duration', models.PositiveIntegerField(blank=True, help_text='Call length in seconds.', null=True)),
                ('transcript', models.TextField(blank=True, default='')),
                ('summary', models.TextField(blank=True, default='')),
                ('score', models.PositiveSmallIntegerField(blank=True, null=True)),
                ('recommendation', models.CharField(blank=True, choices=[('QUALIFIED', 'Qualified'), ('REVIEW', 'Needs Review'), ('NOT_QUALIFIED', 'Not Qualified')], default='', max_length=20)),
                ('error_message', models.TextField(blank=True, default='')),
                ('agent_variables', models.JSONField(blank=True, default=dict, help_text='Variables sent to the Hunar agent.')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('application', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='ai_calls', to='pipeline.jobapplication')),
                ('candidate', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='ai_calls', to='candidates.candidate')),
                ('created_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='ai_calls_started', to=settings.AUTH_USER_MODEL)),
                ('job', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='ai_calls', to='jobs.jobdescription')),
            ],
            options={
                'db_table': 'ai_calls',
                'ordering': ['-updated_at'],
                'unique_together': {('candidate', 'job')},
            },
        ),
    ]
