# Generated by Django 3.2.16 on 2023-01-12 01:32

import uuid

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

import catalog.common.utils


class Migration(migrations.Migration):
    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name="ExternalResource",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "id_type",
                    models.CharField(
                        choices=[
                            ("wikidata", "维基数据"),
                            ("isbn10", "ISBN10"),
                            ("isbn", "ISBN"),
                            ("asin", "ASIN"),
                            ("issn", "ISSN"),
                            ("cubn", "统一书号"),
                            ("isrc", "ISRC"),
                            ("gtin", "GTIN UPC EAN码"),
                            ("feed", "Feed URL"),
                            ("imdb", "IMDb"),
                            ("tmdb_tv", "TMDB剧集"),
                            ("tmdb_tvseason", "TMDB剧集"),
                            ("tmdb_tvepisode", "TMDB剧集"),
                            ("tmdb_movie", "TMDB电影"),
                            ("goodreads", "Goodreads"),
                            ("goodreads_work", "Goodreads著作"),
                            ("googlebooks", "谷歌图书"),
                            ("doubanbook", "豆瓣读书"),
                            ("doubanbook_work", "豆瓣读书著作"),
                            ("doubanmovie", "豆瓣电影"),
                            ("doubanmusic", "豆瓣音乐"),
                            ("doubangame", "豆瓣游戏"),
                            ("doubandrama", "豆瓣舞台剧"),
                            ("bandcamp", "Bandcamp"),
                            ("spotify_album", "Spotify专辑"),
                            ("spotify_show", "Spotify播客"),
                            ("discogs_release", "Discogs Release"),
                            ("discogs_master", "Discogs Master"),
                            ("musicbrainz", "MusicBrainz ID"),
                            ("doubanbook_author", "豆瓣读书作者"),
                            ("doubanmovie_celebrity", "豆瓣电影影人"),
                            ("goodreads_author", "Goodreads作者"),
                            ("spotify_artist", "Spotify艺术家"),
                            ("tmdb_person", "TMDB影人"),
                            ("igdb", "IGDB游戏"),
                            ("steam", "Steam游戏"),
                            ("bangumi", "Bangumi"),
                            ("apple_podcast", "苹果播客"),
                        ],
                        max_length=50,
                        verbose_name="IdType of the source site",
                    ),
                ),
                (
                    "id_value",
                    models.CharField(
                        max_length=1000, verbose_name="Primary Id on the source site"
                    ),
                ),
                (
                    "url",
                    models.CharField(
                        max_length=1000, unique=True, verbose_name="url to the resource"
                    ),
                ),
                (
                    "cover",
                    models.ImageField(
                        blank=True,
                        default="item/default.svg",
                        upload_to=catalog.common.utils.resource_cover_path,
                    ),
                ),
                ("other_lookup_ids", models.JSONField(default=dict)),
                ("metadata", models.JSONField(default=dict)),
                ("scraped_time", models.DateTimeField(null=True)),
                ("created_time", models.DateTimeField(auto_now_add=True)),
                ("edited_time", models.DateTimeField(auto_now=True)),
            ],
        ),
        migrations.CreateModel(
            name="Item",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "uid",
                    models.UUIDField(db_index=True, default=uuid.uuid4, editable=False),
                ),
                (
                    "title",
                    models.CharField(default="", max_length=1000, verbose_name="标题"),
                ),
                (
                    "brief",
                    models.TextField(blank=True, default="", verbose_name="简介"),
                ),
                (
                    "primary_lookup_id_type",
                    models.CharField(
                        max_length=50, null=True, verbose_name="主要标识类型"
                    ),
                ),
                (
                    "primary_lookup_id_value",
                    models.CharField(
                        max_length=1000, null=True, verbose_name="主要标识数值"
                    ),
                ),
                (
                    "metadata",
                    models.JSONField(
                        blank=True, default=dict, null=True, verbose_name="其它信息"
                    ),
                ),
                (
                    "cover",
                    models.ImageField(
                        blank=True,
                        default="item/default.svg",
                        upload_to=catalog.common.utils.item_cover_path,
                        verbose_name="封面",
                    ),
                ),
                ("created_time", models.DateTimeField(auto_now_add=True)),
                ("edited_time", models.DateTimeField(auto_now=True)),
                ("is_deleted", models.BooleanField(db_index=True, default=False)),
            ],
            bases=(models.Model,),
        ),
        migrations.CreateModel(
            name="Album",
            fields=[
                (
                    "item_ptr",
                    models.OneToOneField(
                        auto_created=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        parent_link=True,
                        primary_key=True,
                        serialize=False,
                        to="catalog.item",
                    ),
                ),
            ],
            options={
                "abstract": False,
                "base_manager_name": "objects",
            },
            bases=("catalog.item",),
        ),
        migrations.CreateModel(
            name="Collection",
            fields=[
                (
                    "item_ptr",
                    models.OneToOneField(
                        auto_created=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        parent_link=True,
                        primary_key=True,
                        serialize=False,
                        to="catalog.item",
                    ),
                ),
            ],
            options={
                "abstract": False,
                "base_manager_name": "objects",
            },
            bases=("catalog.item",),
        ),
        migrations.CreateModel(
            name="Edition",
            fields=[
                (
                    "item_ptr",
                    models.OneToOneField(
                        auto_created=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        parent_link=True,
                        primary_key=True,
                        serialize=False,
                        to="catalog.item",
                    ),
                ),
            ],
            options={
                "abstract": False,
                "base_manager_name": "objects",
            },
            bases=("catalog.item",),
        ),
        migrations.CreateModel(
            name="Game",
            fields=[
                (
                    "item_ptr",
                    models.OneToOneField(
                        auto_created=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        parent_link=True,
                        primary_key=True,
                        serialize=False,
                        to="catalog.item",
                    ),
                ),
            ],
            options={
                "abstract": False,
                "base_manager_name": "objects",
            },
            bases=("catalog.item",),
        ),
        migrations.CreateModel(
            name="Movie",
            fields=[
                (
                    "item_ptr",
                    models.OneToOneField(
                        auto_created=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        parent_link=True,
                        primary_key=True,
                        serialize=False,
                        to="catalog.item",
                    ),
                ),
            ],
            options={
                "abstract": False,
                "base_manager_name": "objects",
            },
            bases=("catalog.item",),
        ),
        migrations.CreateModel(
            name="Podcast",
            fields=[
                (
                    "item_ptr",
                    models.OneToOneField(
                        auto_created=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        parent_link=True,
                        primary_key=True,
                        serialize=False,
                        to="catalog.item",
                    ),
                ),
            ],
            options={
                "abstract": False,
                "base_manager_name": "objects",
            },
            bases=("catalog.item",),
        ),
        migrations.CreateModel(
            name="TVEpisode",
            fields=[
                (
                    "item_ptr",
                    models.OneToOneField(
                        auto_created=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        parent_link=True,
                        primary_key=True,
                        serialize=False,
                        to="catalog.item",
                    ),
                ),
                ("episode_number", models.PositiveIntegerField(null=True)),
            ],
            options={
                "abstract": False,
                "base_manager_name": "objects",
            },
            bases=("catalog.item",),
        ),
        migrations.CreateModel(
            name="TVSeason",
            fields=[
                (
                    "item_ptr",
                    models.OneToOneField(
                        auto_created=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        parent_link=True,
                        primary_key=True,
                        serialize=False,
                        to="catalog.item",
                    ),
                ),
                (
                    "season_number",
                    models.PositiveIntegerField(null=True, verbose_name="本季序号"),
                ),
                (
                    "episode_count",
                    models.PositiveIntegerField(null=True, verbose_name="本季集数"),
                ),
            ],
            options={
                "abstract": False,
                "base_manager_name": "objects",
            },
            bases=("catalog.item",),
        ),
        migrations.CreateModel(
            name="TVShow",
            fields=[
                (
                    "item_ptr",
                    models.OneToOneField(
                        auto_created=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        parent_link=True,
                        primary_key=True,
                        serialize=False,
                        to="catalog.item",
                    ),
                ),
                (
                    "season_count",
                    models.IntegerField(blank=True, null=True, verbose_name="总季数"),
                ),
                (
                    "episode_count",
                    models.PositiveIntegerField(
                        blank=True, null=True, verbose_name="总集数"
                    ),
                ),
            ],
            options={
                "abstract": False,
                "base_manager_name": "objects",
            },
            bases=("catalog.item",),
        ),
        migrations.CreateModel(
            name="Work",
            fields=[
                (
                    "item_ptr",
                    models.OneToOneField(
                        auto_created=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        parent_link=True,
                        primary_key=True,
                        serialize=False,
                        to="catalog.item",
                    ),
                ),
            ],
            options={
                "abstract": False,
                "base_manager_name": "objects",
            },
            bases=("catalog.item",),
        ),
        migrations.CreateModel(
            name="ItemLookupId",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "id_type",
                    models.CharField(
                        blank=True,
                        choices=[
                            ("wikidata", "维基数据"),
                            ("isbn10", "ISBN10"),
                            ("isbn", "ISBN"),
                            ("asin", "ASIN"),
                            ("issn", "ISSN"),
                            ("cubn", "统一书号"),
                            ("isrc", "ISRC"),
                            ("gtin", "GTIN UPC EAN码"),
                            ("feed", "Feed URL"),
                            ("imdb", "IMDb"),
                            ("tmdb_tv", "TMDB剧集"),
                            ("tmdb_tvseason", "TMDB剧集"),
                            ("tmdb_tvepisode", "TMDB剧集"),
                            ("tmdb_movie", "TMDB电影"),
                            ("goodreads", "Goodreads"),
                            ("goodreads_work", "Goodreads著作"),
                            ("googlebooks", "谷歌图书"),
                            ("doubanbook", "豆瓣读书"),
                            ("doubanbook_work", "豆瓣读书著作"),
                            ("doubanmovie", "豆瓣电影"),
                            ("doubanmusic", "豆瓣音乐"),
                            ("doubangame", "豆瓣游戏"),
                            ("doubandrama", "豆瓣舞台剧"),
                            ("bandcamp", "Bandcamp"),
                            ("spotify_album", "Spotify专辑"),
                            ("spotify_show", "Spotify播客"),
                            ("discogs_release", "Discogs Release"),
                            ("discogs_master", "Discogs Master"),
                            ("musicbrainz", "MusicBrainz ID"),
                            ("doubanbook_author", "豆瓣读书作者"),
                            ("doubanmovie_celebrity", "豆瓣电影影人"),
                            ("goodreads_author", "Goodreads作者"),
                            ("spotify_artist", "Spotify艺术家"),
                            ("tmdb_person", "TMDB影人"),
                            ("igdb", "IGDB游戏"),
                            ("steam", "Steam游戏"),
                            ("bangumi", "Bangumi"),
                            ("apple_podcast", "苹果播客"),
                        ],
                        max_length=50,
                        verbose_name="源网站",
                    ),
                ),
                (
                    "id_value",
                    models.CharField(
                        blank=True, max_length=1000, verbose_name="源网站ID"
                    ),
                ),
                (
                    "raw_url",
                    models.CharField(
                        blank=True,
                        max_length=1000,
                        unique=True,
                        verbose_name="源网站ID",
                    ),
                ),
                (
                    "item",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="lookup_ids",
                        to="catalog.item",
                    ),
                ),
            ],
        ),
    ]
