# -*- coding: utf-8 -*-
# Generated by Django 1.9.8 on 2016-07-24 12:02


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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='Messages',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('body', models.TextField()),
                ('created', models.DateTimeField(editable=False)),
                ('is_deleted', models.BooleanField(default=False)),
                ('parent', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='pl_messages.Messages')),
                ('sender', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='message_sender', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': 'Message',
                'verbose_name_plural': 'Messages',
            },
        ),
        migrations.CreateModel(
            name='ParticipantNotifications',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('message_count', models.IntegerField(default=0)),
                ('updated', models.DateTimeField(auto_now=True)),
                ('status', models.BooleanField(default=False)),
                ('participant', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='notified_participant', to=settings.AUTH_USER_MODEL, verbose_name=b'Notification Participant')),
            ],
            options={
                'verbose_name': 'Participant Notification',
                'verbose_name_plural': 'Participant Notifications',
            },
        ),
        migrations.CreateModel(
            name='ParticipantThreads',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('participant', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='thread_participant', to=settings.AUTH_USER_MODEL, verbose_name=b'Thread Participant')),
            ],
            options={
                'verbose_name': 'Participant Thread',
                'verbose_name_plural': 'Participant Threads',
            },
        ),
        migrations.CreateModel(
            name='Thread',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', models.DateTimeField(editable=False)),
                ('updated', models.DateTimeField(auto_now=True)),
                ('is_deleted', models.BooleanField(default=False)),
                ('last_message', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='last_message_in_thread', to='pl_messages.Messages', verbose_name=b'Last Message')),
                ('messages', models.ManyToManyField(related_name='thread_messages', to='pl_messages.Messages', verbose_name=b'Thread Messages')),
                ('participants', models.ManyToManyField(related_name='thread_participants', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': 'Thread',
                'verbose_name_plural': 'Threads',
            },
        ),
        migrations.AddField(
            model_name='participantthreads',
            name='threads',
            field=models.ManyToManyField(related_name='participant_threads', to='pl_messages.Thread', verbose_name=b'Participant Threads'),
        ),
        migrations.AddField(
            model_name='participantnotifications',
            name='thread',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='participant_thread', to='pl_messages.Thread'),
        ),
    ]
