# Generated by Django 3.2.5 on 2021-10-07 22:53

import bookwyrm.models.activitypub_mixin
import bookwyrm.models.fields
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

    dependencies = [
        ("bookwyrm", "0106_user_preferred_language"),
    ]

    operations = [
        migrations.CreateModel(
            name="Link",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("created_date", models.DateTimeField(auto_now_add=True)),
                ("updated_date", models.DateTimeField(auto_now=True)),
                (
                    "remote_id",
                    bookwyrm.models.fields.RemoteIdField(
                        max_length=255,
                        null=True,
                        validators=[bookwyrm.models.fields.validate_remote_id],
                    ),
                ),
                ("url", bookwyrm.models.fields.CharField(max_length=255)),
                ("name", bookwyrm.models.fields.CharField(max_length=255)),
            ],
            options={
                "abstract": False,
            },
            bases=(bookwyrm.models.activitypub_mixin.CollectionItemMixin, models.Model),
        ),
        migrations.AlterField(
            model_name="user",
            name="preferred_language",
            field=models.CharField(
                blank=True,
                choices=[
                    ("en-us", "English"),
                    ("de-de", "Deutsch (German)"),
                    ("es", "Español (Spanish)"),
                    ("fr-fr", "Français (French)"),
                    ("zh-hans", "简体中文 (Simplified Chinese)"),
                    ("zh-hant", "繁體中文 (Traditional Chinese)"),
                ],
                max_length=255,
                null=True,
            ),
        ),
        migrations.CreateModel(
            name="FileLink",
            fields=[
                (
                    "link_ptr",
                    models.OneToOneField(
                        auto_created=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        parent_link=True,
                        primary_key=True,
                        serialize=False,
                        to="bookwyrm.link",
                    ),
                ),
                ("filetype", bookwyrm.models.fields.CharField(max_length=5)),
                (
                    "filetype_description",
                    bookwyrm.models.fields.CharField(max_length=100),
                ),
            ],
            options={
                "abstract": False,
            },
            bases=("bookwyrm.link",),
        ),
        migrations.AddField(
            model_name="author",
            name="links",
            field=bookwyrm.models.fields.ManyToManyField(to="bookwyrm.Link"),
        ),
        migrations.AddField(
            model_name="book",
            name="links",
            field=bookwyrm.models.fields.ManyToManyField(to="bookwyrm.Link"),
        ),
        migrations.AddField(
            model_name="book",
            name="file_links",
            field=bookwyrm.models.fields.ManyToManyField(
                related_name="editions", to="bookwyrm.FileLink"
            ),
        ),
    ]
