"""Initial migrations for django-imdb."""
# Generated by Django 6.0 on 2026-01-18 08:55

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


class Migration(migrations.Migration):
    """Initial migrations for django-imdb."""

    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name="AkaLanguage",
            fields=[
                (
                    "name",
                    models.CharField(
                        help_text="The language name.",
                        primary_key=True,
                        serialize=False,
                    ),
                ),
            ],
        ),
        migrations.CreateModel(
            name="AkaRegion",
            fields=[
                (
                    "name",
                    models.CharField(help_text="The region name.", primary_key=True, serialize=False),
                ),
            ],
        ),
        migrations.CreateModel(
            name="AkaType",
            fields=[
                (
                    "name",
                    models.CharField(help_text="The type name.", primary_key=True, serialize=False),
                ),
            ],
        ),
        migrations.CreateModel(
            name="CrewCategory",
            fields=[
                (
                    "name",
                    models.CharField(help_text="The category", primary_key=True, serialize=False),
                ),
            ],
        ),
        migrations.CreateModel(
            name="Person",
            fields=[
                (
                    "person_id",
                    models.CharField(
                        help_text="The main person ID",
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                (
                    "name",
                    models.CharField(
                        blank=True,
                        default="PLAYTIME_IMDB_DATA_INCONSISTENCY_PLACEHOLDER",
                        help_text="The name of this person (when known)",
                    ),
                ),
                (
                    "born",
                    models.IntegerField(
                        blank=True,
                        help_text="Birth year of this person (when known)",
                        null=True,
                    ),
                ),
                (
                    "died",
                    models.IntegerField(
                        blank=True,
                        help_text="Death year of this person (when known)",
                        null=True,
                    ),
                ),
                (
                    "primary_professions",
                    models.CharField(
                        blank=True,
                        help_text="Comma-separated list of up to three primary professions for this person.",
                    ),
                ),
                (
                    "known_for_titles",
                    models.CharField(
                        blank=True,
                        help_text="The titles this person is most known for working on.",
                    ),
                ),
            ],
            options={
                "ordering": ["person_id"],
            },
        ),
        migrations.CreateModel(
            name="Title",
            fields=[
                (
                    "title_id",
                    models.CharField(
                        help_text="The main title ID.",
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                (
                    "primary_title",
                    models.CharField(
                        default="PLAYTIME_IMDB_DATA_INCONSISTENCY_PLACEHOLDER",
                        help_text="The primary/most used title of the movie",
                    ),
                ),
                (
                    "original_title",
                    models.CharField(
                        default="PLAYTIME_IMDB_DATA_INCONSISTENCY_PLACEHOLDER",
                        help_text="The original title of the movie, in the original language.",
                    ),
                ),
                ("is_adult", models.BooleanField(default=False)),
                (
                    "premiered",
                    models.IntegerField(
                        blank=True,
                        help_text="The year of the premiere of this title.",
                        null=True,
                    ),
                ),
                (
                    "ended",
                    models.IntegerField(
                        blank=True,
                        help_text="End year (for TV series only).",
                        null=True,
                    ),
                ),
                (
                    "runtime_minutes",
                    models.IntegerField(
                        blank=True,
                        help_text="The runtime in minutes of this title.",
                        null=True,
                    ),
                ),
                (
                    "genres",
                    models.CharField(blank=True, help_text="Up to three genres for this title."),
                ),
            ],
            options={
                "ordering": ["title_id"],
            },
        ),
        migrations.CreateModel(
            name="TitleType",
            fields=[
                (
                    "name",
                    models.CharField(help_text="The type.", primary_key=True, serialize=False),
                ),
            ],
        ),
        migrations.CreateModel(
            name="Rating",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("rating", models.FloatField()),
                ("votes", models.IntegerField()),
                (
                    "title",
                    models.OneToOneField(
                        on_delete=django.db.models.deletion.PROTECT,
                        to="django_imdb.title",
                    ),
                ),
            ],
            options={
                "ordering": ["title"],
            },
        ),
        migrations.CreateModel(
            name="Episode",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("season_number", models.IntegerField(blank=True, null=True)),
                ("episode_number", models.IntegerField(blank=True, null=True)),
                (
                    "episode_title",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name="episodes",
                        to="django_imdb.title",
                    ),
                ),
                (
                    "show_title",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name="tvshows",
                        to="django_imdb.title",
                    ),
                ),
            ],
            options={
                "ordering": ["show_title"],
            },
        ),
        migrations.CreateModel(
            name="Crew",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("ordering", models.IntegerField()),
                (
                    "job",
                    models.CharField(
                        blank=True,
                        help_text="The job performed by this crewmember (where relevant)",
                    ),
                ),
                (
                    "characters",
                    models.CharField(
                        blank=True,
                        help_text="The characters played by this crewmember (where relevant)",
                    ),
                ),
                (
                    "category",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name="crews",
                        to="django_imdb.crewcategory",
                    ),
                ),
                (
                    "person",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name="crews",
                        to="django_imdb.person",
                    ),
                ),
                (
                    "title",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name="crewmembers",
                        to="django_imdb.title",
                    ),
                ),
            ],
            options={
                "ordering": ["title", "ordering"],
            },
        ),
        migrations.CreateModel(
            name="Aka",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("ordering", models.IntegerField()),
                ("aka", models.CharField(help_text="The title/AKA.")),
                (
                    "attributes",
                    models.CharField(
                        blank=True,
                        help_text="Additional comma-separated attributes for this title.",
                    ),
                ),
                ("is_original_title", models.BooleanField()),
                (
                    "language",
                    models.ForeignKey(
                        blank=True,
                        help_text="The language of this AKA (where relevant)",
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name="akas",
                        to="django_imdb.akalanguage",
                    ),
                ),
                (
                    "region",
                    models.ForeignKey(
                        blank=True,
                        help_text="The region of this AKA (where relevant)",
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name="akas",
                        to="django_imdb.akaregion",
                    ),
                ),
                (
                    "aka_type",
                    models.ForeignKey(
                        blank=True,
                        help_text="The type of this AKA",
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name="akas",
                        to="django_imdb.akatype",
                    ),
                ),
                (
                    "title",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name="akas",
                        to="django_imdb.title",
                    ),
                ),
            ],
            options={
                "ordering": ["title", "ordering"],
            },
        ),
        migrations.AddField(
            model_name="title",
            name="title_type",
            field=models.ForeignKey(
                default="PLAYTIME_IMDB_DATA_INCONSISTENCY_PLACEHOLDER",
                on_delete=django.db.models.deletion.PROTECT,
                related_name="titles",
                to="django_imdb.titletype",
            ),
        ),
    ]
