# Generated by Django 5.2.9 on 2025-12-26 15:05

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


class Migration(migrations.Migration):

    dependencies = [
        ('api', '0103_remove_photo_metadata_fields'),
    ]

    operations = [
        migrations.RemoveField(
            model_name='photostack',
            name='potential_savings',
        ),
        migrations.RemoveField(
            model_name='photostack',
            name='similarity_score',
        ),
        migrations.AlterField(
            model_name='photostack',
            name='stack_type',
            field=models.CharField(choices=[('raw_jpeg', 'RAW + JPEG Pair'), ('burst', 'Burst Sequence'), ('bracket', 'Exposure Bracket'), ('live_photo', 'Live Photo'), ('manual', 'Manual Stack')], db_index=True, default='raw_jpeg', max_length=20),
        ),
        migrations.CreateModel(
            name='Duplicate',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('duplicate_type', models.CharField(choices=[('exact_copy', 'Exact Copies'), ('visual_duplicate', 'Visual Duplicates')], db_index=True, default='visual_duplicate', max_length=20)),
                ('review_status', models.CharField(choices=[('pending', 'Pending Review'), ('resolved', 'Resolved'), ('dismissed', 'Dismissed')], db_index=True, default='pending', max_length=20)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('reviewed_at', models.DateTimeField(blank=True, null=True)),
                ('similarity_score', models.FloatField(blank=True, null=True)),
                ('potential_savings', models.BigIntegerField(default=0)),
                ('trashed_count', models.IntegerField(default=0)),
                ('note', models.TextField(blank=True, null=True)),
                ('kept_photo', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='kept_in_duplicates', to='api.photo')),
                ('owner', models.ForeignKey(on_delete=models.SET(api.models.user.get_deleted_user), related_name='duplicates', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': 'Duplicate',
                'verbose_name_plural': 'Duplicates',
                'ordering': ['-created_at'],
            },
        ),
        migrations.AddField(
            model_name='photo',
            name='duplicates',
            field=models.ManyToManyField(blank=True, related_name='photos', to='api.duplicate'),
        ),
        migrations.AddIndex(
            model_name='duplicate',
            index=models.Index(fields=['owner', 'duplicate_type'], name='api_duplica_owner_i_78a3a4_idx'),
        ),
        migrations.AddIndex(
            model_name='duplicate',
            index=models.Index(fields=['owner', 'review_status'], name='api_duplica_owner_i_039fa3_idx'),
        ),
    ]
