# Generated by Django 4.2.25 on 2026-01-12 16:02

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import uuid


class Migration(migrations.Migration):

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('core', '0008_product_image'),
    ]

    operations = [
        migrations.CreateModel(
            name='ExpenseCategory',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('name', models.CharField(max_length=100, unique=True)),
                ('category_type', models.CharField(choices=[('business', 'Business Expense'), ('personal', 'Personal Expense')], default='business', max_length=20)),
                ('is_active', models.BooleanField(default=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
            ],
            options={
                'verbose_name': 'Expense Category',
                'verbose_name_plural': 'Expense Categories',
                'ordering': ['category_type', 'name'],
            },
        ),
        migrations.CreateModel(
            name='Expense',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('date', models.DateField(help_text='When was this expense incurred?')),
                ('amount', models.DecimalField(decimal_places=2, max_digits=12)),
                ('expense_type', models.CharField(choices=[('business', 'Business Expense'), ('personal', 'Personal Expense')], max_length=20)),
                ('description', models.TextField(help_text="Describe this expense (e.g., 'Lent John for medical emergency')")),
                ('reference_number', models.CharField(blank=True, help_text='Receipt number, invoice number, etc.', max_length=100, null=True)),
                ('payment_method', models.CharField(choices=[('cash', 'Cash'), ('mpesa_paybill', 'M-Pesa Paybill'), ('mpesa_till', 'M-Pesa Till'), ('bank_transfer', 'Bank Transfer')], default='bank_transfer', help_text='Payment method used', max_length=50)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('category', models.ForeignKey(help_text='What type of expense is this?', on_delete=django.db.models.deletion.PROTECT, related_name='expenses', to='core.expensecategory')),
                ('created_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL)),
                ('paid_from_location', models.ForeignKey(help_text='Location that paid (usually MainStore)', on_delete=django.db.models.deletion.PROTECT, related_name='expenses_paid', to='core.location')),
            ],
            options={
                'verbose_name': 'Expense',
                'verbose_name_plural': 'Expenses',
                'ordering': ['-date', '-created_at'],
            },
        ),
    ]
