# Generated by Django 4.0.3 on 2022-03-08 12:21

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('instant', '0002_alter_channel_level'),
        ('auth', '0012_alter_user_first_name_max_length'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='ChatRoom',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=60, verbose_name='Name')),
                ('slug', models.SlugField(unique=True, verbose_name='Slug')),
                ('level', models.CharField(choices=[('public', 'Public'), ('users', 'Users'), ('groups', 'Groups'), ('staff', 'Staff'), ('superuser', 'Superuser')], max_length=20, verbose_name='Authorized for')),
                ('save_messages', models.BooleanField(default=True, verbose_name='Save messages')),
                ('channel', models.ForeignKey(blank=True, editable=False, null=True, on_delete=django.db.models.deletion.PROTECT, to='instant.channel', verbose_name='Channel')),
                ('groups', models.ManyToManyField(blank=True, to='auth.group', verbose_name='Groups')),
            ],
            options={
                'verbose_name': 'Chat room',
                'verbose_name_plural': 'Chat rooms',
            },
        ),
        migrations.CreateModel(
            name='ChatMessage',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('date', models.DateTimeField(auto_now=True, verbose_name='Date')),
                ('message', models.TextField(verbose_name='Message')),
                ('room', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='rechat.chatroom', verbose_name='Room')),
                ('user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL, verbose_name='User')),
            ],
            options={
                'verbose_name': 'Message',
                'verbose_name_plural': 'Messages',
                'ordering': ['-date'],
            },
        ),
    ]
