# Generated by Django 5.1.6 on 2025-03-06 11:19

import django.db.models.deletion
import django.utils.timezone
from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ('draw', '0004_alter_lottery_options_alter_prize_options'),
        ('webapp', '0003_alter_client_options_alter_invoice_options'),
    ]

    operations = [
        migrations.AlterModelOptions(
            name='lottery',
            options={},
        ),
        migrations.AlterModelOptions(
            name='prize',
            options={},
        ),
        migrations.AddField(
            model_name='lottery',
            name='created_at',
            field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now, verbose_name='Дата создания'),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name='lotteryparticipant',
            name='used',
            field=models.BooleanField(default=False, help_text='Отметка, что этот счет уже участвовал в розыгрыше', verbose_name='Использован'),
        ),
        migrations.AlterField(
            model_name='lotteryparticipant',
            name='invoice',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='draw.lotteryparticipant', verbose_name='Счет участника'),
        ),
        migrations.AlterField(
            model_name='prize',
            name='winner',
            field=models.ForeignKey(blank=True, help_text='Выберите счет участника лотереи, который выиграл приз', null=True, on_delete=django.db.models.deletion.SET_NULL, to='webapp.invoice', verbose_name='Победитель (счет)'),
        ),
        migrations.CreateModel(
            name='DrawResult',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('confirmed', models.BooleanField(default=False, verbose_name='Подтвержден')),
                ('drawn_at', models.DateTimeField(auto_now_add=True, verbose_name='Время розыгрыша')),
                ('lottery', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='draw_results', to='draw.lottery', verbose_name='Лотерея')),
                ('participant', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='draw.lotteryparticipant', verbose_name='Победитель')),
                ('prize', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='draw.prize', verbose_name='Приз')),
            ],
        ),
    ]
