# Generated by Django 4.2.7 on 2026-02-06 16:56

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('normalisee', '0003_societe_nif_rdc'),
    ]

    operations = [
        migrations.CreateModel(
            name='NormalizedInvoice',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('source_filename', models.CharField(blank=True, max_length=255, null=True)),
                ('source_sha1', models.CharField(max_length=40, unique=True)),
                ('source_file', models.FileField(blank=True, null=True, upload_to='extract/invoices/')),
                ('client_nom', models.CharField(blank=True, max_length=200, verbose_name='Client - Nom / Raison sociale')),
                ('client_nif', models.CharField(blank=True, max_length=30, verbose_name='Client - NIF')),
                ('client_telephone', models.CharField(blank=True, max_length=30, verbose_name='Client - Téléphone')),
                ('client_adresse', models.TextField(blank=True, verbose_name='Client - Adresse')),
                ('invoice_type', models.CharField(blank=True, max_length=80, null=True)),
                ('invoice_number', models.CharField(blank=True, max_length=80, null=True)),
                ('code_def_dgi', models.CharField(blank=True, max_length=120, null=True)),
                ('def_nid', models.CharField(blank=True, max_length=60, null=True)),
                ('def_compteurs', models.CharField(blank=True, max_length=60, null=True)),
                ('def_datetime', models.CharField(blank=True, max_length=30, null=True)),
                ('nb_articles', models.PositiveIntegerField(blank=True, null=True)),
                ('ht_taxable_16', models.DecimalField(blank=True, decimal_places=2, max_digits=14, null=True)),
                ('tva_16', models.DecimalField(blank=True, decimal_places=2, max_digits=14, null=True)),
                ('total_ttc_cdf', models.DecimalField(blank=True, decimal_places=2, max_digits=14, null=True)),
                ('payment_mode', models.CharField(blank=True, max_length=40, null=True)),
                ('total_ttc_usd', models.DecimalField(blank=True, decimal_places=2, max_digits=14, null=True)),
                ('exchange_rate', models.DecimalField(blank=True, decimal_places=6, max_digits=14, null=True)),
                ('exchange_rate_date', models.CharField(blank=True, max_length=10, null=True)),
                ('isf', models.CharField(blank=True, max_length=80, null=True)),
                ('qr_raw', models.TextField(blank=True, null=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('societe', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='extracted_invoices', to='normalisee.societe')),
            ],
            options={
                'verbose_name': 'Facture extraite',
                'verbose_name_plural': 'Factures extraites',
                'ordering': ['-created_at'],
            },
        ),
        migrations.CreateModel(
            name='NormalizedInvoiceLine',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('designation', models.CharField(max_length=255, verbose_name='Désignation')),
                ('unit_price_ttc', models.DecimalField(blank=True, decimal_places=2, max_digits=14, null=True)),
                ('quantity', models.DecimalField(blank=True, decimal_places=3, max_digits=14, null=True)),
                ('amount_ttc', models.DecimalField(blank=True, decimal_places=2, max_digits=14, null=True)),
                ('invoice', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='lines', to='extratfile.normalizedinvoice')),
            ],
            options={
                'verbose_name': 'Ligne facture extraite',
                'verbose_name_plural': 'Lignes factures extraites',
            },
        ),
    ]
