# Generated by Django 5.2.7 on 2026-02-02 09:49

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


class Migration(migrations.Migration):

    dependencies = [
        ('core', '0007_sale_balance_due_sale_due_date_sale_invoice_number_and_more'),
    ]

    operations = [
        migrations.CreateModel(
            name='Quotation',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('quotation_number', models.CharField(blank=True, max_length=50, verbose_name='Quotation Number')),
                ('total_amount', models.DecimalField(decimal_places=3, max_digits=15, verbose_name='Total Amount')),
                ('discount', models.DecimalField(decimal_places=3, default=0, max_digits=15, verbose_name='Discount')),
                ('status', models.CharField(choices=[('draft', 'Draft'), ('sent', 'Sent'), ('accepted', 'Accepted'), ('rejected', 'Rejected'), ('converted', 'Converted to Invoice')], default='draft', max_length=20, verbose_name='Status')),
                ('valid_until', models.DateField(blank=True, null=True, verbose_name='Valid Until')),
                ('terms_and_conditions', models.TextField(blank=True, verbose_name='Terms and Conditions')),
                ('notes', models.TextField(blank=True, verbose_name='Notes')),
                ('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='quotations', to='core.customer')),
            ],
        ),
        migrations.AddField(
            model_name='sale',
            name='quotation',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='converted_sale', to='core.quotation'),
        ),
        migrations.CreateModel(
            name='QuotationItem',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('quantity', models.PositiveIntegerField(verbose_name='Quantity')),
                ('unit_price', models.DecimalField(decimal_places=3, max_digits=12, verbose_name='Unit 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')),
                ('quotation', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='items', to='core.quotation')),
            ],
        ),
    ]
