# Generated by Django 5.2.9 on 2026-01-01 21:25

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


class Migration(migrations.Migration):

    dependencies = [
        ("pghistory", "0006_delete_aggregateevent"),
        ("rides", "0029_darkridestats_darkridestatsevent_flatridestats_and_more"),
    ]

    operations = [
        migrations.CreateModel(
            name="KiddieRideStats",
            fields=[
                ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
                (
                    "min_age",
                    models.PositiveIntegerField(blank=True, help_text="Minimum recommended age in years", null=True),
                ),
                (
                    "max_age",
                    models.PositiveIntegerField(blank=True, help_text="Maximum recommended age in years", null=True),
                ),
                (
                    "educational_theme",
                    models.CharField(
                        blank=True,
                        help_text="Educational theme if applicable (e.g., 'Dinosaurs', 'Space')",
                        max_length=200,
                    ),
                ),
                (
                    "character_theme",
                    models.CharField(
                        blank=True,
                        help_text="Character theme if applicable (e.g., 'Paw Patrol', 'Peppa Pig')",
                        max_length=200,
                    ),
                ),
                (
                    "guardian_required",
                    models.BooleanField(default=False, help_text="Whether a guardian must be present during the ride"),
                ),
                (
                    "adult_ride_along",
                    models.BooleanField(default=True, help_text="Whether adults can ride along with children"),
                ),
                (
                    "seats_per_vehicle",
                    models.PositiveIntegerField(blank=True, help_text="Number of seats per ride vehicle", null=True),
                ),
            ],
            options={
                "verbose_name": "Kiddie Ride Statistics",
                "verbose_name_plural": "Kiddie Ride Statistics",
                "ordering": ["ride"],
                "abstract": False,
            },
        ),
        migrations.CreateModel(
            name="KiddieRideStatsEvent",
            fields=[
                ("pgh_id", models.AutoField(primary_key=True, serialize=False)),
                ("pgh_created_at", models.DateTimeField(auto_now_add=True)),
                ("pgh_label", models.TextField(help_text="The event label.")),
                ("id", models.BigIntegerField()),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
                (
                    "min_age",
                    models.PositiveIntegerField(blank=True, help_text="Minimum recommended age in years", null=True),
                ),
                (
                    "max_age",
                    models.PositiveIntegerField(blank=True, help_text="Maximum recommended age in years", null=True),
                ),
                (
                    "educational_theme",
                    models.CharField(
                        blank=True,
                        help_text="Educational theme if applicable (e.g., 'Dinosaurs', 'Space')",
                        max_length=200,
                    ),
                ),
                (
                    "character_theme",
                    models.CharField(
                        blank=True,
                        help_text="Character theme if applicable (e.g., 'Paw Patrol', 'Peppa Pig')",
                        max_length=200,
                    ),
                ),
                (
                    "guardian_required",
                    models.BooleanField(default=False, help_text="Whether a guardian must be present during the ride"),
                ),
                (
                    "adult_ride_along",
                    models.BooleanField(default=True, help_text="Whether adults can ride along with children"),
                ),
                (
                    "seats_per_vehicle",
                    models.PositiveIntegerField(blank=True, help_text="Number of seats per ride vehicle", null=True),
                ),
            ],
            options={
                "abstract": False,
            },
        ),
        migrations.CreateModel(
            name="TransportationStats",
            fields=[
                ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
                (
                    "transport_type",
                    models.CharField(
                        choices=[
                            ("TRAIN", "Train"),
                            ("MONORAIL", "Monorail"),
                            ("SKYLIFT", "Skylift / Chairlift"),
                            ("FERRY", "Ferry / Boat"),
                            ("PEOPLEMOVER", "PeopleMover"),
                            ("CABLE_CAR", "Cable Car"),
                            ("TRAM", "Tram"),
                        ],
                        default="TRAIN",
                        help_text="Type of transportation",
                        max_length=20,
                    ),
                ),
                (
                    "route_length_ft",
                    models.DecimalField(
                        blank=True, decimal_places=2, help_text="Total route length in feet", max_digits=8, null=True
                    ),
                ),
                (
                    "stations_count",
                    models.PositiveIntegerField(
                        blank=True, help_text="Number of stations/stops on the route", null=True
                    ),
                ),
                (
                    "vehicle_capacity",
                    models.PositiveIntegerField(blank=True, help_text="Passenger capacity per vehicle", null=True),
                ),
                (
                    "vehicles_count",
                    models.PositiveIntegerField(
                        blank=True, help_text="Total number of vehicles in operation", null=True
                    ),
                ),
                (
                    "round_trip_duration_minutes",
                    models.PositiveIntegerField(
                        blank=True, help_text="Duration of a complete round trip in minutes", null=True
                    ),
                ),
                (
                    "scenic_highlights",
                    models.TextField(blank=True, help_text="Notable scenic views or attractions along the route"),
                ),
                (
                    "is_one_way",
                    models.BooleanField(
                        default=False, help_text="Whether this is a one-way transportation (vs round-trip)"
                    ),
                ),
            ],
            options={
                "verbose_name": "Transportation Statistics",
                "verbose_name_plural": "Transportation Statistics",
                "ordering": ["ride"],
                "abstract": False,
            },
        ),
        migrations.CreateModel(
            name="TransportationStatsEvent",
            fields=[
                ("pgh_id", models.AutoField(primary_key=True, serialize=False)),
                ("pgh_created_at", models.DateTimeField(auto_now_add=True)),
                ("pgh_label", models.TextField(help_text="The event label.")),
                ("id", models.BigIntegerField()),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
                (
                    "transport_type",
                    models.CharField(
                        choices=[
                            ("TRAIN", "Train"),
                            ("MONORAIL", "Monorail"),
                            ("SKYLIFT", "Skylift / Chairlift"),
                            ("FERRY", "Ferry / Boat"),
                            ("PEOPLEMOVER", "PeopleMover"),
                            ("CABLE_CAR", "Cable Car"),
                            ("TRAM", "Tram"),
                        ],
                        default="TRAIN",
                        help_text="Type of transportation",
                        max_length=20,
                    ),
                ),
                (
                    "route_length_ft",
                    models.DecimalField(
                        blank=True, decimal_places=2, help_text="Total route length in feet", max_digits=8, null=True
                    ),
                ),
                (
                    "stations_count",
                    models.PositiveIntegerField(
                        blank=True, help_text="Number of stations/stops on the route", null=True
                    ),
                ),
                (
                    "vehicle_capacity",
                    models.PositiveIntegerField(blank=True, help_text="Passenger capacity per vehicle", null=True),
                ),
                (
                    "vehicles_count",
                    models.PositiveIntegerField(
                        blank=True, help_text="Total number of vehicles in operation", null=True
                    ),
                ),
                (
                    "round_trip_duration_minutes",
                    models.PositiveIntegerField(
                        blank=True, help_text="Duration of a complete round trip in minutes", null=True
                    ),
                ),
                (
                    "scenic_highlights",
                    models.TextField(blank=True, help_text="Notable scenic views or attractions along the route"),
                ),
                (
                    "is_one_way",
                    models.BooleanField(
                        default=False, help_text="Whether this is a one-way transportation (vs round-trip)"
                    ),
                ),
            ],
            options={
                "abstract": False,
            },
        ),
        migrations.AlterModelOptions(
            name="ridecredit",
            options={
                "ordering": ["display_order", "-last_ridden_at", "-first_ridden_at", "-created_at"],
                "verbose_name": "Ride Credit",
                "verbose_name_plural": "Ride Credits",
            },
        ),
        pgtrigger.migrations.RemoveTrigger(
            model_name="ridecredit",
            name="insert_insert",
        ),
        pgtrigger.migrations.RemoveTrigger(
            model_name="ridecredit",
            name="update_update",
        ),
        migrations.AddField(
            model_name="ridecredit",
            name="display_order",
            field=models.PositiveIntegerField(default=0, help_text="User-defined display order for drag-drop sorting"),
        ),
        migrations.AddField(
            model_name="ridecreditevent",
            name="display_order",
            field=models.PositiveIntegerField(default=0, help_text="User-defined display order for drag-drop sorting"),
        ),
        pgtrigger.migrations.AddTrigger(
            model_name="ridecredit",
            trigger=pgtrigger.compiler.Trigger(
                name="insert_insert",
                sql=pgtrigger.compiler.UpsertTriggerSql(
                    func='INSERT INTO "rides_ridecreditevent" ("count", "created_at", "display_order", "first_ridden_at", "id", "last_ridden_at", "notes", "pgh_context_id", "pgh_created_at", "pgh_label", "pgh_obj_id", "rating", "ride_id", "updated_at", "user_id") VALUES (NEW."count", NEW."created_at", NEW."display_order", NEW."first_ridden_at", NEW."id", NEW."last_ridden_at", NEW."notes", _pgh_attach_context(), NOW(), \'insert\', NEW."id", NEW."rating", NEW."ride_id", NEW."updated_at", NEW."user_id"); RETURN NULL;',
                    hash="680f93dab99a404aea8f73f8328eff04cd561254",
                    operation="INSERT",
                    pgid="pgtrigger_insert_insert_00439",
                    table="rides_ridecredit",
                    when="AFTER",
                ),
            ),
        ),
        pgtrigger.migrations.AddTrigger(
            model_name="ridecredit",
            trigger=pgtrigger.compiler.Trigger(
                name="update_update",
                sql=pgtrigger.compiler.UpsertTriggerSql(
                    condition="WHEN (OLD.* IS DISTINCT FROM NEW.*)",
                    func='INSERT INTO "rides_ridecreditevent" ("count", "created_at", "display_order", "first_ridden_at", "id", "last_ridden_at", "notes", "pgh_context_id", "pgh_created_at", "pgh_label", "pgh_obj_id", "rating", "ride_id", "updated_at", "user_id") VALUES (NEW."count", NEW."created_at", NEW."display_order", NEW."first_ridden_at", NEW."id", NEW."last_ridden_at", NEW."notes", _pgh_attach_context(), NOW(), \'update\', NEW."id", NEW."rating", NEW."ride_id", NEW."updated_at", NEW."user_id"); RETURN NULL;',
                    hash="e9889a572acd9261c1355ab47458f3eaf2b07c13",
                    operation="UPDATE",
                    pgid="pgtrigger_update_update_32a65",
                    table="rides_ridecredit",
                    when="AFTER",
                ),
            ),
        ),
        migrations.AddField(
            model_name="kiddieridestats",
            name="ride",
            field=models.OneToOneField(
                help_text="Ride these kiddie ride statistics belong to",
                on_delete=django.db.models.deletion.CASCADE,
                related_name="kiddie_stats",
                to="rides.ride",
            ),
        ),
        migrations.AddField(
            model_name="kiddieridestatsevent",
            name="pgh_context",
            field=models.ForeignKey(
                db_constraint=False,
                null=True,
                on_delete=django.db.models.deletion.DO_NOTHING,
                related_name="+",
                to="pghistory.context",
            ),
        ),
        migrations.AddField(
            model_name="kiddieridestatsevent",
            name="pgh_obj",
            field=models.ForeignKey(
                db_constraint=False,
                on_delete=django.db.models.deletion.DO_NOTHING,
                related_name="events",
                to="rides.kiddieridestats",
            ),
        ),
        migrations.AddField(
            model_name="kiddieridestatsevent",
            name="ride",
            field=models.ForeignKey(
                db_constraint=False,
                help_text="Ride these kiddie ride statistics belong to",
                on_delete=django.db.models.deletion.DO_NOTHING,
                related_name="+",
                related_query_name="+",
                to="rides.ride",
            ),
        ),
        migrations.AddField(
            model_name="transportationstats",
            name="ride",
            field=models.OneToOneField(
                help_text="Ride these transportation statistics belong to",
                on_delete=django.db.models.deletion.CASCADE,
                related_name="transport_stats",
                to="rides.ride",
            ),
        ),
        migrations.AddField(
            model_name="transportationstatsevent",
            name="pgh_context",
            field=models.ForeignKey(
                db_constraint=False,
                null=True,
                on_delete=django.db.models.deletion.DO_NOTHING,
                related_name="+",
                to="pghistory.context",
            ),
        ),
        migrations.AddField(
            model_name="transportationstatsevent",
            name="pgh_obj",
            field=models.ForeignKey(
                db_constraint=False,
                on_delete=django.db.models.deletion.DO_NOTHING,
                related_name="events",
                to="rides.transportationstats",
            ),
        ),
        migrations.AddField(
            model_name="transportationstatsevent",
            name="ride",
            field=models.ForeignKey(
                db_constraint=False,
                help_text="Ride these transportation statistics belong to",
                on_delete=django.db.models.deletion.DO_NOTHING,
                related_name="+",
                related_query_name="+",
                to="rides.ride",
            ),
        ),
        pgtrigger.migrations.AddTrigger(
            model_name="kiddieridestats",
            trigger=pgtrigger.compiler.Trigger(
                name="insert_insert",
                sql=pgtrigger.compiler.UpsertTriggerSql(
                    func='INSERT INTO "rides_kiddieridestatsevent" ("adult_ride_along", "character_theme", "created_at", "educational_theme", "guardian_required", "id", "max_age", "min_age", "pgh_context_id", "pgh_created_at", "pgh_label", "pgh_obj_id", "ride_id", "seats_per_vehicle", "updated_at") VALUES (NEW."adult_ride_along", NEW."character_theme", NEW."created_at", NEW."educational_theme", NEW."guardian_required", NEW."id", NEW."max_age", NEW."min_age", _pgh_attach_context(), NOW(), \'insert\', NEW."id", NEW."ride_id", NEW."seats_per_vehicle", NEW."updated_at"); RETURN NULL;',
                    hash="b5d181566e5d0710c5b4093a5b61dc54591e5639",
                    operation="INSERT",
                    pgid="pgtrigger_insert_insert_9949f",
                    table="rides_kiddieridestats",
                    when="AFTER",
                ),
            ),
        ),
        pgtrigger.migrations.AddTrigger(
            model_name="kiddieridestats",
            trigger=pgtrigger.compiler.Trigger(
                name="update_update",
                sql=pgtrigger.compiler.UpsertTriggerSql(
                    condition="WHEN (OLD.* IS DISTINCT FROM NEW.*)",
                    func='INSERT INTO "rides_kiddieridestatsevent" ("adult_ride_along", "character_theme", "created_at", "educational_theme", "guardian_required", "id", "max_age", "min_age", "pgh_context_id", "pgh_created_at", "pgh_label", "pgh_obj_id", "ride_id", "seats_per_vehicle", "updated_at") VALUES (NEW."adult_ride_along", NEW."character_theme", NEW."created_at", NEW."educational_theme", NEW."guardian_required", NEW."id", NEW."max_age", NEW."min_age", _pgh_attach_context(), NOW(), \'update\', NEW."id", NEW."ride_id", NEW."seats_per_vehicle", NEW."updated_at"); RETURN NULL;',
                    hash="672bb3e42cda03094d9300b6e0d9d89b2797bd05",
                    operation="UPDATE",
                    pgid="pgtrigger_update_update_fb19d",
                    table="rides_kiddieridestats",
                    when="AFTER",
                ),
            ),
        ),
        pgtrigger.migrations.AddTrigger(
            model_name="transportationstats",
            trigger=pgtrigger.compiler.Trigger(
                name="insert_insert",
                sql=pgtrigger.compiler.UpsertTriggerSql(
                    func='INSERT INTO "rides_transportationstatsevent" ("created_at", "id", "is_one_way", "pgh_context_id", "pgh_created_at", "pgh_label", "pgh_obj_id", "ride_id", "round_trip_duration_minutes", "route_length_ft", "scenic_highlights", "stations_count", "transport_type", "updated_at", "vehicle_capacity", "vehicles_count") VALUES (NEW."created_at", NEW."id", NEW."is_one_way", _pgh_attach_context(), NOW(), \'insert\', NEW."id", NEW."ride_id", NEW."round_trip_duration_minutes", NEW."route_length_ft", NEW."scenic_highlights", NEW."stations_count", NEW."transport_type", NEW."updated_at", NEW."vehicle_capacity", NEW."vehicles_count"); RETURN NULL;',
                    hash="95a70a6e71eb5ea32726a19e5eb6286c20b19952",
                    operation="INSERT",
                    pgid="pgtrigger_insert_insert_c811e",
                    table="rides_transportationstats",
                    when="AFTER",
                ),
            ),
        ),
        pgtrigger.migrations.AddTrigger(
            model_name="transportationstats",
            trigger=pgtrigger.compiler.Trigger(
                name="update_update",
                sql=pgtrigger.compiler.UpsertTriggerSql(
                    condition="WHEN (OLD.* IS DISTINCT FROM NEW.*)",
                    func='INSERT INTO "rides_transportationstatsevent" ("created_at", "id", "is_one_way", "pgh_context_id", "pgh_created_at", "pgh_label", "pgh_obj_id", "ride_id", "round_trip_duration_minutes", "route_length_ft", "scenic_highlights", "stations_count", "transport_type", "updated_at", "vehicle_capacity", "vehicles_count") VALUES (NEW."created_at", NEW."id", NEW."is_one_way", _pgh_attach_context(), NOW(), \'update\', NEW."id", NEW."ride_id", NEW."round_trip_duration_minutes", NEW."route_length_ft", NEW."scenic_highlights", NEW."stations_count", NEW."transport_type", NEW."updated_at", NEW."vehicle_capacity", NEW."vehicles_count"); RETURN NULL;',
                    hash="901b16a5411e78635442895d7107b298634d25c3",
                    operation="UPDATE",
                    pgid="pgtrigger_update_update_ccccf",
                    table="rides_transportationstats",
                    when="AFTER",
                ),
            ),
        ),
    ]
