# Generated by Django 4.2.16 on 2026-03-24 13:42

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


class Migration(migrations.Migration):

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('gears', '0002_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='Ammo',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('brand', models.CharField(max_length=100, verbose_name='brand')),
                ('name', models.CharField(max_length=150, verbose_name='name')),
                ('caliber', models.CharField(max_length=20, verbose_name='caliber')),
                ('bullet_weight_gr', models.DecimalField(decimal_places=1, max_digits=6, verbose_name='bullet weight (gr)')),
                ('bullet_type', models.CharField(choices=[('FMJ', 'Full Metal Jacket'), ('HP', 'Hollow Point'), ('BTHP', 'Boat Tail Hollow Point'), ('SP', 'Soft Point'), ('HPBT', 'Hollow Point Boat Tail'), ('SMK', 'Sierra MatchKing'), ('A_TIP', 'Hornady A-Tip'), ('MONO', 'Monolithic / Solid')], max_length=5, verbose_name='bullet type')),
                ('primer_size', models.CharField(blank=True, choices=[('SP', 'Small Pistol'), ('LP', 'Large Pistol'), ('SR', 'Small Rifle'), ('LR', 'Large Rifle'), ('LRM', 'Large Rifle Magnum')], max_length=3, verbose_name='primer size')),
                ('case_material', models.CharField(choices=[('BRASS', 'Brass'), ('STEEL', 'Steel'), ('ALUMINUM', 'Aluminum'), ('NICKEL', 'Nickel-Plated Brass')], default='BRASS', max_length=10, verbose_name='case material')),
                ('muzzle_velocity_fps', models.DecimalField(blank=True, decimal_places=1, max_digits=6, null=True, verbose_name='muzzle velocity (fps)')),
                ('muzzle_energy_ftlb', models.DecimalField(blank=True, decimal_places=1, max_digits=7, null=True, verbose_name='muzzle energy (ft·lb)')),
                ('box_count', models.PositiveSmallIntegerField(blank=True, null=True, verbose_name='box count')),
                ('notes', models.TextField(blank=True, verbose_name='notes')),
                ('status', models.CharField(choices=[('PENDING', 'Pending Verification'), ('VERIFIED', 'Verified'), ('REJECTED', 'Rejected')], default='PENDING', max_length=10, verbose_name='status')),
                ('reviewed_at', models.DateTimeField(blank=True, null=True, verbose_name='reviewed at')),
                ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='created at')),
                ('updated_at', models.DateTimeField(auto_now=True, verbose_name='updated at')),
            ],
            options={
                'verbose_name': 'ammo',
                'verbose_name_plural': 'ammo',
                'ordering': ['brand', 'name', 'caliber'],
            },
        ),
        migrations.CreateModel(
            name='Brass',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('brand', models.CharField(max_length=100, verbose_name='brand')),
                ('caliber', models.CharField(max_length=20, verbose_name='caliber')),
                ('primer_pocket', models.CharField(blank=True, choices=[('SP', 'Small Pistol'), ('LP', 'Large Pistol'), ('SR', 'Small Rifle'), ('LR', 'Large Rifle'), ('LRM', 'Large Rifle Magnum')], max_length=3, verbose_name='primer pocket')),
                ('trim_length_mm', models.DecimalField(blank=True, decimal_places=2, max_digits=6, null=True, verbose_name='trim-to length (mm)')),
                ('notes', models.TextField(blank=True, verbose_name='notes')),
            ],
            options={
                'verbose_name': 'brass',
                'verbose_name_plural': 'brass',
                'ordering': ['brand', 'caliber'],
            },
        ),
        migrations.CreateModel(
            name='Bullet',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('brand', models.CharField(max_length=100, verbose_name='brand')),
                ('model_name', models.CharField(max_length=150, verbose_name='model name')),
                ('weight_gr', models.DecimalField(decimal_places=1, max_digits=6, verbose_name='weight (gr)')),
                ('bullet_type', models.CharField(choices=[('FMJ', 'Full Metal Jacket'), ('HP', 'Hollow Point'), ('BTHP', 'Boat Tail Hollow Point'), ('SP', 'Soft Point'), ('HPBT', 'Hollow Point Boat Tail'), ('SMK', 'Sierra MatchKing'), ('A_TIP', 'Hornady A-Tip'), ('MONO', 'Monolithic / Solid')], max_length=5, verbose_name='bullet type')),
                ('diameter_mm', models.DecimalField(blank=True, decimal_places=3, max_digits=5, null=True, verbose_name='diameter (mm)')),
                ('length_mm', models.DecimalField(blank=True, decimal_places=2, max_digits=5, null=True, verbose_name='length (mm)')),
                ('bc_g1', models.DecimalField(blank=True, decimal_places=4, max_digits=5, null=True, verbose_name='BC (G1)')),
                ('bc_g7', models.DecimalField(blank=True, decimal_places=4, max_digits=5, null=True, verbose_name='BC (G7)')),
            ],
            options={
                'verbose_name': 'bullet',
                'verbose_name_plural': 'bullets',
                'ordering': ['brand', 'model_name', 'weight_gr'],
            },
        ),
        migrations.CreateModel(
            name='Powder',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('brand', models.CharField(max_length=100, verbose_name='brand')),
                ('name', models.CharField(max_length=100, verbose_name='name')),
                ('powder_type', models.CharField(blank=True, choices=[('BALL', 'Ball / Spherical'), ('EXTRUDED', 'Extruded / Stick'), ('FLAKE', 'Flake')], max_length=10, verbose_name='powder type')),
                ('burn_rate_index', models.PositiveSmallIntegerField(blank=True, help_text='Lower = faster burning. Used for relative ordering only.', null=True, verbose_name='burn rate index')),
                ('notes', models.TextField(blank=True, verbose_name='notes')),
            ],
            options={
                'verbose_name': 'powder',
                'verbose_name_plural': 'powders',
                'ordering': ['burn_rate_index', 'brand', 'name'],
            },
        ),
        migrations.CreateModel(
            name='Primer',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('brand', models.CharField(max_length=100, verbose_name='brand')),
                ('name', models.CharField(max_length=100, verbose_name='name')),
                ('size', models.CharField(choices=[('SP', 'Small Pistol'), ('LP', 'Large Pistol'), ('SR', 'Small Rifle'), ('LR', 'Large Rifle'), ('LRM', 'Large Rifle Magnum')], max_length=3, verbose_name='size')),
                ('notes', models.TextField(blank=True, verbose_name='notes')),
            ],
            options={
                'verbose_name': 'primer',
                'verbose_name_plural': 'primers',
                'ordering': ['brand', 'name'],
            },
        ),
        migrations.AlterModelOptions(
            name='bipod',
            options={'verbose_name': 'bipod', 'verbose_name_plural': 'bipods'},
        ),
        migrations.AlterModelOptions(
            name='firearm',
            options={'verbose_name': 'firearm', 'verbose_name_plural': 'firearms'},
        ),
        migrations.AlterModelOptions(
            name='gear',
            options={'ordering': ['brand', 'model_name'], 'verbose_name': 'gear', 'verbose_name_plural': 'gears'},
        ),
        migrations.AlterModelOptions(
            name='magazine',
            options={'verbose_name': 'magazine', 'verbose_name_plural': 'magazines'},
        ),
        migrations.AlterModelOptions(
            name='rig',
            options={'ordering': ['-created_at'], 'verbose_name': 'rig', 'verbose_name_plural': 'rigs'},
        ),
        migrations.AlterModelOptions(
            name='rigitem',
            options={'verbose_name': 'rig item', 'verbose_name_plural': 'rig items'},
        ),
        migrations.AlterModelOptions(
            name='scope',
            options={'verbose_name': 'scope', 'verbose_name_plural': 'scopes'},
        ),
        migrations.AlterModelOptions(
            name='suppressor',
            options={'verbose_name': 'suppressor', 'verbose_name_plural': 'suppressors'},
        ),
        migrations.AlterModelOptions(
            name='usergear',
            options={'ordering': ['-added_at'], 'verbose_name': 'owned gear', 'verbose_name_plural': 'owned gears'},
        ),
        migrations.AlterField(
            model_name='bipod',
            name='attachment_type',
            field=models.CharField(blank=True, choices=[('PICATINNY', 'Picatinny Rail'), ('SLING_STUD', 'Sling Stud'), ('ARCA_SWISS', 'Arca-Swiss'), ('M_LOK', 'M-LOK'), ('KEYMOD', 'KeyMod')], max_length=20, verbose_name='attachment type'),
        ),
        migrations.AlterField(
            model_name='bipod',
            name='max_height_mm',
            field=models.DecimalField(blank=True, decimal_places=1, max_digits=6, null=True, verbose_name='max height (mm)'),
        ),
        migrations.AlterField(
            model_name='bipod',
            name='min_height_mm',
            field=models.DecimalField(blank=True, decimal_places=1, max_digits=6, null=True, verbose_name='min height (mm)'),
        ),
        migrations.AlterField(
            model_name='firearm',
            name='action',
            field=models.CharField(choices=[('BOLT', 'Bolt Action'), ('SEMI_AUTO', 'Semi-Automatic'), ('PUMP', 'Pump Action'), ('LEVER', 'Lever Action'), ('BREAK', 'Break Action'), ('FULL_AUTO', 'Full Automatic')], max_length=10, verbose_name='action'),
        ),
        migrations.AlterField(
            model_name='firearm',
            name='barrel_length_mm',
            field=models.DecimalField(blank=True, decimal_places=1, max_digits=6, null=True, verbose_name='barrel length (mm)'),
        ),
        migrations.AlterField(
            model_name='firearm',
            name='caliber',
            field=models.CharField(max_length=20, verbose_name='caliber'),
        ),
        migrations.AlterField(
            model_name='firearm',
            name='firearm_type',
            field=models.CharField(choices=[('RIFLE', 'Rifle'), ('PISTOL', 'Pistol'), ('SHOTGUN', 'Shotgun'), ('REVOLVER', 'Revolver'), ('CARBINE', 'Carbine')], max_length=10, verbose_name='firearm type'),
        ),
        migrations.AlterField(
            model_name='firearm',
            name='magazine_capacity',
            field=models.PositiveSmallIntegerField(blank=True, null=True, verbose_name='magazine capacity'),
        ),
        migrations.AlterField(
            model_name='gear',
            name='brand',
            field=models.CharField(max_length=100, verbose_name='brand'),
        ),
        migrations.AlterField(
            model_name='gear',
            name='created_at',
            field=models.DateTimeField(auto_now_add=True, verbose_name='created at'),
        ),
        migrations.AlterField(
            model_name='gear',
            name='description',
            field=models.TextField(blank=True, verbose_name='description'),
        ),
        migrations.AlterField(
            model_name='gear',
            name='gear_type',
            field=models.CharField(choices=[('FIREARM', 'Firearm'), ('SCOPE', 'Scope'), ('SUPPRESSOR', 'Suppressor'), ('BIPOD', 'Bipod'), ('MAGAZINE', 'Magazine')], editable=False, max_length=20, verbose_name='gear type'),
        ),
        migrations.AlterField(
            model_name='gear',
            name='model_name',
            field=models.CharField(max_length=150, verbose_name='model name'),
        ),
        migrations.AlterField(
            model_name='gear',
            name='reviewed_at',
            field=models.DateTimeField(blank=True, null=True, verbose_name='reviewed at'),
        ),
        migrations.AlterField(
            model_name='gear',
            name='reviewed_by',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='reviewed_gears', to=settings.AUTH_USER_MODEL, verbose_name='reviewed by'),
        ),
        migrations.AlterField(
            model_name='gear',
            name='status',
            field=models.CharField(choices=[('PENDING', 'Pending Verification'), ('VERIFIED', 'Verified'), ('REJECTED', 'Rejected')], default='PENDING', max_length=10, verbose_name='status'),
        ),
        migrations.AlterField(
            model_name='gear',
            name='submitted_by',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='submitted_gears', to=settings.AUTH_USER_MODEL, verbose_name='submitted by'),
        ),
        migrations.AlterField(
            model_name='gear',
            name='updated_at',
            field=models.DateTimeField(auto_now=True, verbose_name='updated at'),
        ),
        migrations.AlterField(
            model_name='magazine',
            name='caliber',
            field=models.CharField(max_length=20, verbose_name='caliber'),
        ),
        migrations.AlterField(
            model_name='magazine',
            name='capacity',
            field=models.PositiveSmallIntegerField(verbose_name='capacity'),
        ),
        migrations.AlterField(
            model_name='rig',
            name='created_at',
            field=models.DateTimeField(auto_now_add=True, verbose_name='created at'),
        ),
        migrations.AlterField(
            model_name='rig',
            name='description',
            field=models.TextField(blank=True, verbose_name='description'),
        ),
        migrations.AlterField(
            model_name='rig',
            name='items',
            field=models.ManyToManyField(related_name='rigs', through='gears.RigItem', to='gears.usergear', verbose_name='items'),
        ),
        migrations.AlterField(
            model_name='rig',
            name='name',
            field=models.CharField(max_length=100, verbose_name='name'),
        ),
        migrations.AlterField(
            model_name='rig',
            name='updated_at',
            field=models.DateTimeField(auto_now=True, verbose_name='updated at'),
        ),
        migrations.AlterField(
            model_name='rig',
            name='user',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='rigs', to=settings.AUTH_USER_MODEL, verbose_name='user'),
        ),
        migrations.AlterField(
            model_name='rigitem',
            name='rig',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='rig_items', to='gears.rig', verbose_name='rig'),
        ),
        migrations.AlterField(
            model_name='rigitem',
            name='role',
            field=models.CharField(choices=[('PRIMARY', 'Primary Firearm'), ('OPTIC', 'Optic / Scope'), ('SUPPRESSOR', 'Suppressor'), ('BIPOD', 'Bipod'), ('MAGAZINE', 'Magazine'), ('OTHER', 'Other Accessory')], default='OTHER', max_length=20, verbose_name='role'),
        ),
        migrations.AlterField(
            model_name='rigitem',
            name='user_gear',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='rig_items', to='gears.usergear', verbose_name='gear'),
        ),
        migrations.AlterField(
            model_name='scope',
            name='magnification_max',
            field=models.DecimalField(decimal_places=1, max_digits=5, verbose_name='max magnification'),
        ),
        migrations.AlterField(
            model_name='scope',
            name='magnification_min',
            field=models.DecimalField(decimal_places=1, max_digits=5, verbose_name='min magnification'),
        ),
        migrations.AlterField(
            model_name='scope',
            name='objective_diameter_mm',
            field=models.DecimalField(decimal_places=1, max_digits=5, verbose_name='objective diameter (mm)'),
        ),
        migrations.AlterField(
            model_name='scope',
            name='reticle_type',
            field=models.CharField(blank=True, choices=[('DUPLEX', 'Duplex'), ('MILDOT', 'Mil-Dot'), ('BDC', 'BDC'), ('ILLUMINATED', 'Illuminated'), ('ETCHED', 'Etched Glass')], max_length=20, verbose_name='reticle type'),
        ),
        migrations.AlterField(
            model_name='scope',
            name='tube_diameter_mm',
            field=models.DecimalField(decimal_places=1, default=30, max_digits=5, verbose_name='tube diameter (mm)'),
        ),
        migrations.AlterField(
            model_name='suppressor',
            name='length_mm',
            field=models.DecimalField(blank=True, decimal_places=1, max_digits=6, null=True, verbose_name='length (mm)'),
        ),
        migrations.AlterField(
            model_name='suppressor',
            name='max_caliber',
            field=models.CharField(max_length=20, verbose_name='max caliber'),
        ),
        migrations.AlterField(
            model_name='suppressor',
            name='thread_pitch',
            field=models.CharField(blank=True, max_length=20, verbose_name='thread pitch'),
        ),
        migrations.AlterField(
            model_name='suppressor',
            name='weight_g',
            field=models.DecimalField(blank=True, decimal_places=1, max_digits=6, null=True, verbose_name='weight (g)'),
        ),
        migrations.AlterField(
            model_name='usergear',
            name='added_at',
            field=models.DateTimeField(auto_now_add=True, verbose_name='added at'),
        ),
        migrations.AlterField(
            model_name='usergear',
            name='gear',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='user_instances', to='gears.gear', verbose_name='gear'),
        ),
        migrations.AlterField(
            model_name='usergear',
            name='nickname',
            field=models.CharField(blank=True, max_length=100, verbose_name='nickname'),
        ),
        migrations.AlterField(
            model_name='usergear',
            name='notes',
            field=models.TextField(blank=True, verbose_name='notes'),
        ),
        migrations.AlterField(
            model_name='usergear',
            name='purchase_date',
            field=models.DateField(blank=True, null=True, verbose_name='purchase date'),
        ),
        migrations.AlterField(
            model_name='usergear',
            name='serial_number',
            field=models.CharField(blank=True, max_length=100, verbose_name='serial number'),
        ),
        migrations.AlterField(
            model_name='usergear',
            name='user',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='inventory', to=settings.AUTH_USER_MODEL, verbose_name='user'),
        ),
        migrations.CreateModel(
            name='ReloadRecipe',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=150, verbose_name='name')),
                ('caliber', models.CharField(max_length=20, verbose_name='caliber')),
                ('notes', models.TextField(blank=True, verbose_name='notes')),
                ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='created at')),
                ('updated_at', models.DateTimeField(auto_now=True, verbose_name='updated at')),
                ('brass', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='recipes', to='gears.brass', verbose_name='brass')),
                ('bullet', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='recipes', to='gears.bullet', verbose_name='bullet')),
                ('primer', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='recipes', to='gears.primer', verbose_name='primer')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='reload_recipes', to=settings.AUTH_USER_MODEL, verbose_name='user')),
            ],
            options={
                'verbose_name': 'reload recipe',
                'verbose_name_plural': 'reload recipes',
                'ordering': ['-created_at'],
            },
        ),
        migrations.CreateModel(
            name='ReloadedAmmoBatch',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('powder_charge_gr', models.DecimalField(decimal_places=2, max_digits=5, verbose_name='powder charge (gr)')),
                ('quantity', models.PositiveSmallIntegerField(blank=True, null=True, verbose_name='quantity loaded')),
                ('oal_mm', models.DecimalField(blank=True, decimal_places=2, max_digits=6, null=True, verbose_name='overall length (mm)')),
                ('coal_mm', models.DecimalField(blank=True, decimal_places=2, max_digits=6, null=True, verbose_name='cartridge overall length to ogive (mm)')),
                ('crimp', models.CharField(choices=[('NONE', 'No Crimp'), ('TAPER', 'Taper Crimp'), ('ROLL', 'Roll Crimp')], default='NONE', max_length=6, verbose_name='crimp')),
                ('case_prep_notes', models.TextField(blank=True, verbose_name='case prep notes')),
                ('notes', models.TextField(blank=True, verbose_name='notes')),
                ('loaded_at', models.DateField(blank=True, null=True, verbose_name='loaded at')),
                ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='created at')),
                ('updated_at', models.DateTimeField(auto_now=True, verbose_name='updated at')),
                ('powder', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='batches', to='gears.powder', verbose_name='powder')),
                ('recipe', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='batches', to='gears.reloadrecipe', verbose_name='recipe')),
            ],
            options={
                'verbose_name': 'reloaded ammo batch',
                'verbose_name_plural': 'reloaded ammo batches',
                'ordering': ['recipe', 'powder_charge_gr'],
            },
        ),
        migrations.AddConstraint(
            model_name='primer',
            constraint=models.UniqueConstraint(fields=('brand', 'name'), name='unique_primer_brand_name'),
        ),
        migrations.AddConstraint(
            model_name='powder',
            constraint=models.UniqueConstraint(fields=('brand', 'name'), name='unique_powder_brand_name'),
        ),
        migrations.AddConstraint(
            model_name='bullet',
            constraint=models.UniqueConstraint(fields=('brand', 'model_name', 'weight_gr'), name='unique_bullet_brand_model_weight'),
        ),
        migrations.AddConstraint(
            model_name='brass',
            constraint=models.UniqueConstraint(fields=('brand', 'caliber'), name='unique_brass_brand_caliber'),
        ),
        migrations.AddField(
            model_name='ammo',
            name='reviewed_by',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='reviewed_ammo', to=settings.AUTH_USER_MODEL, verbose_name='reviewed by'),
        ),
        migrations.AddField(
            model_name='ammo',
            name='submitted_by',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='submitted_ammo', to=settings.AUTH_USER_MODEL, verbose_name='submitted by'),
        ),
        migrations.AddConstraint(
            model_name='reloadrecipe',
            constraint=models.UniqueConstraint(fields=('user', 'name'), name='unique_recipe_name_per_user'),
        ),
        migrations.AddConstraint(
            model_name='reloadedammobatch',
            constraint=models.UniqueConstraint(fields=('recipe', 'powder', 'powder_charge_gr'), name='unique_batch_charge_per_recipe_powder'),
        ),
        migrations.AddConstraint(
            model_name='ammo',
            constraint=models.UniqueConstraint(fields=('brand', 'name', 'caliber'), name='unique_ammo_brand_name_caliber'),
        ),
    ]
