# Generated by Django 5.2.9 on 2026-01-02 00:10

import apps.core.state_machine.fields
import pgtrigger.compiler
import pgtrigger.migrations
from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ("parks", "0026_remove_park_insert_insert_remove_park_update_update_and_more"),
    ]

    operations = [
        pgtrigger.migrations.RemoveTrigger(
            model_name="company",
            name="insert_insert",
        ),
        pgtrigger.migrations.RemoveTrigger(
            model_name="company",
            name="update_update",
        ),
        migrations.AddField(
            model_name="company",
            name="average_rating",
            field=models.DecimalField(
                blank=True,
                decimal_places=2,
                help_text="Average rating from reviews (auto-calculated)",
                max_digits=3,
                null=True,
            ),
        ),
        migrations.AddField(
            model_name="company",
            name="banner_image_url",
            field=models.URLField(blank=True, help_text="Banner image for company page header"),
        ),
        migrations.AddField(
            model_name="company",
            name="card_image_url",
            field=models.URLField(blank=True, help_text="Card/thumbnail image for listings"),
        ),
        migrations.AddField(
            model_name="company",
            name="founded_date",
            field=models.DateField(blank=True, help_text="Full founding date if known", null=True),
        ),
        migrations.AddField(
            model_name="company",
            name="founded_date_precision",
            field=models.CharField(
                blank=True,
                choices=[("YEAR", "Year only"), ("MONTH", "Month and year"), ("DAY", "Full date")],
                help_text="Precision of the founding date",
                max_length=10,
            ),
        ),
        migrations.AddField(
            model_name="company",
            name="logo_url",
            field=models.URLField(blank=True, help_text="Company logo image URL"),
        ),
        migrations.AddField(
            model_name="company",
            name="person_type",
            field=models.CharField(
                blank=True,
                choices=[
                    ("INDIVIDUAL", "Individual"),
                    ("FIRM", "Firm"),
                    ("ORGANIZATION", "Organization"),
                    ("CORPORATION", "Corporation"),
                    ("PARTNERSHIP", "Partnership"),
                    ("GOVERNMENT", "Government Entity"),
                ],
                help_text="Type of entity (individual, firm, organization, etc.)",
                max_length=20,
            ),
        ),
        migrations.AddField(
            model_name="company",
            name="review_count",
            field=models.PositiveIntegerField(default=0, help_text="Total number of reviews (auto-calculated)"),
        ),
        migrations.AddField(
            model_name="company",
            name="status",
            field=models.CharField(
                choices=[
                    ("ACTIVE", "Active"),
                    ("DEFUNCT", "Defunct"),
                    ("MERGED", "Merged"),
                    ("ACQUIRED", "Acquired"),
                    ("RENAMED", "Renamed"),
                    ("DORMANT", "Dormant"),
                ],
                default="ACTIVE",
                help_text="Current operational status of the company",
                max_length=20,
            ),
        ),
        migrations.AddField(
            model_name="companyevent",
            name="average_rating",
            field=models.DecimalField(
                blank=True,
                decimal_places=2,
                help_text="Average rating from reviews (auto-calculated)",
                max_digits=3,
                null=True,
            ),
        ),
        migrations.AddField(
            model_name="companyevent",
            name="banner_image_url",
            field=models.URLField(blank=True, help_text="Banner image for company page header"),
        ),
        migrations.AddField(
            model_name="companyevent",
            name="card_image_url",
            field=models.URLField(blank=True, help_text="Card/thumbnail image for listings"),
        ),
        migrations.AddField(
            model_name="companyevent",
            name="founded_date",
            field=models.DateField(blank=True, help_text="Full founding date if known", null=True),
        ),
        migrations.AddField(
            model_name="companyevent",
            name="founded_date_precision",
            field=models.CharField(
                blank=True,
                choices=[("YEAR", "Year only"), ("MONTH", "Month and year"), ("DAY", "Full date")],
                help_text="Precision of the founding date",
                max_length=10,
            ),
        ),
        migrations.AddField(
            model_name="companyevent",
            name="logo_url",
            field=models.URLField(blank=True, help_text="Company logo image URL"),
        ),
        migrations.AddField(
            model_name="companyevent",
            name="person_type",
            field=models.CharField(
                blank=True,
                choices=[
                    ("INDIVIDUAL", "Individual"),
                    ("FIRM", "Firm"),
                    ("ORGANIZATION", "Organization"),
                    ("CORPORATION", "Corporation"),
                    ("PARTNERSHIP", "Partnership"),
                    ("GOVERNMENT", "Government Entity"),
                ],
                help_text="Type of entity (individual, firm, organization, etc.)",
                max_length=20,
            ),
        ),
        migrations.AddField(
            model_name="companyevent",
            name="review_count",
            field=models.PositiveIntegerField(default=0, help_text="Total number of reviews (auto-calculated)"),
        ),
        migrations.AddField(
            model_name="companyevent",
            name="status",
            field=models.CharField(
                choices=[
                    ("ACTIVE", "Active"),
                    ("DEFUNCT", "Defunct"),
                    ("MERGED", "Merged"),
                    ("ACQUIRED", "Acquired"),
                    ("RENAMED", "Renamed"),
                    ("DORMANT", "Dormant"),
                ],
                default="ACTIVE",
                help_text="Current operational status of the company",
                max_length=20,
            ),
        ),
        migrations.AlterField(
            model_name="park",
            name="status",
            field=apps.core.state_machine.fields.RichFSMField(
                allow_deprecated=False,
                choice_group="statuses",
                choices=[
                    ("OPERATING", "Operating"),
                    ("CLOSED_TEMP", "Temporarily Closed"),
                    ("CLOSED_PERM", "Permanently Closed"),
                    ("UNDER_CONSTRUCTION", "Under Construction"),
                    ("DEMOLISHED", "Demolished"),
                    ("RELOCATED", "Relocated"),
                ],
                default="OPERATING",
                domain="parks",
                max_length=20,
            ),
        ),
        migrations.AlterField(
            model_name="parkevent",
            name="status",
            field=apps.core.state_machine.fields.RichFSMField(
                allow_deprecated=False,
                choice_group="statuses",
                choices=[
                    ("OPERATING", "Operating"),
                    ("CLOSED_TEMP", "Temporarily Closed"),
                    ("CLOSED_PERM", "Permanently Closed"),
                    ("UNDER_CONSTRUCTION", "Under Construction"),
                    ("DEMOLISHED", "Demolished"),
                    ("RELOCATED", "Relocated"),
                ],
                default="OPERATING",
                domain="parks",
                max_length=20,
            ),
        ),
        pgtrigger.migrations.AddTrigger(
            model_name="company",
            trigger=pgtrigger.compiler.Trigger(
                name="insert_insert",
                sql=pgtrigger.compiler.UpsertTriggerSql(
                    func='INSERT INTO "parks_companyevent" ("average_rating", "banner_image_url", "card_image_url", "created_at", "description", "founded_date", "founded_date_precision", "founded_year", "id", "logo_url", "name", "parks_count", "person_type", "pgh_context_id", "pgh_created_at", "pgh_label", "pgh_obj_id", "review_count", "rides_count", "roles", "slug", "status", "updated_at", "website") VALUES (NEW."average_rating", NEW."banner_image_url", NEW."card_image_url", NEW."created_at", NEW."description", NEW."founded_date", NEW."founded_date_precision", NEW."founded_year", NEW."id", NEW."logo_url", NEW."name", NEW."parks_count", NEW."person_type", _pgh_attach_context(), NOW(), \'insert\', NEW."id", NEW."review_count", NEW."rides_count", NEW."roles", NEW."slug", NEW."status", NEW."updated_at", NEW."website"); RETURN NULL;',
                    hash="048dba77acb14b06b8ae12f5f05710f0da71e3fd",
                    operation="INSERT",
                    pgid="pgtrigger_insert_insert_35b57",
                    table="parks_company",
                    when="AFTER",
                ),
            ),
        ),
        pgtrigger.migrations.AddTrigger(
            model_name="company",
            trigger=pgtrigger.compiler.Trigger(
                name="update_update",
                sql=pgtrigger.compiler.UpsertTriggerSql(
                    condition="WHEN (OLD.* IS DISTINCT FROM NEW.*)",
                    func='INSERT INTO "parks_companyevent" ("average_rating", "banner_image_url", "card_image_url", "created_at", "description", "founded_date", "founded_date_precision", "founded_year", "id", "logo_url", "name", "parks_count", "person_type", "pgh_context_id", "pgh_created_at", "pgh_label", "pgh_obj_id", "review_count", "rides_count", "roles", "slug", "status", "updated_at", "website") VALUES (NEW."average_rating", NEW."banner_image_url", NEW."card_image_url", NEW."created_at", NEW."description", NEW."founded_date", NEW."founded_date_precision", NEW."founded_year", NEW."id", NEW."logo_url", NEW."name", NEW."parks_count", NEW."person_type", _pgh_attach_context(), NOW(), \'update\', NEW."id", NEW."review_count", NEW."rides_count", NEW."roles", NEW."slug", NEW."status", NEW."updated_at", NEW."website"); RETURN NULL;',
                    hash="4a93422ca4b79608f941be5baed899d691d88d97",
                    operation="UPDATE",
                    pgid="pgtrigger_update_update_d3286",
                    table="parks_company",
                    when="AFTER",
                ),
            ),
        ),
    ]
