# Generated by Django 6.0.5 on 2026-08-07 07:29

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


class Migration(migrations.Migration):

    dependencies = [
        ("wallet", "0007_checkers"),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.AlterField(
            model_name="checkers",
            name="current",
            field=models.CharField(default="r", max_length=1),
        ),
        migrations.CreateModel(
            name="MauaGame",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("stake", models.PositiveIntegerField(default=0)),
                ("max_players", models.PositiveIntegerField(default=4)),
                ("deck", models.JSONField(default=list)),
                ("discard", models.JSONField(default=list)),
                ("hands", models.JSONField(default=dict)),
                ("turn_order", models.JSONField(default=list)),
                ("current_idx", models.IntegerField(default=0)),
                ("direction", models.IntegerField(default=1)),
                ("draw_stack", models.IntegerField(default=0)),
                ("current_suit", models.CharField(blank=True, max_length=10)),
                (
                    "status",
                    models.CharField(
                        choices=[
                            ("waiting", "Waiting for players"),
                            ("playing", "In Progress"),
                            ("finished", "Finished"),
                        ],
                        default="waiting",
                        max_length=20,
                    ),
                ),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
                (
                    "creator",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="maua_created",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "players",
                    models.ManyToManyField(
                        blank=True,
                        related_name="maua_games",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "winner",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="maua_wins",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            options={
                "ordering": ["-created_at"],
            },
        ),
        migrations.CreateModel(
            name="MauaPlayer",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("hand", models.JSONField(default=list)),
                ("score", models.IntegerField(default=0)),
                ("position", models.IntegerField(default=0)),
                (
                    "game",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="player_states",
                        to="wallet.mauagame",
                    ),
                ),
                (
                    "user",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            options={
                "unique_together": {("game", "user")},
            },
        ),
    ]
