# Generated by Django 5.2.9 on 2025-12-25 14:15

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', '0099_photo_uuid_primary_key'),
    ]

    operations = [
        migrations.CreateModel(
            name='MetadataEdit',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('field_name', models.CharField(max_length=100)),
                ('old_value', models.JSONField(blank=True, null=True)),
                ('new_value', models.JSONField(blank=True, null=True)),
                ('synced_to_file', models.BooleanField(default=False)),
                ('synced_at', models.DateTimeField(blank=True, null=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
            ],
            options={
                'verbose_name': 'Metadata Edit',
                'verbose_name_plural': 'Metadata Edits',
                'ordering': ['-created_at'],
            },
        ),
        migrations.CreateModel(
            name='MetadataFile',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('file_type', models.CharField(choices=[('xmp', 'XMP Sidecar'), ('json', 'JSON Metadata'), ('exif', 'EXIF Extract'), ('other', 'Other')], default='xmp', max_length=10)),
                ('source', models.CharField(choices=[('original', 'Original Sidecar'), ('software', 'Software Generated'), ('librephotos', 'LibrePhotos Generated'), ('user', 'User Created')], default='original', max_length=20)),
                ('priority', models.IntegerField(default=0)),
                ('creator_software', models.CharField(blank=True, max_length=100, null=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
            ],
            options={
                'verbose_name': 'Metadata File',
                'verbose_name_plural': 'Metadata Files',
                'ordering': ['-priority', '-updated_at'],
            },
        ),
        migrations.CreateModel(
            name='PhotoMetadata',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('aperture', models.FloatField(blank=True, db_index=True, null=True)),
                ('shutter_speed', models.CharField(blank=True, max_length=20, null=True)),
                ('shutter_speed_seconds', models.FloatField(blank=True, null=True)),
                ('iso', models.IntegerField(blank=True, db_index=True, null=True)),
                ('focal_length', models.FloatField(blank=True, null=True)),
                ('focal_length_35mm', models.IntegerField(blank=True, null=True)),
                ('exposure_compensation', models.FloatField(blank=True, null=True)),
                ('flash_fired', models.BooleanField(blank=True, null=True)),
                ('metering_mode', models.CharField(blank=True, max_length=50, null=True)),
                ('white_balance', models.CharField(blank=True, max_length=50, null=True)),
                ('camera_make', models.CharField(blank=True, db_index=True, max_length=100, null=True)),
                ('camera_model', models.CharField(blank=True, db_index=True, max_length=100, null=True)),
                ('lens_make', models.CharField(blank=True, max_length=100, null=True)),
                ('lens_model', models.CharField(blank=True, db_index=True, max_length=100, null=True)),
                ('serial_number', models.CharField(blank=True, max_length=100, null=True)),
                ('width', models.IntegerField(blank=True, null=True)),
                ('height', models.IntegerField(blank=True, null=True)),
                ('orientation', models.IntegerField(blank=True, null=True)),
                ('color_space', models.CharField(blank=True, max_length=50, null=True)),
                ('bit_depth', models.IntegerField(blank=True, null=True)),
                ('date_taken', models.DateTimeField(blank=True, db_index=True, null=True)),
                ('date_taken_subsec', models.CharField(blank=True, max_length=10, null=True)),
                ('date_modified', models.DateTimeField(blank=True, null=True)),
                ('timezone_offset', models.CharField(blank=True, max_length=10, null=True)),
                ('gps_latitude', models.FloatField(blank=True, db_index=True, null=True)),
                ('gps_longitude', models.FloatField(blank=True, db_index=True, null=True)),
                ('gps_altitude', models.FloatField(blank=True, null=True)),
                ('location_country', models.CharField(blank=True, db_index=True, max_length=100, null=True)),
                ('location_state', models.CharField(blank=True, max_length=100, null=True)),
                ('location_city', models.CharField(blank=True, db_index=True, max_length=100, null=True)),
                ('location_address', models.TextField(blank=True, null=True)),
                ('title', models.CharField(blank=True, max_length=500, null=True)),
                ('caption', models.TextField(blank=True, null=True)),
                ('keywords', models.JSONField(blank=True, null=True)),
                ('rating', models.IntegerField(blank=True, db_index=True, null=True)),
                ('copyright', models.TextField(blank=True, null=True)),
                ('creator', models.CharField(blank=True, max_length=200, null=True)),
                ('source', models.CharField(choices=[('embedded', 'Embedded in File'), ('sidecar', 'XMP Sidecar'), ('user_edit', 'User Edit'), ('computed', 'Computed')], default='embedded', max_length=20)),
                ('raw_exif', models.JSONField(blank=True, null=True)),
                ('raw_xmp', models.JSONField(blank=True, null=True)),
                ('raw_iptc', models.JSONField(blank=True, null=True)),
                ('version', models.IntegerField(default=1)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
            ],
            options={
                'verbose_name': 'Photo Metadata',
                'verbose_name_plural': 'Photo Metadata',
            },
        ),
        migrations.CreateModel(
            name='StackReview',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('decision', models.CharField(choices=[('pending', 'Pending Review'), ('resolved', 'Resolved'), ('dismissed', 'Dismissed')], db_index=True, default='pending', max_length=20)),
                ('trashed_count', models.IntegerField(default=0)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('reviewed_at', models.DateTimeField(blank=True, null=True)),
                ('note', models.TextField(blank=True, null=True)),
            ],
            options={
                'verbose_name': 'Stack Review',
                'verbose_name_plural': 'Stack Reviews',
                'ordering': ['-created_at'],
            },
        ),
        migrations.RemoveIndex(
            model_name='photostack',
            name='api_photost_owner_i_abc123_idx',
        ),
        migrations.RemoveIndex(
            model_name='photostack',
            name='api_photost_owner_i_def456_idx',
        ),
        migrations.RemoveField(
            model_name='photostack',
            name='status',
        ),
        migrations.AlterField(
            model_name='photostack',
            name='owner',
            field=models.ForeignKey(on_delete=models.SET(api.models.user.get_deleted_user), related_name='photo_stacks', to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddIndex(
            model_name='photostack',
            index=models.Index(fields=['owner', 'stack_type'], name='api_photost_owner_i_40a369_idx'),
        ),
        migrations.AddField(
            model_name='metadataedit',
            name='photo',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='metadata_edits', to='api.photo'),
        ),
        migrations.AddField(
            model_name='metadataedit',
            name='user',
            field=models.ForeignKey(on_delete=models.SET(api.models.user.get_deleted_user), related_name='metadata_edits', to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='metadatafile',
            name='file',
            field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='metadata_info', to='api.file'),
        ),
        migrations.AddField(
            model_name='metadatafile',
            name='photo',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='metadata_files', to='api.photo'),
        ),
        migrations.AddField(
            model_name='photometadata',
            name='photo',
            field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='metadata', to='api.photo'),
        ),
        migrations.AddField(
            model_name='stackreview',
            name='kept_photo',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='kept_in_reviews', to='api.photo'),
        ),
        migrations.AddField(
            model_name='stackreview',
            name='reviewer',
            field=models.ForeignKey(on_delete=models.SET(api.models.user.get_deleted_user), related_name='stack_reviews', to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='stackreview',
            name='stack',
            field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='review', to='api.photostack'),
        ),
        migrations.AddIndex(
            model_name='metadataedit',
            index=models.Index(fields=['photo', '-created_at'], name='api_metadat_photo_i_21e478_idx'),
        ),
        migrations.AddIndex(
            model_name='photometadata',
            index=models.Index(fields=['camera_make', 'camera_model'], name='api_photome_camera__361eac_idx'),
        ),
        migrations.AddIndex(
            model_name='photometadata',
            index=models.Index(fields=['date_taken'], name='api_photome_date_ta_35e59b_idx'),
        ),
        migrations.AddIndex(
            model_name='photometadata',
            index=models.Index(fields=['location_country', 'location_city'], name='api_photome_locatio_1ca8bb_idx'),
        ),
        migrations.AddIndex(
            model_name='stackreview',
            index=models.Index(fields=['reviewer', 'decision'], name='api_stackre_reviewe_48380f_idx'),
        ),
    ]
