# Generated by Django 5.2.10 on 2026-01-13 19:59

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ("auth", "0012_alter_user_first_name_max_length"),
        ("links", "0006_reference_media_files"),
        ("media", "0001_initial"),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name="RegistrationSubmission",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "status",
                    models.CharField(
                        choices=[
                            ("pending", "Pending"),
                            ("approved", "Approved"),
                            ("rejected", "Rejected"),
                        ],
                        default="pending",
                        max_length=20,
                    ),
                ),
                ("submitted_at", models.DateTimeField(auto_now_add=True)),
                ("reviewed_at", models.DateTimeField(blank=True, null=True)),
                ("review_notes", models.TextField(blank=True)),
                (
                    "photo_media",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="registration_photos",
                        to="media.mediafile",
                    ),
                ),
                (
                    "reviewed_by",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="reviewed_registrations",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "user",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="registration_submissions",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            options={
                "verbose_name": "Registration Submission",
                "verbose_name_plural": "Registration Submissions",
                "ordering": ["-submitted_at", "pk"],
            },
        ),
        migrations.CreateModel(
            name="Term",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("title", models.CharField(max_length=200)),
                ("slug", models.SlugField(unique=True)),
                ("summary", models.TextField(blank=True)),
                ("body_text", models.TextField(blank=True)),
                ("checkbox_text", models.CharField(default="I agree.", max_length=200)),
                (
                    "category",
                    models.CharField(
                        choices=[
                            ("draft", "Draft"),
                            ("general", "General User"),
                            ("security_group", "Security Group"),
                            ("registration", "Registration"),
                        ],
                        default="draft",
                        max_length=20,
                    ),
                ),
                ("requires_document", models.BooleanField(default=False)),
                (
                    "required_document_label",
                    models.CharField(blank=True, max_length=200),
                ),
                (
                    "required_document_patterns",
                    models.TextField(
                        blank=True,
                        help_text="Newline-separated file patterns (e.g. *.pdf).",
                    ),
                ),
                (
                    "required_document_min_bytes",
                    models.PositiveBigIntegerField(
                        blank=True, help_text="Minimum file size in bytes.", null=True
                    ),
                ),
                (
                    "required_document_max_bytes",
                    models.PositiveBigIntegerField(
                        blank=True, help_text="Maximum file size in bytes.", null=True
                    ),
                ),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
                (
                    "document_media",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="term_documents",
                        to="media.mediafile",
                        verbose_name="Document",
                    ),
                ),
                (
                    "reference",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="terms",
                        to="links.reference",
                    ),
                ),
                (
                    "security_group",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="terms",
                        to="auth.group",
                    ),
                ),
            ],
            options={
                "verbose_name": "Term",
                "verbose_name_plural": "Terms",
                "ordering": ["title", "pk"],
            },
        ),
        migrations.CreateModel(
            name="TermAcceptance",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("accepted_at", models.DateTimeField(auto_now_add=True)),
                ("checkbox_text", models.CharField(max_length=200)),
                ("ip_address", models.CharField(blank=True, max_length=45)),
                ("user_agent", models.TextField(blank=True)),
                (
                    "required_document_media",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="term_acceptance_documents",
                        to="media.mediafile",
                    ),
                ),
                (
                    "submission",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="term_acceptances",
                        to="terms.registrationsubmission",
                    ),
                ),
                (
                    "term",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="acceptances",
                        to="terms.term",
                    ),
                ),
                (
                    "user",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="term_acceptances",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            options={
                "verbose_name": "Term Acceptance",
                "verbose_name_plural": "Term Acceptances",
                "ordering": ["-accepted_at", "pk"],
            },
        ),
    ]
