# Generated by Django 4.0 on 2021-12-18 09:21

import django.contrib.postgres.fields
import django.core.validators
import django.db.models.deletion
import imagekit.models.fields
from django.db import migrations, models


class Migration(migrations.Migration):

    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name="Game",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
            ],
            options={
                "verbose_name": "игра",
                "verbose_name_plural": "игры",
            },
        ),
        migrations.CreateModel(
            name="Player",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "nickname",
                    models.CharField(max_length=100, unique=True, verbose_name="псевдоним"),
                ),
                (
                    "avatar_thumbnail",
                    imagekit.models.fields.ProcessedImageField(
                        blank=True, null=True, upload_to="avatars", verbose_name="юзерпик"
                    ),
                ),
                (
                    "fraction",
                    models.CharField(
                        choices=[
                            ("Space Marines", "Космодесант"),
                            ("Imperium", "Империум"),
                            ("Necrons", "Некроны"),
                            ("Orks", "Орки"),
                            ("Tyranids", "Тираниды"),
                            ("Mechanicus", "Механикус"),
                            ("Adepta Sororitas", "Сёстры битвы"),
                            ("Astra Militarum", "Имперская гвардия"),
                            ("Chaos Space Marines", "Космодесант хаоса"),
                            ("Chaos Daemons", "Демоны хаоса"),
                            ("Tau", "Тау"),
                            ("Eldar", "Эльдар"),
                        ],
                        max_length=100,
                        verbose_name="фракция",
                    ),
                ),
            ],
            options={
                "verbose_name": "игрок",
                "verbose_name_plural": "игроки",
            },
        ),
        migrations.CreateModel(
            name="Round",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "round_num",
                    models.PositiveSmallIntegerField(
                        default=1,
                        unique=True,
                        validators=[
                            django.core.validators.MinValueValidator(1),
                        ],
                        verbose_name="номер раунда",
                    ),
                ),
                (
                    "title",
                    models.CharField(max_length=300, unique=True, verbose_name="название"),
                ),
                ("description", models.TextField(null=True, verbose_name="описание")),
                (
                    "time_limit_min",
                    models.PositiveSmallIntegerField(
                        default=45,
                        validators=[django.core.validators.MinValueValidator(1)],
                        verbose_name="лимит времени (минут)",
                    ),
                ),
                (
                    "started_at",
                    models.DateTimeField(
                        blank=True, null=True, unique=True, verbose_name="время начала"
                    ),
                ),
                (
                    "is_current",
                    models.BooleanField(default=False, verbose_name="идет сейчас"),
                ),
                (
                    "is_played",
                    models.BooleanField(default=False, verbose_name="уже сыгран"),
                ),
                (
                    "deployment",
                    models.CharField(
                        choices=[
                            ("Hammer and Anvil", "Молот и наковальня"),
                            ("Dawn of War", "Туман войны"),
                            ("Vanguard Strike", "Авангардный удар"),
                        ],
                        max_length=100,
                    ),
                ),
                (
                    "mission",
                    django.contrib.postgres.fields.ArrayField(
                        base_field=models.CharField(
                            choices=[
                                ("Eternal War: The Reaping", "Вечная война: Жатва"),
                                (
                                    "Eternal War: Big Guns Never Tire",
                                    "Вечная война: Большие пушки",
                                ),
                                ("Eternal War: The Scouring", "Вечная война: Чистка"),
                                ("Eternal War: Crusade", "Вечная война: Крестовый поход"),
                                (
                                    "Eternal War: The Emperor`s Will and Relic",
                                    "Вечная война: Воля Императора",
                                ),
                                (
                                    "Maelstrom of War: Cleanse and Control",
                                    "Водоворот войны: очищение и контроль",
                                ),
                                (
                                    "Maelstrom of War: Contact Lost",
                                    "Водоворот войны: Контакт потерян",
                                ),
                                (
                                    "Maelstrom of War: Spoils of War",
                                    "Водоворот войны: Сполохи войны",
                                ),
                                (
                                    "Maelstrom of War: Tactical Escalation",
                                    "Водоворот войны: Тактическая эскалация",
                                ),
                                (
                                    "Maelstrom of War: Cloak and Shadows",
                                    "Водоворот войны: Плащ и тени",
                                ),
                            ],
                            max_length=100,
                        ),
                        size=None,
                    ),
                ),
            ],
            options={
                "verbose_name": "раунд",
                "verbose_name_plural": "раунды",
            },
        ),
        migrations.CreateModel(
            name="Table",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "title",
                    models.CharField(max_length=100, unique=True, verbose_name="название"),
                ),
                (
                    "photo",
                    imagekit.models.fields.ProcessedImageField(
                        blank=True,
                        null=True,
                        upload_to="tables",
                        verbose_name="фото стола",
                    ),
                ),
            ],
            options={
                "verbose_name": "игровой стол",
                "verbose_name_plural": "игровые столы",
            },
        ),
        migrations.CreateModel(
            name="Unit",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "title",
                    models.CharField(max_length=400, unique=True, verbose_name="название"),
                ),
                (
                    "cost",
                    models.PositiveSmallIntegerField(default=0, verbose_name="стоимость в очках"),
                ),
                (
                    "category",
                    models.CharField(
                        choices=[
                            ("HQ", "Командир"),
                            ("Troops", "Пехота"),
                            ("Elites", "Элита"),
                            ("Fast Attack", "Быстрая атака"),
                            ("Heavy Support", "Артиллерия"),
                            ("Flyers", "Летательные аппараты"),
                            ("Formation", "Формация"),
                            ("Fortification", "Фортификация"),
                            ("Lord Of War", "Лорд войны"),
                            ("Other", "Прочее"),
                        ],
                        max_length=100,
                        verbose_name="тип",
                    ),
                ),
                (
                    "game_system",
                    models.CharField(
                        choices=[("40K", "40K"), ("Horus Heresy", "Ересь Хоруса")],
                        max_length=100,
                        verbose_name="игровая система",
                    ),
                ),
                (
                    "is_warlord",
                    models.BooleanField(default=False, verbose_name="варлорд"),
                ),
            ],
            options={
                "verbose_name": "отряд",
                "verbose_name_plural": "отряды",
            },
        ),
        migrations.CreateModel(
            name="PlayerUnit",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "count",
                    models.PositiveSmallIntegerField(default=1, verbose_name="количество отрядов"),
                ),
                (
                    "player",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="core.player",
                        verbose_name="игрок",
                    ),
                ),
                (
                    "unit",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="core.unit",
                        verbose_name="отряд",
                    ),
                ),
            ],
        ),
        migrations.AddField(
            model_name="player",
            name="units",
            field=models.ManyToManyField(through="core.PlayerUnit", to="core.Unit"),
        ),
        migrations.CreateModel(
            name="GamePlayer",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "victory_points",
                    models.PositiveSmallIntegerField(default=0, verbose_name="очки игрока"),
                ),
                (
                    "game",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="core.game",
                        verbose_name="игра",
                    ),
                ),
                (
                    "player",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="games",
                        to="core.player",
                        verbose_name="игрок",
                    ),
                ),
            ],
        ),
        migrations.AddField(
            model_name="game",
            name="players",
            field=models.ManyToManyField(
                related_name="assigned_games", through="core.GamePlayer", to="core.Player"
            ),
        ),
        migrations.AddField(
            model_name="game",
            name="round",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                related_name="games",
                to="core.round",
                verbose_name="раунд",
            ),
        ),
        migrations.AddField(
            model_name="game",
            name="table",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                to="core.table",
                verbose_name="стол",
            ),
        ),
        migrations.AlterUniqueTogether(
            name="game",
            unique_together={("table", "round")},
        ),
    ]

# Generated by Django 4.0 on 2021-12-18 09:21

import django.contrib.postgres.fields
import django.core.validators
import django.db.models.deletion
import imagekit.models.fields
from django.db import migrations, models


class Migration(migrations.Migration):

    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name="Game",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
            ],
            options={
                "verbose_name": "игра",
                "verbose_name_plural": "игры",
            },
        ),
        migrations.CreateModel(
            name="Player",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "nickname",
                    models.CharField(max_length=100, unique=True, verbose_name="псевдоним"),
                ),
                (
                    "avatar_thumbnail",
                    imagekit.models.fields.ProcessedImageField(
                        blank=True, null=True, upload_to="avatars", verbose_name="юзерпик"
                    ),
                ),
                (
                    "fraction",
                    models.CharField(
                        choices=[
                            ("Space Marines", "Космодесант"),
                            ("Imperium", "Империум"),
                            ("Necrons", "Некроны"),
                            ("Orks", "Орки"),
                            ("Tyranids", "Тираниды"),
                            ("Mechanicus", "Механикус"),
                            ("Adepta Sororitas", "Сёстры битвы"),
                            ("Astra Militarum", "Имперская гвардия"),
                            ("Chaos Space Marines", "Космодесант хаоса"),
                            ("Chaos Daemons", "Демоны хаоса"),
                            ("Tau", "Тау"),
                            ("Eldar", "Эльдар"),
                        ],
                        max_length=100,
                        verbose_name="фракция",
                    ),
                ),
            ],
            options={
                "verbose_name": "игрок",
                "verbose_name_plural": "игроки",
            },
        ),
        migrations.CreateModel(
            name="Round",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "round_num",
                    models.PositiveSmallIntegerField(
                        default=1,
                        unique=True,
                        validators=[
                            django.core.validators.MinValueValidator(1),
                        ],
                        verbose_name="номер раунда",
                    ),
                ),
                (
                    "title",
                    models.CharField(max_length=300, unique=True, verbose_name="название"),
                ),
                ("description", models.TextField(null=True, verbose_name="описание")),
                (
                    "time_limit_min",
                    models.PositiveSmallIntegerField(
                        default=45,
                        validators=[django.core.validators.MinValueValidator(1)],
                        verbose_name="лимит времени (минут)",
                    ),
                ),
                (
                    "started_at",
                    models.DateTimeField(
                        blank=True, null=True, unique=True, verbose_name="время начала"
                    ),
                ),
                (
                    "is_current",
                    models.BooleanField(default=False, verbose_name="идет сейчас"),
                ),
                (
                    "is_played",
                    models.BooleanField(default=False, verbose_name="уже сыгран"),
                ),
                (
                    "deployment",
                    models.CharField(
                        choices=[
                            ("Hammer and Anvil", "Молот и наковальня"),
                            ("Dawn of War", "Туман войны"),
                            ("Vanguard Strike", "Авангардный удар"),
                        ],
                        max_length=100,
                    ),
                ),
                (
                    "mission",
                    django.contrib.postgres.fields.ArrayField(
                        base_field=models.CharField(
                            choices=[
                                ("Eternal War: The Reaping", "Вечная война: Жатва"),
                                (
                                    "Eternal War: Big Guns Never Tire",
                                    "Вечная война: Большие пушки",
                                ),
                                ("Eternal War: The Scouring", "Вечная война: Чистка"),
                                ("Eternal War: Crusade", "Вечная война: Крестовый поход"),
                                (
                                    "Eternal War: The Emperor`s Will and Relic",
                                    "Вечная война: Воля Императора",
                                ),
                                (
                                    "Maelstrom of War: Cleanse and Control",
                                    "Водоворот войны: очищение и контроль",
                                ),
                                (
                                    "Maelstrom of War: Contact Lost",
                                    "Водоворот войны: Контакт потерян",
                                ),
                                (
                                    "Maelstrom of War: Spoils of War",
                                    "Водоворот войны: Сполохи войны",
                                ),
                                (
                                    "Maelstrom of War: Tactical Escalation",
                                    "Водоворот войны: Тактическая эскалация",
                                ),
                                (
                                    "Maelstrom of War: Cloak and Shadows",
                                    "Водоворот войны: Плащ и тени",
                                ),
                            ],
                            max_length=100,
                        ),
                        size=None,
                    ),
                ),
            ],
            options={
                "verbose_name": "раунд",
                "verbose_name_plural": "раунды",
            },
        ),
        migrations.CreateModel(
            name="Table",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "title",
                    models.CharField(max_length=100, unique=True, verbose_name="название"),
                ),
                (
                    "photo",
                    imagekit.models.fields.ProcessedImageField(
                        blank=True,
                        null=True,
                        upload_to="tables",
                        verbose_name="фото стола",
                    ),
                ),
            ],
            options={
                "verbose_name": "игровой стол",
                "verbose_name_plural": "игровые столы",
            },
        ),
        migrations.CreateModel(
            name="Unit",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "title",
                    models.CharField(max_length=400, unique=True, verbose_name="название"),
                ),
                (
                    "cost",
                    models.PositiveSmallIntegerField(default=0, verbose_name="стоимость в очках"),
                ),
                (
                    "category",
                    models.CharField(
                        choices=[
                            ("HQ", "Командир"),
                            ("Troops", "Пехота"),
                            ("Elites", "Элита"),
                            ("Fast Attack", "Быстрая атака"),
                            ("Heavy Support", "Артиллерия"),
                            ("Flyers", "Летательные аппараты"),
                            ("Formation", "Формация"),
                            ("Fortification", "Фортификация"),
                            ("Lord Of War", "Лорд войны"),
                            ("Other", "Прочее"),
                        ],
                        max_length=100,
                        verbose_name="тип",
                    ),
                ),
                (
                    "game_system",
                    models.CharField(
                        choices=[("40K", "40K"), ("Horus Heresy", "Ересь Хоруса")],
                        max_length=100,
                        verbose_name="игровая система",
                    ),
                ),
                (
                    "is_warlord",
                    models.BooleanField(default=False, verbose_name="варлорд"),
                ),
            ],
            options={
                "verbose_name": "отряд",
                "verbose_name_plural": "отряды",
            },
        ),
        migrations.CreateModel(
            name="PlayerUnit",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "count",
                    models.PositiveSmallIntegerField(default=1, verbose_name="количество отрядов"),
                ),
                (
                    "player",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="core.player",
                        verbose_name="игрок",
                    ),
                ),
                (
                    "unit",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="core.unit",
                        verbose_name="отряд",
                    ),
                ),
            ],
        ),
        migrations.AddField(
            model_name="player",
            name="units",
            field=models.ManyToManyField(through="core.PlayerUnit", to="core.Unit"),
        ),
        migrations.CreateModel(
            name="GamePlayer",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "victory_points",
                    models.PositiveSmallIntegerField(default=0, verbose_name="очки игрока"),
                ),
                (
                    "game",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="core.game",
                        verbose_name="игра",
                    ),
                ),
                (
                    "player",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="games",
                        to="core.player",
                        verbose_name="игрок",
                    ),
                ),
            ],
        ),
        migrations.AddField(
            model_name="game",
            name="players",
            field=models.ManyToManyField(
                related_name="assigned_games", through="core.GamePlayer", to="core.Player"
            ),
        ),
        migrations.AddField(
            model_name="game",
            name="round",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                related_name="games",
                to="core.round",
                verbose_name="раунд",
            ),
        ),
        migrations.AddField(
            model_name="game",
            name="table",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                to="core.table",
                verbose_name="стол",
            ),
        ),
        migrations.AlterUniqueTogether(
            name="game",
            unique_together={("table", "round")},
        ),
    ]

# Generated by Django 4.0 on 2021-12-18 09:21