# Generated by Django 5.1.2 on 2025-02-10 14:59

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


class Migration(migrations.Migration):
    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name="Customer",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "created_at",
                    models.DateTimeField(
                        auto_now_add=True, verbose_name="Date de création"
                    ),
                ),
                (
                    "updated_at",
                    models.DateTimeField(
                        auto_now=True, verbose_name="Date de modification"
                    ),
                ),
                ("name", models.CharField()),
                ("street", models.CharField()),
                ("zipcode", models.CharField()),
                ("city", models.CharField()),
                ("country", models.CharField()),
            ],
            options={
                "abstract": False,
            },
        ),
        migrations.CreateModel(
            name="Organisation",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("name", models.CharField()),
                ("street", models.CharField()),
                ("zipcode", models.CharField()),
                ("city", models.CharField()),
                ("country", models.CharField()),
                ("email", models.EmailField(max_length=254)),
                (
                    "logo",
                    models.ImageField(
                        upload_to=hbdjinvoicing.models.organisation_logo_upload_to
                    ),
                ),
                ("bottom_comment", models.TextField()),
                ("legal_status", models.CharField()),
                ("siren", models.CharField()),
                ("siret", models.CharField()),
                ("vat_id", models.CharField()),
            ],
            options={
                "abstract": False,
            },
        ),
        migrations.CreateModel(
            name="Invoice",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "created_at",
                    models.DateTimeField(
                        auto_now_add=True, verbose_name="Date de création"
                    ),
                ),
                (
                    "updated_at",
                    models.DateTimeField(
                        auto_now=True, verbose_name="Date de modification"
                    ),
                ),
                ("name", models.CharField()),
                ("street", models.CharField()),
                ("zipcode", models.CharField()),
                ("city", models.CharField()),
                ("country", models.CharField()),
                ("number", models.CharField(unique=True)),
                (
                    "date",
                    models.DateField(default=hbdjinvoicing.models.invoice_default_date),
                ),
                ("payment_mode", models.CharField()),
                (
                    "total_vat_excl",
                    models.DecimalField(decimal_places=2, default=0, max_digits=9),
                ),
                (
                    "total_vat_incl",
                    models.DecimalField(decimal_places=2, default=0, max_digits=9),
                ),
                (
                    "customer",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.PROTECT,
                        to="hbdjinvoicing.customer",
                    ),
                ),
                (
                    "organisation",
                    models.ForeignKey(
                        default=None,
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        to="hbdjinvoicing.organisation",
                    ),
                ),
            ],
            options={
                "abstract": False,
            },
        ),
        migrations.CreateModel(
            name="InvoiceLine",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "created_at",
                    models.DateTimeField(
                        auto_now_add=True, verbose_name="Date de création"
                    ),
                ),
                (
                    "updated_at",
                    models.DateTimeField(
                        auto_now=True, verbose_name="Date de modification"
                    ),
                ),
                ("title", models.CharField()),
                ("descritiption", models.CharField()),
                ("quantity", models.DecimalField(decimal_places=2, max_digits=9)),
                ("unit", models.CharField()),
                ("unit_price", models.DecimalField(decimal_places=2, max_digits=9)),
                ("price_vat_excl", models.DecimalField(decimal_places=2, max_digits=9)),
                ("vat_rate", models.DecimalField(decimal_places=2, max_digits=9)),
                ("price_vat_only", models.DecimalField(decimal_places=2, max_digits=9)),
                ("price_vat_incl", models.DecimalField(decimal_places=2, max_digits=9)),
                (
                    "invoice",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="hbdjinvoicing.invoice",
                    ),
                ),
            ],
            options={
                "abstract": False,
            },
        ),
        migrations.CreateModel(
            name="InvoiceVat",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "created_at",
                    models.DateTimeField(
                        auto_now_add=True, verbose_name="Date de création"
                    ),
                ),
                (
                    "updated_at",
                    models.DateTimeField(
                        auto_now=True, verbose_name="Date de modification"
                    ),
                ),
                ("vat_rate", models.DecimalField(decimal_places=2, max_digits=9)),
                ("price", models.DecimalField(decimal_places=2, max_digits=9)),
                (
                    "invoice",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="hbdjinvoicing.invoice",
                    ),
                ),
            ],
            options={
                "abstract": False,
            },
        ),
    ]
