# Generated by Django 5.2.4 on 2025-08-07 17:36

import django.core.validators
import django.db.models.deletion
import uuid
from django.conf import settings
from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ("playlist", "0022_background_cover"),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.AlterField(
            model_name="vote",
            name="points",
            field=models.IntegerField(
                validators=[
                    django.core.validators.MinValueValidator(1),
                    django.core.validators.MaxValueValidator(5),
                ]
            ),
        ),
        migrations.CreateModel(
            name="Session",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("opens", models.DateTimeField(default=None, null=True)),
                ("session_id", models.UUIDField(default=uuid.uuid4, editable=False)),
                ("seed", models.IntegerField(default=892933)),
                (
                    "status",
                    models.CharField(
                        choices=[
                            ("lobby", "Lobby"),
                            ("voting", "Voting"),
                            ("waiting_for_next_track", "Waiting for Next Track"),
                            ("paused", "Paused"),
                            ("voting_done", "Voting Done"),
                        ],
                        default="lobby",
                        max_length=30,
                    ),
                ),
                ("voting_open", models.BooleanField(default=False)),
                (
                    "current_track",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        to="playlist.track",
                    ),
                ),
                (
                    "host",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "players_connected",
                    models.ManyToManyField(
                        related_name="sessions_joined", to=settings.AUTH_USER_MODEL
                    ),
                ),
                (
                    "players_wanted",
                    models.ManyToManyField(
                        related_name="players_wanted", to=settings.AUTH_USER_MODEL
                    ),
                ),
            ],
        ),
        migrations.AddField(
            model_name="vote",
            name="session",
            field=models.ForeignKey(
                default=None,
                null=True,
                on_delete=django.db.models.deletion.CASCADE,
                to="playlist.session",
            ),
        ),
    ]
