# Generated by Django 4.2.16 on 2025-03-04 17:57

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ("eveonline", "0017_alliance_and_corp_names_are_not_unique"),
        ("authentication", "0024_alter_userprofile_language"),
        ("auth", "0012_alter_user_first_name_max_length"),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name="General",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
            ],
            options={
                "permissions": (("basic_access", "Can access this app"),),
                "managed": False,
                "default_permissions": (),
            },
        ),
        migrations.CreateModel(
            name="WandererManagedMap",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "name",
                    models.CharField(
                        help_text="User friendly name for your users to recognize the map",
                        max_length=80,
                    ),
                ),
                (
                    "wanderer_url",
                    models.CharField(
                        help_text="URL of the wanderer instance", max_length=120
                    ),
                ),
                (
                    "map_slug",
                    models.CharField(
                        help_text="Map slug on the wanderer instance", max_length=20
                    ),
                ),
                (
                    "map_api_key",
                    models.CharField(help_text="API key of the map", max_length=100),
                ),
                (
                    "map_acl_id",
                    models.CharField(
                        help_text="ID of the managed access list", max_length=100
                    ),
                ),
                (
                    "map_acl_api_key",
                    models.CharField(
                        help_text="API key of the managed access list", max_length=100
                    ),
                ),
                (
                    "alliance_access",
                    models.ManyToManyField(
                        blank=True,
                        help_text="Alliances to whose members this map is available.",
                        to="eveonline.eveallianceinfo",
                    ),
                ),
                (
                    "character_access",
                    models.ManyToManyField(
                        blank=True,
                        help_text="Characters to which this map is available.",
                        to="eveonline.evecharacter",
                    ),
                ),
                (
                    "corporation_access",
                    models.ManyToManyField(
                        blank=True,
                        help_text="Corporations to whose members this map is available.",
                        to="eveonline.evecorporationinfo",
                    ),
                ),
                (
                    "faction_access",
                    models.ManyToManyField(
                        blank=True,
                        help_text="Factions to whose members this map is available.",
                        to="eveonline.evefactioninfo",
                    ),
                ),
                (
                    "group_access",
                    models.ManyToManyField(
                        blank=True,
                        help_text="Groups to whose members this map is available.",
                        to="auth.group",
                    ),
                ),
                (
                    "state_access",
                    models.ManyToManyField(
                        blank=True,
                        help_text="States to whose members this map is available.",
                        to="authentication.state",
                    ),
                ),
            ],
        ),
        migrations.CreateModel(
            name="WandererAccount",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "user",
                    models.ForeignKey(
                        help_text="Auth user linked to the map",
                        on_delete=django.db.models.deletion.CASCADE,
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "wanderer_map",
                    models.ForeignKey(
                        help_text="Wanderer map to which the user is linked",
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="accounts",
                        related_query_name="account",
                        to="wanderer.wanderermanagedmap",
                    ),
                ),
            ],
        ),
        migrations.AddConstraint(
            model_name="wanderermanagedmap",
            constraint=models.UniqueConstraint(
                fields=("wanderer_url", "map_slug"), name="functional_pk_urlslug"
            ),
        ),
        migrations.AddConstraint(
            model_name="wandereraccount",
            constraint=models.UniqueConstraint(
                fields=("user", "wanderer_map"), name="functional_pk_user_map"
            ),
        ),
    ]
