# Generated by Django 5.2.11 on 2026-04-20 01:27

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


class Migration(migrations.Migration):

    dependencies = [
        ('analytics', '0001_add_analytics_refund'),
        ('companies', '0005_add_enable_audit_log'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='ExpenseCategory',
            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)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('company', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='expense_categories', to='companies.company')),
            ],
            options={
                'verbose_name_plural': 'Expense Categories',
                'unique_together': {('company', 'name')},
            },
        ),
        migrations.CreateModel(
            name='OperatingExpense',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('amount', models.DecimalField(decimal_places=2, max_digits=12)),
                ('expense_date', models.DateField(default=django.utils.timezone.now)),
                ('reference', models.CharField(blank=True, help_text='Receipt/Invoice # or short description', max_length=100)),
                ('notes', models.TextField(blank=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('category', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='expenses', to='analytics.expensecategory')),
                ('company', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='operating_expenses', to='companies.company')),
                ('logged_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='logged_expenses', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'ordering': ['-expense_date', '-created_at'],
            },
        ),
    ]
