# Generated by Django 5.2.8 on 2025-12-06 15:03

import apps.sigils.fields
import django.core.validators
import django.db.models.deletion
from django.db import migrations, models


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ("chats", "0002_initial"),
        ("groups", "0002_initial"),
    ]

    operations = [
        migrations.CreateModel(
            name="DiscordProfile",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("is_seed_data", models.BooleanField(default=False, editable=False)),
                ("is_user_data", models.BooleanField(default=False, editable=False)),
                ("is_deleted", models.BooleanField(default=False, editable=False)),
                (
                    "application_id",
                    models.CharField(
                        blank=True,
                        help_text="Discord application ID used to control the bot.",
                        max_length=32,
                    ),
                ),
                (
                    "public_key",
                    models.CharField(
                        blank=True,
                        help_text="Discord public key used to verify interaction requests.",
                        max_length=128,
                    ),
                ),
                (
                    "guild_id",
                    models.CharField(
                        blank=True,
                        help_text="Discord guild (server) identifier where the bot should operate.",
                        max_length=32,
                    ),
                ),
                (
                    "bot_token",
                    apps.sigils.fields.SigilShortAutoField(
                        blank=True,
                        help_text="Discord bot token required for authenticated actions.",
                        max_length=255,
                    ),
                ),
                (
                    "default_channel_id",
                    models.CharField(
                        blank=True,
                        help_text="Optional Discord channel identifier used for default messaging.",
                        max_length=32,
                    ),
                ),
            ],
            options={
                "verbose_name": "Discord Identity",
                "verbose_name_plural": "Discord Identities",
                "abstract": False,
            },
        ),
        migrations.CreateModel(
            name="BlueskyProfile",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("is_seed_data", models.BooleanField(default=False, editable=False)),
                ("is_user_data", models.BooleanField(default=False, editable=False)),
                ("is_deleted", models.BooleanField(default=False, editable=False)),
                (
                    "handle",
                    models.CharField(
                        blank=True,
                        help_text="Bluesky handle that should resolve to Arthexis. Use the verified domain (for example arthexis.com).",
                        max_length=253,
                        validators=[
                            django.core.validators.RegexValidator(
                                code="invalid",
                                message="Enter a valid domain name such as example.com.",
                                regex="^(?=.{1,253}\\Z)(?!-)[A-Za-z0-9-]{1,63}(?<!-)(\\.(?!-)[A-Za-z0-9-]{1,63}(?<!-))*$",
                            )
                        ],
                    ),
                ),
                (
                    "domain",
                    models.CharField(
                        blank=True,
                        help_text="Domain that hosts the Bluesky verification. Publish a _atproto TXT record or a /.well-known/atproto-did file with the DID below.",
                        max_length=253,
                        validators=[
                            django.core.validators.RegexValidator(
                                code="invalid",
                                message="Enter a valid domain name such as example.com.",
                                regex="^(?=.{1,253}\\Z)(?!-)[A-Za-z0-9-]{1,63}(?<!-)(\\.(?!-)[A-Za-z0-9-]{1,63}(?<!-))*$",
                            )
                        ],
                    ),
                ),
                (
                    "did",
                    models.CharField(
                        blank=True,
                        help_text="Optional DID that Bluesky assigns once the domain is linked (for example did:plc:1234abcd).",
                        max_length=255,
                        validators=[
                            django.core.validators.RegexValidator(
                                code="invalid",
                                message="Enter a valid DID such as did:plc:1234abcd.",
                                regex="^(|did:[a-z0-9]+:[A-Za-z0-9.\\-_:]+)$",
                            )
                        ],
                    ),
                ),
                (
                    "avatar",
                    models.OneToOneField(
                        blank=True,
                        help_text="Chat avatar that owns this profile.",
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="%(app_label)s_%(class)s",
                        to="chats.chatavatar",
                    ),
                ),
                (
                    "group",
                    models.OneToOneField(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="+",
                        to="groups.securitygroup",
                    ),
                ),
            ],
            options={
                "verbose_name": "Bluesky Identity",
                "verbose_name_plural": "Bluesky Identities",
                "abstract": False,
            },
        ),
    ]
