# Generated by Django 5.2.6 on 2025-12-26 22:10

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Project',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255)),
                ('description', models.TextField(blank=True, null=True)),
                ('start_date', models.DateField(blank=True, null=True)),
                ('end_date', models.DateField(blank=True, null=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
            ],
            options={
                'ordering': ['name'],
            },
        ),
        migrations.CreateModel(
            name='Event',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255)),
                ('event_type', models.CharField(choices=[('project', 'Project'), ('site', 'Site'), ('visit', 'Visit'), ('sample', 'Sample'), ('biotope_mapping_unit', 'Biotope Mapping Unit')], max_length=50)),
                ('start_date', models.DateField(blank=True, null=True)),
                ('end_date', models.DateField(blank=True, null=True)),
                ('location_note', models.CharField(blank=True, max_length=500, null=True)),
                ('footprintWKT', models.TextField(blank=True, help_text='Geometry in WKT format', null=True)),
                ('habitat', models.CharField(blank=True, max_length=255, null=True)),
                ('fieldNotes', models.TextField(blank=True, null=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('parent', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='children', to='eventhub.event')),
                ('project', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='events', to='eventhub.project')),
            ],
            options={
                'ordering': ['start_date', 'name'],
            },
        ),
        migrations.CreateModel(
            name='Occurrence',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('taxon_name', models.CharField(max_length=255)),
                ('taxon_id', models.CharField(blank=True, max_length=255, null=True)),
                ('abundance', models.CharField(blank=True, max_length=100, null=True)),
                ('recorded_by', models.CharField(blank=True, max_length=255, null=True)),
                ('occurrence_date', models.DateField(blank=True, null=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('event', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='occurrences', to='eventhub.event')),
            ],
            options={
                'ordering': ['occurrence_date', 'taxon_name'],
            },
        ),
        migrations.CreateModel(
            name='EventAttribute',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('attribute_type', models.CharField(max_length=100)),
                ('attribute_value', models.CharField(max_length=500)),
                ('unit', models.CharField(blank=True, max_length=50, null=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('event', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='measurements', to='eventhub.event')),
                ('occurrence', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='measurements', to='eventhub.occurrence')),
            ],
            options={
                'ordering': ['attribute_type', 'created_at'],
            },
        ),
    ]
