# Generated by Django 6.0.5 on 2026-05-11 07:40

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Customer',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=150)),
                ('location', models.CharField(blank=True, max_length=200)),
                ('contact', models.CharField(blank=True, max_length=20)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
            ],
            options={
                'ordering': ['name'],
            },
        ),
        migrations.CreateModel(
            name='Expense',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('category', models.CharField(choices=[('Rent', 'Rent'), ('Stock / Refill', 'Stock / Refill'), ('Transport', 'Transport'), ('Salaries', 'Salaries'), ('Utilities', 'Utilities'), ('Equipment', 'Equipment'), ('Maintenance', 'Maintenance'), ('Licensing', 'Licensing'), ('Other', 'Other')], max_length=30)),
                ('description', models.CharField(max_length=300)),
                ('amount', models.DecimalField(decimal_places=2, max_digits=10, validators=[django.core.validators.MinValueValidator(0.01)])),
                ('payment_method', models.CharField(choices=[('cash', 'Cash'), ('mpesa', 'M-Pesa')], default='cash', max_length=10)),
                ('transaction_number', models.CharField(blank=True, max_length=50)),
                ('date', models.DateField(default=django.utils.timezone.now)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
            ],
            options={
                'ordering': ['-date', '-created_at'],
            },
        ),
        migrations.CreateModel(
            name='ShopSettings',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('pin_hash', models.CharField(max_length=256)),
                ('token', models.CharField(blank=True, max_length=64)),
                ('token_created', models.DateTimeField(blank=True, null=True)),
            ],
            options={
                'verbose_name': 'Shop Settings',
            },
        ),
        migrations.CreateModel(
            name='Product',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('brand', models.CharField(choices=[('K-Gas', 'K-Gas'), ('Total', 'Total'), ('Hashi Energy', 'Hashi Energy'), ('Oryx', 'Oryx'), ('Meru', 'Meru'), ('Pro-Gas', 'Pro-Gas'), ('Afrigas', 'Afrigas'), ('Other', 'Other')], max_length=50)),
                ('weight', models.CharField(choices=[('3kg', '3kg'), ('6kg', '6kg'), ('13kg', '13kg'), ('22kg', '22kg'), ('35kg', '35kg'), ('45kg', '45kg'), ('50kg', '50kg')], max_length=10)),
                ('price', models.DecimalField(decimal_places=2, max_digits=10, validators=[django.core.validators.MinValueValidator(0)])),
                ('full_qty', models.PositiveIntegerField(default=0)),
                ('empty_qty', models.PositiveIntegerField(default=0)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
            ],
            options={
                'ordering': ['brand', 'weight'],
                'unique_together': {('brand', 'weight')},
            },
        ),
        migrations.CreateModel(
            name='Sale',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('qty', models.PositiveIntegerField(default=1, validators=[django.core.validators.MinValueValidator(1)])),
                ('amount', models.DecimalField(decimal_places=2, max_digits=10)),
                ('paid', models.DecimalField(decimal_places=2, max_digits=10)),
                ('credit', models.DecimalField(decimal_places=2, default=0, max_digits=10)),
                ('payment_method', models.CharField(choices=[('cash', 'Cash'), ('mpesa', 'M-Pesa')], default='cash', max_length=10)),
                ('transaction_number', models.CharField(blank=True, max_length=50)),
                ('date', models.DateTimeField(default=django.utils.timezone.now)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('customer', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='sales', to='shop.customer')),
                ('product', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='sales', to='shop.product')),
            ],
            options={
                'ordering': ['-date'],
            },
        ),
        migrations.CreateModel(
            name='CreditPayment',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('amount', models.DecimalField(decimal_places=2, max_digits=10, validators=[django.core.validators.MinValueValidator(0.01)])),
                ('date', models.DateTimeField(default=django.utils.timezone.now)),
                ('note', models.CharField(blank=True, max_length=200)),
                ('sale', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='credit_payments', to='shop.sale')),
            ],
            options={
                'ordering': ['-date'],
            },
        ),
    ]
