# Generated by Django 5.2.9 on 2026-04-22 14:04

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


class Migration(migrations.Migration):

    dependencies = [
        ('species', '0012_species_feedback_and_more'),
    ]

    operations = [
        migrations.AddField(
            model_name='aquaristclub',
            name='external_id',
            field=models.PositiveIntegerField(blank=True, null=True, unique=True),
        ),
        migrations.AddField(
            model_name='caresregistration',
            name='external_id',
            field=models.PositiveIntegerField(blank=True, null=True, unique=True),
        ),
        migrations.AddField(
            model_name='species',
            name='external_id',
            field=models.PositiveIntegerField(blank=True, null=True, unique=True),
        ),
        migrations.AddField(
            model_name='species',
            name='species_instance_count',
            field=models.PositiveIntegerField(default=0),
        ),
        migrations.AlterField(
            model_name='caresregistration',
            name='affiliate_club',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='club_cares_registrations', to='species.aquaristclub'),
        ),
        migrations.AlterField(
            model_name='species',
            name='cares_classification',
            field=models.CharField(choices=[('NOTC', 'Undefined'), ('CNT', 'Near Threatened'), ('CVU', 'Vulnerable'), ('CEN', 'Endangered'), ('CCR', 'Critically Endangered'), ('CEW', 'Extinct in the Wild')], default='NOTC', max_length=4),
        ),
        migrations.AlterField(
            model_name='speciesinstance',
            name='genetic_traits',
            field=models.CharField(choices=[('AS', 'Aquarium Strain'), ('WC', 'F0 Wild Caught'), ('F1', 'F1 First Generation'), ('F2', 'F2 Second Generation'), ('FX', 'FX 3rd or more Generation'), ('OT', 'Other')], default='AS', max_length=2),
        ),
        migrations.CreateModel(
            name='PageViewCount',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('page_type', models.CharField(choices=[('USER', 'Aquarist'), ('SPEC', 'Species'), ('SPIN', 'Aquarist Species'), ('SPML', 'Species Maintenance Log'), ('AQCL', 'Aquarist Club'), ('BAPL', 'BAP Leaderboard')], max_length=4)),
                ('object_id', models.IntegerField()),
                ('visitor_type', models.CharField(choices=[('AN', 'Anonymous'), ('AU', 'Authenticated')], max_length=2)),
                ('count', models.PositiveIntegerField(default=0)),
            ],
            options={
                'verbose_name': 'Page View Count',
                'verbose_name_plural': 'Page View Counts',
                'indexes': [models.Index(fields=['page_type', 'object_id'], name='species_pag_page_ty_idx')],
                'unique_together': {('page_type', 'object_id', 'visitor_type')},
            },
        ),
        migrations.CreateModel(
            name='PageViewMonthlySnapshot',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('page_type', models.CharField(choices=[('USER', 'Aquarist'), ('SPEC', 'Species'), ('SPIN', 'Aquarist Species'), ('SPML', 'Species Maintenance Log'), ('AQCL', 'Aquarist Club'), ('BAPL', 'BAP Leaderboard')], max_length=4)),
                ('object_id', models.IntegerField()),
                ('visitor_type', models.CharField(choices=[('AN', 'Anonymous'), ('AU', 'Authenticated')], max_length=2)),
                ('year', models.PositiveSmallIntegerField()),
                ('month', models.PositiveSmallIntegerField()),
                ('count', models.PositiveIntegerField(default=0)),
            ],
            options={
                'verbose_name': 'Page View Monthly Summary',
                'verbose_name_plural': 'Page View Monthly Summaries',
                'ordering': ['-year', '-month'],
                'indexes': [models.Index(fields=['page_type', 'object_id', 'year', 'month'], name='species_pag_page_ty_mo_idx')],
                'unique_together': {('page_type', 'object_id', 'visitor_type', 'year', 'month')},
            },
        ),
    ]
