# Generated by Django 6.0.4 on 2026-06-06 02:55

import apps.chat.models
from django.db import migrations, models


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Conversation',
            fields=[
                ('id', models.UUIDField(default=apps.chat.models.uuid7, editable=False, primary_key=True, serialize=False)),
                ('name', models.CharField(blank=True, max_length=255)),
                ('kind', models.CharField(choices=[('direct', 'Direct'), ('group', 'Group'), ('channel', 'Channel')], default='direct', max_length=16)),
                ('is_group', models.BooleanField(default=False)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
            ],
            options={
                'db_table': 'chat_conversations',
                'ordering': ['-updated_at'],
            },
        ),
        migrations.CreateModel(
            name='ConversationParticipant',
            fields=[
                ('id', models.UUIDField(default=apps.chat.models.uuid7, editable=False, primary_key=True, serialize=False)),
                ('joined_at', models.DateTimeField(auto_now_add=True)),
                ('last_read_at', models.DateTimeField(blank=True, null=True)),
                ('is_admin', models.BooleanField(default=False)),
            ],
            options={
                'db_table': 'chat_conversation_participants',
            },
        ),
        migrations.CreateModel(
            name='Message',
            fields=[
                ('id', models.UUIDField(default=apps.chat.models.uuid7, editable=False, primary_key=True, serialize=False)),
                ('ciphertext', models.TextField(blank=True, default='')),
                ('content_nonce', models.CharField(blank=True, default='', max_length=64)),
                ('has_attachments', models.BooleanField(default=False)),
                ('is_read', models.BooleanField(default=False)),
                ('read_at', models.DateTimeField(blank=True, null=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
            ],
            options={
                'db_table': 'chat_messages',
                'ordering': ['created_at'],
            },
        ),
        migrations.CreateModel(
            name='MessageAttachment',
            fields=[
                ('id', models.UUIDField(default=apps.chat.models.uuid7, editable=False, primary_key=True, serialize=False)),
                ('encrypted_file', models.FileField(upload_to='chat/attachments/%Y/%m/')),
                ('file_nonce', models.CharField(max_length=64)),
                ('encrypted_filename', models.TextField()),
                ('filename_nonce', models.CharField(max_length=64)),
                ('mime_hint', models.CharField(blank=True, default='application/octet-stream', max_length=128)),
                ('size', models.BigIntegerField(default=0)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
            ],
            options={
                'db_table': 'chat_message_attachments',
                'ordering': ['created_at'],
            },
        ),
        migrations.CreateModel(
            name='MessageKeyWrap',
            fields=[
                ('id', models.UUIDField(default=apps.chat.models.uuid7, editable=False, primary_key=True, serialize=False)),
                ('wrapped_key', models.TextField()),
                ('wrap_nonce', models.CharField(max_length=64)),
            ],
            options={
                'db_table': 'chat_message_key_wraps',
            },
        ),
        migrations.CreateModel(
            name='MessageReaction',
            fields=[
                ('id', models.UUIDField(default=apps.chat.models.uuid7, editable=False, primary_key=True, serialize=False)),
                ('reaction', models.CharField(max_length=50)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
            ],
            options={
                'db_table': 'chat_message_reactions',
            },
        ),
        migrations.CreateModel(
            name='UserKey',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('public_key', models.CharField(max_length=128)),
                ('private_key_escrow', models.TextField(blank=True, default='')),
                ('escrow_claimed', models.BooleanField(default=False)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('rotated_at', models.DateTimeField(auto_now=True)),
            ],
            options={
                'db_table': 'chat_user_keys',
            },
        ),
    ]
