# Generated by Django 6.0 on 2026-02-06 15:53

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('contenttypes', '0002_remove_content_type_name'),
        ('realtime_chat_messaging', '0001_initial'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        migrations.swappable_dependency(settings.REALTIME_CHAT_MESSAGING_MESSAGE_MODEL),
        migrations.swappable_dependency(settings.REALTIME_CHAT_MESSAGING_ROOMPROPERTY_MODEL),
    ]

    operations = [
        migrations.AddField(
            model_name='room',
            name='last_message',
            field=models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.REALTIME_CHAT_MESSAGING_MESSAGE_MODEL),
        ),
        migrations.AddField(
            model_name='room',
            name='polymorphic_ctype',
            field=models.ForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='polymorphic_%(app_label)s.%(class)s_set+', to='contenttypes.contenttype'),
        ),
        migrations.AddField(
            model_name='room',
            name='property',
            field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='+', to=settings.REALTIME_CHAT_MESSAGING_ROOMPROPERTY_MODEL),
        ),
        migrations.AddField(
            model_name='chatnotification',
            name='message',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='%(app_label)s_%(class)s_notifications', to=settings.REALTIME_CHAT_MESSAGING_MESSAGE_MODEL),
        ),
        migrations.AddField(
            model_name='chatnotification',
            name='recipients',
            field=models.ManyToManyField(related_name='%(app_label)s_%(class)s_unread_messages', to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='message',
            name='delivered_to',
            field=models.ManyToManyField(related_name='+', to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='message',
            name='forwarded_from',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.REALTIME_CHAT_MESSAGING_MESSAGE_MODEL),
        ),
        migrations.AddField(
            model_name='message',
            name='parent_message',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(app_label)s_%(class)s_replies', to=settings.REALTIME_CHAT_MESSAGING_MESSAGE_MODEL),
        ),
        migrations.AddField(
            model_name='message',
            name='room',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='+', to='realtime_chat_messaging.room'),
        ),
        migrations.AddField(
            model_name='message',
            name='sender',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='+', to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='messagemediaasset',
            name='message',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='%(app_label)s_%(class)s_attachments', to=settings.REALTIME_CHAT_MESSAGING_MESSAGE_MODEL),
        ),
        migrations.AddField(
            model_name='reaction',
            name='message',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='%(app_label)s_%(class)s_reactions', to=settings.REALTIME_CHAT_MESSAGING_MESSAGE_MODEL),
        ),
        migrations.AddField(
            model_name='reaction',
            name='user',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='%(app_label)s_%(class)s_reactions', to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='readreceipt',
            name='message',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='%(app_label)s_%(class)s_read_receipts', to=settings.REALTIME_CHAT_MESSAGING_MESSAGE_MODEL),
        ),
        migrations.AddField(
            model_name='readreceipt',
            name='reader',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='session',
            name='user',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='+', to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='channel',
            name='creator',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='+', to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='channel',
            name='moderators',
            field=models.ManyToManyField(related_name='+', to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='channel',
            name='subscribers',
            field=models.ManyToManyField(related_name='+', to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='groupchat',
            name='admins',
            field=models.ManyToManyField(related_name='+', to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='groupchat',
            name='creator',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='+', to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='groupchat',
            name='participants',
            field=models.ManyToManyField(related_name='+', to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='onetoonechat',
            name='participants',
            field=models.ManyToManyField(related_name='+', to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddIndex(
            model_name='message',
            index=models.Index(fields=['content'], name='realtime_ch_content_e6aad5_idx'),
        ),
        migrations.AddIndex(
            model_name='message',
            index=models.Index(fields=['content', 'sender'], name='realtime_ch_content_33f3e8_idx'),
        ),
        migrations.AddConstraint(
            model_name='message',
            constraint=models.CheckConstraint(condition=models.Q(('is_forwarded', True), ('parent_message__isnull', False), _negated=True), name='forwarded_messages_cant_be_replies'),
        ),
        migrations.AddConstraint(
            model_name='messagemediaasset',
            constraint=models.CheckConstraint(condition=models.Q(('mime_type__in', ['image/jpeg', 'image/png', 'image/gif', 'image/webp', 'image/bmp', 'image/heic', 'audio/mpeg', 'audio/mp4', 'audio/aac', 'audio/ogg', 'audio/wav', 'audio/opus', 'video/mp4', 'video/quicktime', 'video/webm', 'video/ogg', 'video/x-msvideo', 'video/x-matroska', 'application/pdf', 'application/msword', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/vnd.ms-powerpoint', 'application/vnd.openxmlformats-officedocument.presentationml.presentation', 'text/plain', 'text/csv'])), name='valid_mime_type'),
        ),
        migrations.AddConstraint(
            model_name='reaction',
            constraint=models.UniqueConstraint(fields=('message', 'user'), name='unique_reaction'),
        ),
        migrations.AddConstraint(
            model_name='readreceipt',
            constraint=models.UniqueConstraint(fields=('message', 'reader'), name='unique_read_receipts'),
        ),
    ]
