# Generated by Django 4.2 on 2024-04-23 03:20

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


class Migration(migrations.Migration):

    replaces = [
        ('timetable', '0002_rename_rows_row_filmsession'),
        (
            'timetable',
            '0003_alter_filmsession_auditorium_alter_filmsession_film_and_more',
        ),
        ('timetable', '0004_alter_row_auditorium'),
        ('timetable', '0005_filmsession_end_datetime'),
        ('timetable', '0006_remove_auditorium_row_count'),
    ]

    dependencies = [
        ('films', '0001_initial'),
        ('timetable', '0001_initial'),
        ('films', '0002_alter_film_genres'),
    ]

    operations = [
        migrations.RenameModel(
            old_name='Rows',
            new_name='Row',
        ),
        migrations.AlterField(
            model_name='row',
            name='auditorium',
            field=models.OneToOneField(
                on_delete=django.db.models.deletion.CASCADE,
                related_name='rows',
                related_query_name='rows',
                to='timetable.auditorium',
                verbose_name='Зал',
            ),
        ),
        migrations.AlterField(
            model_name='row',
            name='auditorium',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                related_name='rows',
                related_query_name='rows',
                to='timetable.auditorium',
                verbose_name='Зал',
            ),
        ),
        migrations.CreateModel(
            name='FilmSession',
            fields=[
                (
                    'id',
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name='ID',
                    ),
                ),
                (
                    'start_datetime',
                    models.DateTimeField(
                        verbose_name='Дата и время начала сеанса'
                    ),
                ),
                (
                    'price',
                    models.FloatField(
                        validators=[
                            django.core.validators.MinValueValidator(1)
                        ],
                        verbose_name='Цена билета',
                    ),
                ),
                (
                    'auditorium',
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name='sessions',
                        related_query_name='sessions',
                        to='timetable.auditorium',
                        verbose_name='Зал',
                    ),
                ),
                (
                    'film',
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name='sessions',
                        related_query_name='sessions',
                        to='films.film',
                        verbose_name='Фильм',
                    ),
                ),
                (
                    'end_datetime',
                    models.DateTimeField(
                        blank=True,
                        null=True,
                        verbose_name='Дата и время начала сеанса',
                    ),
                ),
            ],
            options={
                'verbose_name': 'Сеанс',
                'verbose_name_plural': 'Сеансы',
                'db_table': 'timetable_film_sessions',
            },
        ),
        migrations.RemoveField(
            model_name='auditorium',
            name='row_count',
        ),
    ]
