# Generated by Django 5.1.10 on 2025-08-15 03:21

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


class Migration(migrations.Migration):

    dependencies = [
        ("access", "0011_remove_entitynotes_model_and_more"),
        ("core", "0024_centurionaudit_centurionmodelnote_and_more"),
        ("settings", "0012_alter_appsettings_global_organization_and_more"),
    ]

    operations = [
        migrations.RemoveField(
            model_name="externallink",
            name="is_global",
        ),
        migrations.AlterField(
            model_name="appsettings",
            name="global_organization",
            field=models.ForeignKey(
                blank=True,
                help_text="Tenant global items will be created in",
                null=True,
                on_delete=django.db.models.deletion.PROTECT,
                related_name="global_organization",
                to="access.tenant",
                verbose_name="Global Tenant",
            ),
        ),
        migrations.AlterField(
            model_name="appsettings",
            name="id",
            field=models.AutoField(
                help_text="ID of the item",
                primary_key=True,
                serialize=False,
                unique=True,
                verbose_name="ID",
            ),
        ),
        migrations.AlterField(
            model_name="appsettings",
            name="owner_organization",
            field=models.ForeignKey(
                blank=True,
                help_text="Tenant the settings belong to",
                null=True,
                on_delete=django.db.models.deletion.CASCADE,
                related_name="owner_organization",
                to="access.tenant",
            ),
        ),
        migrations.AlterField(
            model_name="externallink",
            name="colour",
            field=models.CharField(
                blank=True,
                help_text="Colour to render the link button. Use HTML colour code",
                max_length=80,
                null=True,
                verbose_name="Button Colour",
            ),
        ),
        migrations.AlterField(
            model_name="externallink",
            name="id",
            field=models.AutoField(
                help_text="ID of the item",
                primary_key=True,
                serialize=False,
                unique=True,
                verbose_name="ID",
            ),
        ),
        migrations.AlterField(
            model_name="externallink",
            name="model_notes",
            field=models.TextField(
                blank=True,
                help_text="Tid bits of information",
                null=True,
                verbose_name="Notes",
            ),
        ),
        migrations.AlterField(
            model_name="externallink",
            name="organization",
            field=models.ForeignKey(
                help_text="Tenant this belongs to",
                on_delete=django.db.models.deletion.CASCADE,
                related_name="+",
                to="access.tenant",
                validators=[
                    access.models.tenancy_abstract.TenancyAbstractModel.validatate_organization_exists
                ],
                verbose_name="Tenant",
            ),
        ),
        migrations.AlterField(
            model_name="usersettings",
            name="default_organization",
            field=models.ForeignKey(
                blank=True,
                help_text="Users default Tenant",
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                to="access.tenant",
                verbose_name="Default Tenant",
            ),
        ),
        migrations.AlterField(
            model_name="usersettings",
            name="id",
            field=models.AutoField(
                help_text="ID of the item",
                primary_key=True,
                serialize=False,
                unique=True,
                verbose_name="ID",
            ),
        ),
        migrations.CreateModel(
            name="AppSettingsAuditHistory",
            fields=[
                (
                    "centurionaudit_ptr",
                    models.OneToOneField(
                        auto_created=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        parent_link=True,
                        primary_key=True,
                        serialize=False,
                        to="core.centurionaudit",
                    ),
                ),
                (
                    "model",
                    models.ForeignKey(
                        help_text="Model this history belongs to",
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="audit_history",
                        to="settings.appsettings",
                        verbose_name="Model",
                    ),
                ),
            ],
            options={
                "verbose_name": "App Settings History",
                "verbose_name_plural": "App Settings Histories",
                "db_table": "settings_appsettings_audithistory",
                "managed": True,
            },
            bases=("core.centurionaudit",),
        ),
        migrations.CreateModel(
            name="ExternalLinkAuditHistory",
            fields=[
                (
                    "centurionaudit_ptr",
                    models.OneToOneField(
                        auto_created=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        parent_link=True,
                        primary_key=True,
                        serialize=False,
                        to="core.centurionaudit",
                    ),
                ),
                (
                    "model",
                    models.ForeignKey(
                        help_text="Model this history belongs to",
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="audit_history",
                        to="settings.externallink",
                        verbose_name="Model",
                    ),
                ),
            ],
            options={
                "verbose_name": "External Link History",
                "verbose_name_plural": "External Link Histories",
                "db_table": "settings_externallink_audithistory",
                "managed": True,
            },
            bases=("core.centurionaudit",),
        ),
        migrations.CreateModel(
            name="ExternalLinkCenturionModelNote",
            fields=[
                (
                    "centurionmodelnote_ptr",
                    models.OneToOneField(
                        auto_created=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        parent_link=True,
                        primary_key=True,
                        serialize=False,
                        to="core.centurionmodelnote",
                    ),
                ),
                (
                    "model",
                    models.ForeignKey(
                        help_text="Model this note belongs to",
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="+",
                        to="settings.externallink",
                        verbose_name="Model",
                    ),
                ),
            ],
            options={
                "verbose_name": "External Link Note",
                "verbose_name_plural": "External Link Notes",
                "db_table": "settings_externallink_centurionmodelnote",
                "managed": True,
            },
            bases=("core.centurionmodelnote",),
        ),
    ]
