# Generated by Django 4.2.16 on 2026-03-25 10:15

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('tools', '0003_remove_shotgroup_result_picture_delete_resultpicture'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='GroupPhoto',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('caption', models.CharField(blank=True, max_length=255, verbose_name='caption')),
                ('order', models.PositiveSmallIntegerField(default=0, verbose_name='order')),
            ],
            options={
                'verbose_name': 'group photo',
                'verbose_name_plural': 'group photos',
                'ordering': ['order', 'id'],
            },
        ),
        migrations.CreateModel(
            name='PointOfImpact',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('order', models.PositiveSmallIntegerField(default=0, help_text='1-based sequence; used when shot FK is absent.', verbose_name='order')),
                ('x_px', models.PositiveSmallIntegerField(verbose_name='x (px)')),
                ('y_px', models.PositiveSmallIntegerField(verbose_name='y (px)')),
                ('x_mm', models.DecimalField(blank=True, decimal_places=2, max_digits=7, null=True, verbose_name='x offset (mm)')),
                ('y_mm', models.DecimalField(blank=True, decimal_places=2, max_digits=7, null=True, verbose_name='y offset (mm)')),
                ('radius_mm', models.DecimalField(blank=True, decimal_places=2, max_digits=6, null=True, verbose_name='bullet hole radius (mm)')),
                ('notes', models.CharField(blank=True, max_length=255, verbose_name='notes')),
                ('group_photo', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='points_of_impact', to='photos.groupphoto', verbose_name='group photo')),
                ('shot', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='point_of_impact', to='tools.shot', verbose_name='shot')),
            ],
            options={
                'verbose_name': 'point of impact',
                'verbose_name_plural': 'points of impact',
                'ordering': ['order', 'id'],
            },
        ),
        migrations.CreateModel(
            name='Photo',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('data', models.BinaryField(verbose_name='data')),
                ('content_type', models.CharField(max_length=50, verbose_name='content type')),
                ('size', models.PositiveIntegerField(verbose_name='size (bytes)')),
                ('width', models.PositiveSmallIntegerField(blank=True, null=True, verbose_name='width (px)')),
                ('height', models.PositiveSmallIntegerField(blank=True, null=True, verbose_name='height (px)')),
                ('uploaded_at', models.DateTimeField(auto_now_add=True, verbose_name='uploaded at')),
                ('description', models.CharField(blank=True, max_length=255, verbose_name='description')),
                ('uploaded_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='photos', to=settings.AUTH_USER_MODEL, verbose_name='uploaded by')),
            ],
            options={
                'verbose_name': 'photo',
                'verbose_name_plural': 'photos',
                'ordering': ['-uploaded_at'],
            },
        ),
        migrations.CreateModel(
            name='GroupPhotoAnalysis',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('group_size_mm', models.DecimalField(blank=True, decimal_places=2, max_digits=7, null=True, verbose_name='group size (mm)')),
                ('group_size_moa', models.DecimalField(blank=True, decimal_places=3, max_digits=7, null=True, verbose_name='group size (MOA)')),
                ('elevation_offset_mm', models.DecimalField(blank=True, decimal_places=2, max_digits=7, null=True, verbose_name='elevation offset (mm)')),
                ('elevation_offset_moa', models.DecimalField(blank=True, decimal_places=3, max_digits=7, null=True, verbose_name='elevation offset (MOA)')),
                ('windage_offset_mm', models.DecimalField(blank=True, decimal_places=2, max_digits=7, null=True, verbose_name='windage offset (mm)')),
                ('windage_offset_moa', models.DecimalField(blank=True, decimal_places=3, max_digits=7, null=True, verbose_name='windage offset (MOA)')),
                ('mean_radius_mm', models.DecimalField(blank=True, decimal_places=2, max_digits=7, null=True, verbose_name='mean radius (mm)')),
                ('mean_radius_moa', models.DecimalField(blank=True, decimal_places=3, max_digits=7, null=True, verbose_name='mean radius (MOA)')),
                ('notes', models.TextField(blank=True, verbose_name='notes')),
                ('group_photo', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='analysis', to='photos.groupphoto', verbose_name='group photo')),
            ],
            options={
                'verbose_name': 'group photo analysis',
                'verbose_name_plural': 'group photo analyses',
            },
        ),
        migrations.AddField(
            model_name='groupphoto',
            name='photo',
            field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='group_photo', to='photos.photo', verbose_name='photo'),
        ),
        migrations.AddField(
            model_name='groupphoto',
            name='shot_group',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='group_photos', to='tools.shotgroup', verbose_name='shot group'),
        ),
    ]
