# Generated by Django 4.1.7 on 2023-03-08 10:26

import django.contrib.postgres.fields.hstore
import django.db.models.deletion
import dynamic_filenames
from django.conf import settings
from django.contrib.postgres.operations import (
    BtreeGinExtension,
    HStoreExtension,
    TrigramExtension,
)
from django.db import migrations, models


class Migration(migrations.Migration):
    initial = True

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

    operations = [
        BtreeGinExtension(),
        HStoreExtension(),
        TrigramExtension(),
        migrations.CreateModel(
            name="EpisodeCommentModel",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("text", models.TextField()),
                ("comment_added", models.DateTimeField(auto_now=True)),
                (
                    "user",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            options={
                "verbose_name": "Episode Comment",
            },
        ),
        migrations.CreateModel(
            name="EpisodeModel",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("episode_number", models.BigIntegerField(default=0)),
                ("episode_name", models.CharField(max_length=1024)),
                (
                    "episode_thumbnail",
                    models.ImageField(
                        blank=True,
                        default=None,
                        null=True,
                        upload_to=dynamic_filenames.FilePattern(
                            filename_pattern="thumbnail/{uuid:s}{ext}"
                        ),
                    ),
                ),
                ("episode_summary", models.TextField(blank=True, default="", null=True)),
                ("episode_length", models.PositiveIntegerField(blank=True, default=None)),
                (
                    "providers",
                    django.contrib.postgres.fields.hstore.HStoreField(
                        blank=True, default=dict
                    ),
                ),
                (
                    "episode_comments",
                    models.ManyToManyField(blank=True, to="episodes.episodecommentmodel"),
                ),
            ],
            options={
                "verbose_name": "Episode",
                "verbose_name_plural": "Episodes",
            },
        ),
        migrations.CreateModel(
            name="EpisodeTimestampModel",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("timestamp", models.IntegerField(default=0)),
                (
                    "episode",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        to="episodes.episodemodel",
                    ),
                ),
                (
                    "user",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            options={
                "verbose_name": "Episode Timestamp",
            },
        ),
        migrations.AddField(
            model_name="episodemodel",
            name="episode_timestamps",
            field=models.ManyToManyField(blank=True, to="episodes.episodetimestampmodel"),
        ),
    ]
