# Generated by Django 5.0.6 on 2024-07-02 21:50

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


class Migration(migrations.Migration):

    dependencies = [
        ('app', '0015_customlist_listitem'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.RenameField(
            model_name='customlist',
            old_name='user',
            new_name='owner',
        ),
        migrations.AlterUniqueTogether(
            name='customlist',
            unique_together={('name', 'owner')},
        ),
        migrations.AddField(
            model_name='customlist',
            name='collaborators',
            field=models.ManyToManyField(blank=True, related_name='collaborated_lists', to=settings.AUTH_USER_MODEL),
        ),
        migrations.CreateModel(
            name='Item',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('media_id', models.PositiveIntegerField()),
                ('media_type', models.CharField(max_length=12)),
                ('title', models.CharField(max_length=255)),
                ('image', models.URLField()),
                ('season_number', models.PositiveIntegerField(null=True)),
                ('episode_number', models.PositiveIntegerField(null=True)),
            ],
            options={
                'ordering': ['media_id'],
                'unique_together': {('media_id', 'media_type', 'season_number', 'episode_number')},
            },
        ),
        migrations.CreateModel(
            name='CustomListItem',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('date_added', models.DateTimeField(auto_now_add=True)),
                ('custom_list', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='app.customlist')),
                ('item', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='app.item')),
            ],
            options={
                'ordering': ['date_added'],
                'unique_together': {('item', 'custom_list')},
            },
        ),
        migrations.AddField(
            model_name='customlist',
            name='items',
            field=models.ManyToManyField(blank=True, related_name='custom_lists', through='app.CustomListItem', to='app.item'),
        ),
        migrations.DeleteModel(
            name='ListItem',
        ),
    ]
