# Generated by Django 4.2.28 on 2026-02-22 17:36

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='Category',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100)),
                ('description', models.TextField(blank=True)),
            ],
            options={
                'verbose_name_plural': 'Categories',
            },
        ),
        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)),
                ('sku', models.CharField(blank=True, max_length=100, unique=True)),
                ('unit', models.CharField(choices=[('piece', 'Piece'), ('kg', 'Kilogram'), ('litre', 'Litre'), ('box', 'Box'), ('dozen', 'Dozen'), ('pack', 'Pack')], default='piece', max_length=20)),
                ('cost_price', models.DecimalField(decimal_places=2, default=0, max_digits=15)),
                ('selling_price', models.DecimalField(decimal_places=2, default=0, max_digits=15)),
                ('stock_quantity', models.DecimalField(decimal_places=2, default=0, max_digits=15)),
                ('low_stock_alert', models.DecimalField(decimal_places=2, default=5, max_digits=15)),
                ('is_active', models.BooleanField(default=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('category', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='products', to='inventory.category')),
            ],
        ),
        migrations.CreateModel(
            name='StockMovement',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('movement_type', models.CharField(choices=[('stock_in', 'Stock In'), ('stock_out', 'Stock Out'), ('sale', 'Sale'), ('adjustment', 'Adjustment'), ('return', 'Return')], max_length=20)),
                ('quantity', models.DecimalField(decimal_places=2, max_digits=15)),
                ('cost_price', models.DecimalField(decimal_places=2, default=0, max_digits=15)),
                ('reference', models.CharField(blank=True, max_length=100)),
                ('note', models.TextField(blank=True)),
                ('date', models.DateField(default=django.utils.timezone.now)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('created_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL)),
                ('product', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='movements', to='inventory.product')),
            ],
        ),
    ]
