# Generated by Django 5.1.4 on 2025-01-08 14:02

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Discount',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('discount_percentage', models.DecimalField(decimal_places=2, max_digits=5, verbose_name='Процент скидки')),
                ('start_date', models.DateField(verbose_name='Дата начала')),
                ('end_date', models.DateField(verbose_name='Дата окончания')),
                ('description', models.TextField(blank=True, null=True, verbose_name='Описание акции')),
            ],
        ),
        migrations.CreateModel(
            name='PriceList',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('entry_price', models.DecimalField(decimal_places=2, max_digits=10, verbose_name='Входная цена')),
                ('final_price', models.DecimalField(decimal_places=2, max_digits=10, verbose_name='Итоговая цена')),
                ('date_effective', models.DateField(verbose_name='Дата вступления в силу')),
                ('constraint_percent_limit', models.DecimalField(decimal_places=2, default=1000, max_digits=5, verbose_name='Лимит на наценку (%)')),
                ('constraint_price_change', models.DecimalField(decimal_places=2, default=90, max_digits=5, verbose_name='Лимит на изменение цены (%)')),
            ],
        ),
        migrations.CreateModel(
            name='PriceType',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(choices=[('regular', 'Регулярная'), ('discount', 'Скидочная'), ('promotional', 'Акционная')], max_length=50, verbose_name='Тип цены')),
            ],
        ),
        migrations.CreateModel(
            name='Product',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255, verbose_name='Наименование товара')),
                ('manufacturer_name', models.CharField(max_length=255, verbose_name='Производитель')),
                ('manufacturer_country', models.CharField(max_length=255, verbose_name='Страна производителя')),
                ('manufacturer_code', models.CharField(blank=True, max_length=50, null=True, verbose_name='Код производителя')),
                ('dimensions', models.CharField(blank=True, max_length=255, null=True, verbose_name='Размеры')),
                ('unit_of_measure', models.CharField(max_length=50, verbose_name='Единица измерения')),
                ('shelf_life_days', models.IntegerField(verbose_name='Срок годности (дни)')),
                ('barcode', models.CharField(max_length=50, unique=True, verbose_name='Штрихкод')),
            ],
        ),
        migrations.CreateModel(
            name='DiscountHistory',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('old_discount', models.DecimalField(decimal_places=2, max_digits=5, verbose_name='Старая скидка')),
                ('new_discount', models.DecimalField(decimal_places=2, max_digits=5, verbose_name='Новая скидка')),
                ('change_date', models.DateTimeField(auto_now_add=True, verbose_name='Дата изменения скидки')),
                ('reason', models.TextField(blank=True, null=True, verbose_name='Причина изменения скидки')),
                ('discount', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='pricing.discount', verbose_name='Акция/Скидка')),
            ],
        ),
        migrations.CreateModel(
            name='PriceListWithDiscount',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('final_price_after_discount', models.DecimalField(decimal_places=2, max_digits=10, verbose_name='Итоговая цена после скидки')),
                ('discount', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='pricing.discount', verbose_name='Скидка')),
                ('price_list', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='pricing.pricelist', verbose_name='Прайс-лист')),
            ],
        ),
        migrations.AddField(
            model_name='pricelist',
            name='price_type',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='pricing.pricetype', verbose_name='Тип цены'),
        ),
        migrations.CreateModel(
            name='PriceTag',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('tag_image', models.ImageField(blank=True, null=True, upload_to='price_tags/', verbose_name='Изображение ценника')),
                ('price_effective_date', models.DateField(verbose_name='Дата вступления в силу ценника')),
                ('price_list', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='pricing.pricelist', verbose_name='Прайс-лист')),
                ('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='pricing.product', verbose_name='Товар')),
            ],
        ),
        migrations.AddField(
            model_name='pricelist',
            name='product',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='pricing.product', verbose_name='Товар'),
        ),
        migrations.CreateModel(
            name='PriceChangeHistory',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('old_price', models.DecimalField(decimal_places=2, max_digits=10, verbose_name='Старая цена')),
                ('new_price', models.DecimalField(decimal_places=2, max_digits=10, verbose_name='Новая цена')),
                ('change_date', models.DateTimeField(auto_now_add=True, verbose_name='Дата изменения цены')),
                ('reason', models.TextField(blank=True, null=True, verbose_name='Причина изменения цены')),
                ('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='pricing.product', verbose_name='Товар')),
            ],
        ),
        migrations.AddField(
            model_name='discount',
            name='product',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='pricing.product', verbose_name='Товар'),
        ),
    ]
