# Generated by Django 5.1.4 on 2025-01-08 15:29

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


class Migration(migrations.Migration):

    dependencies = [
        ('product_directory', '0001_initial'),
        ('warehouse', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='Warehouse',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255, verbose_name='Название склада')),
                ('location', models.CharField(max_length=255, verbose_name='Расположение склада')),
                ('is_active', models.BooleanField(default=True, verbose_name='Активен')),
            ],
            options={
                'verbose_name': 'Склад',
                'verbose_name_plural': 'Склады',
            },
        ),
        migrations.AlterModelOptions(
            name='stock',
            options={},
        ),
        migrations.AlterUniqueTogether(
            name='stock',
            unique_together=set(),
        ),
        migrations.CreateModel(
            name='StorageLocation',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255, verbose_name='Место хранения')),
                ('temperature_control', models.BooleanField(default=False, verbose_name='Требуется контроль температуры')),
                ('warehouse', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='storage_locations', to='warehouse.warehouse', verbose_name='Склад')),
            ],
            options={
                'verbose_name': 'Место хранения',
                'verbose_name_plural': 'Места хранения',
            },
        ),
        migrations.CreateModel(
            name='StockOperation',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('operation_type', models.CharField(choices=[('Incoming', 'Приход'), ('Outgoing', 'Расход'), ('Transfer', 'Перемещение'), ('WriteOff', 'Списание')], max_length=50, verbose_name='Тип операции')),
                ('quantity', models.PositiveIntegerField(verbose_name='Количество')),
                ('operation_date', models.DateTimeField(auto_now_add=True, verbose_name='Дата операции')),
                ('expiration_date', models.DateField(blank=True, null=True, verbose_name='Срок годности')),
                ('reason', models.TextField(blank=True, null=True, verbose_name='Причина (для списания)')),
                ('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='warehouse_stock_operations', to='product_directory.product', verbose_name='Товар')),
                ('storage_location', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='warehouse.storagelocation', verbose_name='Место хранения')),
                ('warehouse', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='warehouse.warehouse', verbose_name='Склад')),
            ],
            options={
                'verbose_name': 'Операция с товаром',
                'verbose_name_plural': 'Операции с товарами',
            },
        ),
    ]
