# Generated by Django 2.0.8 on 2018-08-25 14:11

import django.contrib.postgres.fields.jsonb
import django.core.serializers.json
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import funkwhale_api.music.models


class Migration(migrations.Migration):

    dependencies = [
        ("federation", "0009_auto_20180822_1956"),
        ("music", "0029_auto_20180807_1748"),
    ]

    operations = [
        migrations.CreateModel(
            name="LibraryScan",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("total_files", models.PositiveIntegerField(default=0)),
                ("processed_files", models.PositiveIntegerField(default=0)),
                ("errored_files", models.PositiveIntegerField(default=0)),
                ("status", models.CharField(default="pending", max_length=25)),
                (
                    "creation_date",
                    models.DateTimeField(default=django.utils.timezone.now),
                ),
                ("modification_date", models.DateTimeField(blank=True, null=True)),
                (
                    "actor",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        to="federation.Actor",
                    ),
                ),
            ],
        ),
        migrations.RemoveField(model_name="trackfile", name="library_track"),
        migrations.AddField(
            model_name="library",
            name="files_count",
            field=models.PositiveIntegerField(default=0),
        ),
        migrations.AddField(
            model_name="trackfile",
            name="fid",
            field=models.URLField(blank=True, max_length=500, null=True, unique=True),
        ),
        migrations.AddField(
            model_name="trackfile",
            name="import_date",
            field=models.DateTimeField(blank=True, null=True),
        ),
        migrations.AddField(
            model_name="trackfile",
            name="import_details",
            field=django.contrib.postgres.fields.jsonb.JSONField(
                default=funkwhale_api.music.models.empty_dict,
                encoder=django.core.serializers.json.DjangoJSONEncoder,
                max_length=50000,
            ),
        ),
        migrations.AddField(
            model_name="trackfile",
            name="import_metadata",
            field=django.contrib.postgres.fields.jsonb.JSONField(
                default=funkwhale_api.music.models.empty_dict,
                encoder=django.core.serializers.json.DjangoJSONEncoder,
                max_length=50000,
            ),
        ),
        migrations.AddField(
            model_name="trackfile",
            name="import_reference",
            field=models.CharField(
                default=funkwhale_api.music.models.get_import_reference, max_length=50
            ),
        ),
        migrations.AddField(
            model_name="trackfile",
            name="import_status",
            field=models.CharField(
                choices=[
                    ("pending", "Pending"),
                    ("finished", "Finished"),
                    ("errored", "Errored"),
                    ("skipped", "Skipped"),
                ],
                default="pending",
                max_length=25,
            ),
        ),
        migrations.AddField(
            model_name="trackfile",
            name="metadata",
            field=django.contrib.postgres.fields.jsonb.JSONField(
                default=funkwhale_api.music.models.empty_dict,
                encoder=django.core.serializers.json.DjangoJSONEncoder,
                max_length=50000,
            ),
        ),
        migrations.AlterField(
            model_name="album",
            name="release_date",
            field=models.DateField(blank=True, null=True),
        ),
        migrations.AlterField(
            model_name="trackfile",
            name="audio_file",
            field=models.FileField(
                max_length=255, upload_to=funkwhale_api.music.models.get_file_path
            ),
        ),
        migrations.AlterField(
            model_name="trackfile",
            name="source",
            field=models.CharField(blank=True, max_length=500, null=True),
        ),
        migrations.AlterField(
            model_name="trackfile",
            name="track",
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.CASCADE,
                related_name="files",
                to="music.Track",
            ),
        ),
        migrations.AddField(
            model_name="libraryscan",
            name="library",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                related_name="scans",
                to="music.Library",
            ),
        ),
    ]
