# Generated by Django 5.0.4 on 2024-06-17 01:11

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


class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='Filter',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False)),
                ('name', models.CharField(max_length=32)),
                ('keywords', models.CharField(blank=True, max_length=128, null=True)),
                ('regex', models.CharField(blank=True, max_length=128, null=True)),
                ('whitelist', models.BooleanField(default=False)),
                ('guild_id', models.CharField(max_length=128)),
            ],
            options={
                'verbose_name': 'filter',
                'verbose_name_plural': 'filters',
                'get_latest_by': 'id',
            },
        ),
        migrations.CreateModel(
            name='SavedGuilds',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False)),
                ('guild_id', models.CharField(help_text='Discord snowflake ID for the represented guild.', max_length=128, verbose_name='guild id')),
                ('name', models.CharField(help_text='Name of the represented guild.', max_length=128)),
                ('icon', models.CharField(help_text="Hash for the represented guild's icon.", max_length=128)),
                ('permissions', models.CharField(help_text='Guild permissions for the user who added this instance.', max_length=64)),
                ('owner', models.BooleanField(default=False, help_text="Does the 'added by' user own this guild?")),
            ],
            options={
                'verbose_name': 'saved guild',
                'verbose_name_plural': 'saved guilds',
                'get_latest_by': '-creation_datetime',
            },
        ),
        migrations.CreateModel(
            name='SubChannel',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False)),
                ('channel_id', models.CharField(help_text='Discord snowflake ID for the represented Channel.', max_length=128, verbose_name='channel id')),
            ],
            options={
                'verbose_name': 'SubChannel',
                'verbose_name_plural': 'SubChannels',
                'get_latest_by': 'id',
            },
        ),
        migrations.CreateModel(
            name='Subscription',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False)),
                ('name', models.CharField(max_length=32)),
                ('url', models.URLField()),
                ('guild_id', models.CharField(max_length=128)),
                ('creation_datetime', models.DateTimeField(default=django.utils.timezone.now, editable=False)),
                ('extra_notes', models.CharField(blank=True, max_length=250, null=True)),
                ('uwuify', models.BooleanField(default=False)),
                ('active', models.BooleanField(default=True)),
            ],
            options={
                'verbose_name': 'subscription',
                'verbose_name_plural': 'subscriptions',
                'get_latest_by': '-creation_datetime',
            },
        ),
        migrations.CreateModel(
            name='TrackedContent',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False)),
                ('guid', models.CharField(max_length=128)),
                ('title', models.CharField(max_length=128)),
                ('url', models.URLField(unique=True)),
                ('blocked', models.BooleanField(default=False)),
                ('creation_datetime', models.DateTimeField(default=django.utils.timezone.now, editable=False)),
                ('guild_id', models.CharField(max_length=128)),
            ],
            options={
                'verbose_name': 'tracked contents',
                'get_latest_by': '-creation_datetime',
            },
        ),
        migrations.AddConstraint(
            model_name='filter',
            constraint=models.UniqueConstraint(fields=('name', 'guild_id'), name='unique name & guild id pair'),
        ),
        migrations.AddField(
            model_name='savedguilds',
            name='added_by',
            field=models.ForeignKey(help_text='The user who added created this instance.', on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='added by'),
        ),
        migrations.AddField(
            model_name='subscription',
            name='filters',
            field=models.ManyToManyField(blank=True, to='home.filter'),
        ),
        migrations.AddField(
            model_name='subchannel',
            name='subscription',
            field=models.ForeignKey(help_text='The linked Subscription, must be unique.', on_delete=django.db.models.deletion.CASCADE, to='home.subscription'),
        ),
        migrations.AddField(
            model_name='trackedcontent',
            name='subscription',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='home.subscription'),
        ),
        migrations.AddConstraint(
            model_name='savedguilds',
            constraint=models.UniqueConstraint(fields=('added_by', 'guild_id'), name='unique added_by & guild_id pair'),
        ),
        migrations.AddConstraint(
            model_name='subscription',
            constraint=models.UniqueConstraint(fields=('name', 'guild_id'), name='unique name & server pair'),
        ),
        migrations.AddConstraint(
            model_name='subchannel',
            constraint=models.UniqueConstraint(fields=('channel_id', 'subscription'), name='unique channel id and subscription pair'),
        ),
        migrations.AddConstraint(
            model_name='trackedcontent',
            constraint=models.UniqueConstraint(fields=('guid', 'guild_id'), name='unique guid & guild_id pair'),
        ),
        migrations.AddConstraint(
            model_name='trackedcontent',
            constraint=models.UniqueConstraint(fields=('url', 'guild_id'), name='unique url & guild_id pair'),
        ),
    ]
