# Generated by Django 5.2.7 on 2026-02-02 08:35

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


class Migration(migrations.Migration):

    dependencies = [
        ('core', '0005_product_cost_price_product_is_active_and_more'),
    ]

    operations = [
        migrations.AddField(
            model_name='purchase',
            name='balance_due',
            field=models.DecimalField(decimal_places=3, default=0, max_digits=15, verbose_name='Balance Due'),
        ),
        migrations.AddField(
            model_name='purchase',
            name='due_date',
            field=models.DateField(blank=True, null=True, verbose_name='Due Date'),
        ),
        migrations.AddField(
            model_name='purchase',
            name='invoice_number',
            field=models.CharField(blank=True, max_length=50, verbose_name='Invoice Number'),
        ),
        migrations.AddField(
            model_name='purchase',
            name='notes',
            field=models.TextField(blank=True, verbose_name='Notes'),
        ),
        migrations.AddField(
            model_name='purchase',
            name='paid_amount',
            field=models.DecimalField(decimal_places=3, default=0, max_digits=15, verbose_name='Paid Amount'),
        ),
        migrations.AddField(
            model_name='purchase',
            name='payment_type',
            field=models.CharField(choices=[('cash', 'Cash'), ('credit', 'Credit'), ('partial', 'Partial')], default='cash', max_length=20, verbose_name='Payment Type'),
        ),
        migrations.AddField(
            model_name='purchase',
            name='status',
            field=models.CharField(choices=[('paid', 'Paid'), ('partial', 'Partial'), ('unpaid', 'Unpaid')], default='paid', max_length=20, verbose_name='Status'),
        ),
        migrations.AlterField(
            model_name='purchase',
            name='supplier',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='purchases', to='core.supplier'),
        ),
        migrations.AlterField(
            model_name='purchase',
            name='total_amount',
            field=models.DecimalField(decimal_places=3, max_digits=15, verbose_name='Total Amount'),
        ),
        migrations.CreateModel(
            name='PurchaseItem',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('quantity', models.PositiveIntegerField(verbose_name='Quantity')),
                ('cost_price', models.DecimalField(decimal_places=3, max_digits=12, verbose_name='Cost Price')),
                ('line_total', models.DecimalField(decimal_places=3, max_digits=15, verbose_name='Line Total')),
                ('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.product')),
                ('purchase', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='items', to='core.purchase')),
            ],
        ),
        migrations.CreateModel(
            name='PurchasePayment',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('amount', models.DecimalField(decimal_places=3, max_digits=15, verbose_name='Amount')),
                ('payment_date', models.DateField(default=django.utils.timezone.now, verbose_name='Payment Date')),
                ('payment_method', models.CharField(default='Cash', max_length=50, verbose_name='Payment Method')),
                ('notes', models.TextField(blank=True, verbose_name='Notes')),
                ('purchase', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='payments', to='core.purchase')),
            ],
        ),
    ]
