# Generated by Django 2.2.6 on 2019-11-16 19:32

from django.conf import settings
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import re


class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='Channel',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('slug', models.SlugField(unique=True, validators=[django.core.validators.RegexValidator(re.compile('^[-\\w]+\\Z'), "Enter a valid 'slug' consisting of Unicode letters, numbers, underscores, or hyphens.", 'invalid')])),
                ('name', models.CharField(max_length=64)),
                ('autojoin', models.BooleanField(default=False)),
                ('key', models.CharField(max_length=32)),
                ('games', models.BooleanField(default=False)),
                ('chat', models.BooleanField(default=False)),
                ('statistic_commands', models.BooleanField(default=False)),
                ('last_event_type', models.CharField(choices=[('cm', 'channel message'), ('ca', 'channel action'), ('cn', 'channel notice'), ('ct', 'channel topic'), ('ck', 'channel password'), ('ci', 'channel invite'), ('cj', 'channel join'), ('cp', 'channel part'), ('ck', 'channel kick'), ('kd', 'channel kicked'), ('mc', 'mode change')], max_length=2)),
                ('last_event_datetime', models.DateTimeField(auto_now=True)),
                ('last_event_content', models.CharField(max_length=307, null=True)),
                ('last_event_channel', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='rotbot.Channel')),
            ],
        ),
        migrations.CreateModel(
            name='Network',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=40, unique=True, validators=[django.core.validators.MaxLengthValidator(40)])),
                ('slug', models.SlugField(unique=True, validators=[django.core.validators.RegexValidator(re.compile('^[-\\w]+\\Z'), "Enter a valid 'slug' consisting of Unicode letters, numbers, underscores, or hyphens.", 'invalid')])),
                ('nickname', models.CharField(default='RotBot', max_length=31, validators=[django.core.validators.MaxLengthValidator(31)])),
                ('username', models.CharField(default='pyRot', max_length=31, validators=[django.core.validators.MaxLengthValidator(31)])),
                ('password', models.CharField(blank=True, max_length=31, null=True, validators=[django.core.validators.MaxLengthValidator(31)])),
                ('mail', models.EmailField(max_length=254)),
                ('home_channel', models.CharField(default='#RotBot', max_length=64, validators=[django.core.validators.MaxLengthValidator(64)])),
                ('command_character', models.CharField(default='!', max_length=1, validators=[django.core.validators.MaxLengthValidator(1)])),
                ('help_character', models.CharField(default='@', max_length=1, validators=[django.core.validators.MaxLengthValidator(1)])),
                ('enabled', models.BooleanField(default=True)),
            ],
            options={
                'ordering': ['name'],
            },
        ),
        migrations.CreateModel(
            name='User',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('slug', models.SlugField(unique=True, validators=[django.core.validators.RegexValidator(re.compile('^[-\\w]+\\Z'), "Enter a valid 'slug' consisting of Unicode letters, numbers, underscores, or hyphens.", 'invalid')])),
                ('name', models.CharField(max_length=31)),
                ('last_event_type', models.CharField(choices=[('pm', 'private message'), ('pa', 'private action'), ('pn', 'private notice'), ('cm', 'channel message'), ('ca', 'channel action'), ('cn', 'channel notice'), ('ct', 'channel topic'), ('ck', 'channel password'), ('ci', 'channel invite'), ('cj', 'channel join'), ('cp', 'channel part'), ('ck', 'channel kick'), ('kd', 'channel kicked'), ('mc', 'mode change'), ('nc', 'nick change'), ('sq', 'quit')], max_length=2)),
                ('last_event_datetime', models.DateTimeField(auto_now=True)),
                ('last_event_content', models.CharField(max_length=307, null=True)),
                ('xp_spent', models.PositiveIntegerField(default=0)),
                ('level', models.PositiveIntegerField(default=0)),
                ('coin', models.PositiveIntegerField(default=0)),
                ('coin_given', models.PositiveIntegerField(default=0)),
                ('coin_spent', models.PositiveIntegerField(default=0)),
                ('ap_spent', models.PositiveIntegerField(default=0)),
                ('karma_correction', models.PositiveIntegerField(default=0)),
                ('no_chat', models.BooleanField(default=False)),
                ('aliasses', models.ManyToManyField(related_name='_user_aliasses_+', to='rotbot.User')),
                ('last_event_channel', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='rotbot.Channel')),
                ('last_event_subject', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='user_subject', to='rotbot.User')),
                ('last_event_user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='rotbot.User')),
                ('network', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='rotbot.Network')),
            ],
            options={
                'unique_together': {('network', 'name')},
            },
        ),
        migrations.CreateModel(
            name='TempChannelKey',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('key', models.CharField(max_length=40, unique=True)),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('channel', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='rotbot.Channel')),
                ('network', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='rotbot.Network')),
            ],
        ),
        migrations.CreateModel(
            name='Owner',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('source', models.CharField(max_length=50, unique=True)),
                ('network', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='rotbot.Network')),
            ],
        ),
        migrations.CreateModel(
            name='CurseWord',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('word', models.CharField(max_length=15, unique=True)),
                ('created', models.DateField(auto_now_add=True)),
                ('banned', models.BooleanField(default=False)),
                ('irc_user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='rotbot.User')),
                ('web_user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='CurseAdjective',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('word', models.CharField(max_length=15, unique=True)),
                ('created', models.DateField(auto_now_add=True)),
                ('banned', models.BooleanField(default=False)),
                ('irc_user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='rotbot.User')),
                ('web_user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.AddField(
            model_name='channel',
            name='last_event_subject',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='channel_subject', to='rotbot.User'),
        ),
        migrations.AddField(
            model_name='channel',
            name='last_event_user',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='rotbot.User'),
        ),
        migrations.AddField(
            model_name='channel',
            name='network',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='channel', related_query_name='channels', to='rotbot.Network'),
        ),
        migrations.CreateModel(
            name='Notice',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('amount', models.PositiveIntegerField(default=0)),
                ('channel', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='rotbot.Channel')),
                ('network', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='rotbot.Network')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='rotbot.User')),
            ],
            options={
                'unique_together': {('network', 'channel', 'user')},
            },
        ),
        migrations.CreateModel(
            name='Message',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('amount', models.PositiveIntegerField(default=0)),
                ('channel', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='rotbot.Channel')),
                ('network', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='rotbot.Network')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='rotbot.User')),
            ],
            options={
                'unique_together': {('network', 'channel', 'user')},
            },
        ),
        migrations.CreateModel(
            name='Kick',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('amount', models.PositiveIntegerField(default=0)),
                ('channel', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='rotbot.Channel')),
                ('kicked', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='kicked', to='rotbot.User')),
                ('kicker', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='kicker', to='rotbot.User')),
                ('network', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='rotbot.Network')),
            ],
            options={
                'unique_together': {('network', 'channel', 'kicker', 'kicked')},
            },
        ),
        migrations.CreateModel(
            name='Join',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('amount', models.PositiveIntegerField(default=0)),
                ('channel', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='rotbot.Channel')),
                ('network', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='rotbot.Network')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='rotbot.User')),
            ],
            options={
                'unique_together': {('network', 'channel', 'user')},
            },
        ),
        migrations.CreateModel(
            name='Host',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('address', models.CharField(max_length=200, unique=True, validators=[django.core.validators.MaxLengthValidator(200)])),
                ('port', models.PositiveSmallIntegerField(default=6697, validators=[django.core.validators.MaxValueValidator(65535)])),
                ('ssl', models.BooleanField(default=True)),
                ('connection_attempts', models.PositiveIntegerField(default=0)),
                ('connection_succeeds', models.PositiveIntegerField(default=0)),
                ('network', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='host', related_query_name='hosts', to='rotbot.Network')),
            ],
            options={
                'unique_together': {('address', 'port')},
                'order_with_respect_to': 'network',
            },
        ),
        migrations.AlterUniqueTogether(
            name='channel',
            unique_together={('network', 'name')},
        ),
        migrations.CreateModel(
            name='Action',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('amount', models.PositiveIntegerField(default=0)),
                ('channel', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='rotbot.Channel')),
                ('network', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='rotbot.Network')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='rotbot.User')),
            ],
            options={
                'unique_together': {('network', 'channel', 'user')},
            },
        ),
    ]
