# Generated by Django 6.1 on 2026-09-18 03:26

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


class Migration(migrations.Migration):

    dependencies = [
        ('ai', '0001_initial'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='PhotoAnalysis',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('state', models.CharField(choices=[('QUEUED', 'Queued'), ('RUNNING', 'Running'), ('RETRYING', 'Retrying'), ('COMPLETED', 'Completed'), ('FAILED', 'Failed')], default='QUEUED', max_length=20)),
                ('source_path', models.CharField(max_length=200)),
                ('areas_detected', models.JSONField(blank=True, default=list)),
                ('pool_present', models.BooleanField(default=False)),
                ('confidence', models.JSONField(blank=True, default=dict)),
                ('raw_response', models.TextField(blank=True, default='')),
                ('error_code', models.CharField(blank=True, default='', max_length=40)),
                ('attempts', models.PositiveSmallIntegerField(default=0)),
                ('usage', models.JSONField(blank=True, default=dict)),
                ('started_at', models.DateTimeField(blank=True, null=True)),
                ('finished_at', models.DateTimeField(blank=True, null=True)),
                ('requested_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='photo_analyses', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'ordering': ['-created_at'],
                'indexes': [models.Index(fields=['state'], name='ai_analysis_state_idx')],
            },
        ),
    ]
