# Generated by Django 5.2.4 on 2025-10-05 19:43

import core.fields
import django.core.validators
import re
from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ("core", "0064_alter_clientreport_options"),
    ]

    operations = [
        migrations.RemoveConstraint(
            model_name="socialprofile",
            name="socialprofile_network_handle",
        ),
        migrations.RemoveConstraint(
            model_name="socialprofile",
            name="socialprofile_network_domain",
        ),
        migrations.AddField(
            model_name="socialprofile",
            name="application_id",
            field=models.CharField(
                blank=True,
                help_text="Discord application ID used to control the bot.",
                max_length=32,
            ),
        ),
        migrations.AddField(
            model_name="socialprofile",
            name="bot_token",
            field=core.fields.SigilShortAutoField(
                blank=True,
                help_text="Discord bot token required for authenticated actions.",
                max_length=255,
            ),
        ),
        migrations.AddField(
            model_name="socialprofile",
            name="default_channel_id",
            field=models.CharField(
                blank=True,
                help_text="Optional Discord channel identifier used for default messaging.",
                max_length=32,
            ),
        ),
        migrations.AddField(
            model_name="socialprofile",
            name="guild_id",
            field=models.CharField(
                blank=True,
                help_text="Discord guild (server) identifier where the bot should operate.",
                max_length=32,
            ),
        ),
        migrations.AddField(
            model_name="socialprofile",
            name="public_key",
            field=models.CharField(
                blank=True,
                help_text="Discord public key used to verify interaction requests.",
                max_length=128,
            ),
        ),
        migrations.AlterField(
            model_name="socialprofile",
            name="domain",
            field=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=re.compile(
                            "^(?=.{1,253}\\Z)(?!-)[A-Za-z0-9-]{1,63}(?<!-)(\\.(?!-)[A-Za-z0-9-]{1,63}(?<!-))*$"
                        ),
                    )
                ],
            ),
        ),
        migrations.AlterField(
            model_name="socialprofile",
            name="handle",
            field=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=re.compile(
                            "^(?=.{1,253}\\Z)(?!-)[A-Za-z0-9-]{1,63}(?<!-)(\\.(?!-)[A-Za-z0-9-]{1,63}(?<!-))*$"
                        ),
                    )
                ],
            ),
        ),
        migrations.AlterField(
            model_name="socialprofile",
            name="network",
            field=models.CharField(
                choices=[("bluesky", "Bluesky"), ("discord", "Discord")],
                default="bluesky",
                help_text="Select the social network you want to connect. Bluesky and Discord are supported.",
                max_length=32,
            ),
        ),
        migrations.AddConstraint(
            model_name="socialprofile",
            constraint=models.UniqueConstraint(
                condition=models.Q(("handle", ""), _negated=True),
                fields=("network", "handle"),
                name="socialprofile_network_handle",
            ),
        ),
        migrations.AddConstraint(
            model_name="socialprofile",
            constraint=models.UniqueConstraint(
                condition=models.Q(("domain", ""), _negated=True),
                fields=("network", "domain"),
                name="socialprofile_network_domain",
            ),
        ),
    ]
