# Generated by Django 2.0.7 on 2018-08-07 17:48

from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import uuid


class Migration(migrations.Migration):

    dependencies = [
        ("federation", "0007_auto_20180807_1748"),
        ("music", "0028_importjob_replace_if_duplicate"),
    ]

    operations = [
        migrations.CreateModel(
            name="Library",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("fid", models.URLField(db_index=True, max_length=500, unique=True)),
                ("url", models.URLField(blank=True, max_length=500, null=True)),
                (
                    "uuid",
                    models.UUIDField(db_index=True, default=uuid.uuid4, unique=True),
                ),
                ("followers_url", models.URLField(max_length=500)),
                (
                    "creation_date",
                    models.DateTimeField(default=django.utils.timezone.now),
                ),
                ("name", models.CharField(max_length=100)),
                (
                    "description",
                    models.TextField(blank=True, max_length=5000, null=True),
                ),
                (
                    "privacy_level",
                    models.CharField(
                        choices=[
                            ("me", "Only me"),
                            ("instance", "Everyone on my instance, and my followers"),
                            (
                                "everyone",
                                "Everyone, including people on other instances",
                            ),
                        ],
                        default="me",
                        max_length=25,
                    ),
                ),
                (
                    "actor",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="libraries",
                        to="federation.Actor",
                    ),
                ),
            ],
            options={"abstract": False},
        ),
        migrations.AddField(
            model_name="importjob",
            name="audio_file_size",
            field=models.IntegerField(blank=True, null=True),
        ),
        migrations.AlterField(
            model_name="importbatch",
            name="import_request",
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name="import_batches",
                to="requests.ImportRequest",
            ),
        ),
        migrations.AddField(
            model_name="importbatch",
            name="library",
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.CASCADE,
                related_name="import_batches",
                to="music.Library",
            ),
        ),
        migrations.AddField(
            model_name="trackfile",
            name="library",
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.CASCADE,
                related_name="files",
                to="music.Library",
            ),
        ),
    ]
