# Generated by Django 4.2.2 on 2026-08-19 13:44

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


class Migration(migrations.Migration):

    dependencies = [
        ('authentication', '0004_alter_accountpreference_id'),
    ]

    operations = [
        migrations.CreateModel(
            name='Group',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255)),
                ('domain', models.CharField(max_length=255)),
                ('members', models.ManyToManyField(related_name='member_of_groups', to='authentication.knownidentity')),
            ],
        ),
        migrations.CreateModel(
            name='GroupInviteIncoming',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('secret', models.CharField(max_length=255)),
                ('group_name', models.CharField(max_length=255)),
                ('group_domain', models.CharField(max_length=255)),
                ('inviter_username', models.CharField(max_length=255)),
                ('inviter_domain', models.CharField(max_length=255)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('invitee_user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='group_invites_incoming', to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='GroupInvite',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('secret', models.CharField(max_length=255)),
                ('invitee_username', models.CharField(max_length=255)),
                ('invitee_domain', models.CharField(max_length=255)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('group', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='invites', to='authentication.group')),
            ],
        ),
        migrations.AddIndex(
            model_name='group',
            index=models.Index(fields=['name', 'domain'], name='group_idx'),
        ),
        migrations.AlterUniqueTogether(
            name='group',
            unique_together={('name', 'domain')},
        ),
    ]
