# Generated by Django 4.2 on 2024-04-09 16:07

import django.core.validators
from django.db import migrations, models


class Migration(migrations.Migration):

    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name="Genre",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "name",
                    models.CharField(
                        help_text="Название жанра",
                        max_length=100,
                        verbose_name="Название",
                    ),
                ),
            ],
            options={
                "verbose_name": "Жанр",
                "verbose_name_plural": "Жанры",
                "db_table": "films_genres",
            },
        ),
        migrations.CreateModel(
            name="Film",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "name",
                    models.CharField(
                        help_text="Название фильма",
                        max_length=100,
                        verbose_name="Название",
                    ),
                ),
                (
                    "duration",
                    models.IntegerField(
                        help_text="Продолжительность фильма (в минутах)",
                        validators=[
                            django.core.validators.MinValueValidator(0)
                        ],
                        verbose_name="Продолжительность",
                    ),
                ),
                (
                    "release_date",
                    models.DateField(
                        help_text="Дата выхода фильма",
                        verbose_name="Дата релиза",
                    ),
                ),
                (
                    "genres",
                    models.ManyToManyField(
                        help_text="Жанры фильма",
                        related_name="films",
                        to="films.genre",
                        verbose_name="Жанры",
                    ),
                ),
            ],
            options={
                "verbose_name": "Фильм",
                "verbose_name_plural": "Фильмы",
                "db_table": "films_films",
            },
        ),
    ]
