# Generated by Django 4.2.5 on 2026-01-23 06:31

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


class Migration(migrations.Migration):
    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name="Confirm_Quote",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("created_at", models.DateTimeField(auto_now_add=True, null=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
                ("deleted_at", models.DateTimeField(blank=True, null=True)),
                ("pdf", models.FileField(upload_to="confirm_quote_pdf")),
            ],
            options={
                "abstract": False,
            },
        ),
        migrations.CreateModel(
            name="ContractOfSale",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("created_at", models.DateTimeField(auto_now_add=True, null=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
                ("deleted_at", models.DateTimeField(blank=True, null=True)),
                ("content", models.TextField()),
                ("is_active", models.BooleanField(default=True)),
            ],
            options={
                "verbose_name_plural": "Contracts of Sale",
            },
        ),
        migrations.CreateModel(
            name="Customer_Payment",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("created_at", models.DateTimeField(auto_now_add=True, null=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
                ("deleted_at", models.DateTimeField(blank=True, null=True)),
                ("uid", models.TextField(null=True)),
                ("description", models.CharField(max_length=255, null=True)),
                ("bill_number", models.CharField(max_length=50, null=True)),
                ("paydate", models.DateField(auto_now_add=True)),
                ("due_date", models.DateField(null=True)),
                (
                    "payable_amount",
                    models.DecimalField(decimal_places=2, max_digits=10),
                ),
                (
                    "paid_amount",
                    models.DecimalField(decimal_places=2, max_digits=10, null=True),
                ),
                (
                    "due_amount",
                    models.DecimalField(decimal_places=2, max_digits=10, null=True),
                ),
                ("payment_reference_id", models.TextField(blank=True, null=True)),
                ("stripe_id", models.TextField(blank=True, null=True)),
            ],
            options={
                "abstract": False,
            },
        ),
        migrations.CreateModel(
            name="Discount",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "discount_price",
                    models.IntegerField(blank=True, default=0, null=True),
                ),
            ],
        ),
        migrations.CreateModel(
            name="GST",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("gst_price", models.IntegerField(blank=True, default=0, null=True)),
            ],
        ),
        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, null=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
                ("deleted_at", models.DateTimeField(blank=True, null=True)),
                ("uid", models.TextField(null=True)),
                ("sale_uid", models.TextField(null=True)),
                (
                    "mailstatus",
                    models.PositiveSmallIntegerField(
                        choices=[
                            (0, "Created"),
                            (1, "Sented"),
                            (2, "Accepted"),
                            (3, "Open"),
                            (4, "Close"),
                        ],
                        default=0,
                    ),
                ),
                ("invoice_date", models.DateField(null=True)),
                ("due_date", models.DateField(null=True)),
                ("discount_type", models.CharField(max_length=50, null=True)),
                ("po_number", models.CharField(max_length=50, null=True)),
                ("subtotal", models.DecimalField(decimal_places=2, max_digits=10)),
                ("discount", models.DecimalField(decimal_places=2, max_digits=10)),
                (
                    "discount_percent",
                    models.IntegerField(blank=True, default=0, null=True),
                ),
                ("gst", models.DecimalField(decimal_places=2, max_digits=10)),
                ("gst_percent", models.IntegerField(blank=True, default=0, null=True)),
                ("total", models.DecimalField(decimal_places=2, max_digits=10)),
                (
                    "total_paid_amount",
                    models.DecimalField(decimal_places=2, max_digits=10, null=True),
                ),
                (
                    "payable_amount",
                    models.DecimalField(decimal_places=2, max_digits=10),
                ),
                ("is_trade", models.PositiveSmallIntegerField(default=0)),
                (
                    "pdf_file",
                    models.FileField(blank=True, null=True, upload_to="invoice_pdfs/"),
                ),
                (
                    "doc_file",
                    models.FileField(blank=True, null=True, upload_to="invoice_docs/"),
                ),
                (
                    "myob_invoice_pdf",
                    models.FileField(
                        blank=True, null=True, upload_to="myob_invoice_pdf/"
                    ),
                ),
                ("is_active", models.BooleanField(default=True)),
                (
                    "status",
                    models.PositiveSmallIntegerField(
                        choices=[
                            (0, "Created"),
                            (1, "Sented"),
                            (2, "Accepted"),
                            (3, "Open"),
                            (4, "Close"),
                        ],
                        default=0,
                    ),
                ),
                ("payment_reference_id", models.TextField(blank=True, null=True)),
                ("stripe_id", models.TextField(blank=True, null=True)),
                (
                    "flag",
                    models.PositiveSmallIntegerField(
                        blank=True, choices=[(0, "Created"), (1, "Invoice")], null=True
                    ),
                ),
                ("comment", models.TextField(blank=True, null=True)),
            ],
            options={
                "abstract": False,
            },
        ),
        migrations.CreateModel(
            name="InvoiceItem",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("created_at", models.DateTimeField(auto_now_add=True, null=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
                ("deleted_at", models.DateTimeField(blank=True, null=True)),
                ("description", models.CharField(max_length=255, null=True)),
                ("is_trade_product", models.PositiveSmallIntegerField(default=0)),
                ("cost_per_unit", models.DecimalField(decimal_places=2, max_digits=10)),
                ("qty", models.IntegerField()),
                ("subtotal", models.DecimalField(decimal_places=2, max_digits=10)),
            ],
            options={
                "abstract": False,
            },
        ),
        migrations.CreateModel(
            name="InvoicePdf",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("created_at", models.DateTimeField(auto_now_add=True, null=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
                ("deleted_at", models.DateTimeField(blank=True, null=True)),
                ("pdf", models.FileField(upload_to="myobinvoice_pdf")),
            ],
            options={
                "abstract": False,
            },
        ),
        migrations.CreateModel(
            name="Order",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("created_at", models.DateTimeField(auto_now_add=True, null=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
                ("deleted_at", models.DateTimeField(blank=True, null=True)),
                ("order_date", models.DateField(auto_now_add=True, null=True)),
            ],
            options={
                "abstract": False,
            },
        ),
        migrations.CreateModel(
            name="Order_Item",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("created_at", models.DateTimeField(auto_now_add=True, null=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
                ("deleted_at", models.DateTimeField(blank=True, null=True)),
                (
                    "service_type",
                    models.PositiveSmallIntegerField(
                        choices=[(1, "Installation"), (2, "Service")],
                        default=0,
                        null=True,
                    ),
                ),
                (
                    "work_order_pdf",
                    models.FileField(
                        blank=True, null=True, upload_to="workorder_pdfs/"
                    ),
                ),
                ("order_identifier", models.IntegerField(null=True)),
                (
                    "status",
                    models.PositiveSmallIntegerField(
                        choices=[
                            (0, "Ordered"),
                            (1, "Shipped"),
                            (2, "Watered"),
                            (3, "Arrived"),
                            (4, "Booked For Install"),
                            (5, "Not Started"),
                            (6, "In Progress"),
                            (7, "Installed"),
                            (8, "Service Requested"),
                            (9, "Parts Requested"),
                            (10, "Installed"),
                            (11, "Service Completed"),
                            (12, "Ready For Install"),
                        ],
                        default=0,
                        null=True,
                    ),
                ),
                ("latitude", models.FloatField(null=True)),
                ("longitude", models.FloatField(null=True)),
                ("view_by_technician", models.BooleanField(default=False)),
                ("installation_complete", models.BooleanField(default=False)),
                ("installed_date", models.DateField(blank=True, null=True)),
                ("warranty_end_date", models.DateField(blank=True, null=True)),
                (
                    "cost_per_unit",
                    models.DecimalField(decimal_places=2, max_digits=10, null=True),
                ),
                ("qty", models.IntegerField(null=True)),
                ("is_trade", models.IntegerField(null=True)),
                (
                    "subtotal",
                    models.DecimalField(decimal_places=2, max_digits=10, null=True),
                ),
                ("is_signature", models.BooleanField(default=False)),
            ],
            options={
                "abstract": False,
            },
        ),
        migrations.CreateModel(
            name="Quotation",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("created_at", models.DateTimeField(auto_now_add=True, null=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
                ("deleted_at", models.DateTimeField(blank=True, null=True)),
                ("quote_title", models.CharField(max_length=255, null=True)),
                ("quote_date", models.DateField(null=True)),
                ("subtotal", models.DecimalField(decimal_places=2, max_digits=10)),
                ("discount_type", models.CharField(max_length=50, null=True)),
                ("discount", models.DecimalField(decimal_places=2, max_digits=10)),
                (
                    "discount_percent",
                    models.IntegerField(blank=True, default=0, null=True),
                ),
                ("gst", models.DecimalField(decimal_places=2, max_digits=10)),
                ("gst_percent", models.IntegerField(blank=True, default=0, null=True)),
                ("email_to_financial_broker", models.BooleanField(default=False)),
                (
                    "total",
                    models.DecimalField(decimal_places=2, max_digits=10, null=True),
                ),
                ("sent_mail_customer", models.BooleanField(default=False)),
                ("is_trade", models.PositiveSmallIntegerField(default=0)),
                (
                    "manual_quote_pdf",
                    models.FileField(
                        blank=True, null=True, upload_to="manual_quote_pdfs/"
                    ),
                ),
                (
                    "manual_quote_doc",
                    models.FileField(
                        blank=True, null=True, upload_to="manual_quote_docs/"
                    ),
                ),
                ("sent_mail_admin", models.BooleanField(default=False)),
                ("admin_response_mail", models.BooleanField(default=False)),
                ("quote_send_date", models.DateField(blank=True, null=True)),
                (
                    "producttable_page_pdf",
                    models.FileField(
                        blank=True, null=True, upload_to="manual_quote_pdfs/"
                    ),
                ),
                (
                    "first_page_pdf",
                    models.FileField(
                        blank=True, null=True, upload_to="manual_quote_pdfs/"
                    ),
                ),
                (
                    "contract_page_pdf",
                    models.FileField(
                        blank=True, null=True, upload_to="manual_quote_pdfs/"
                    ),
                ),
                (
                    "pdf_file",
                    models.FileField(blank=True, null=True, upload_to="quote_pdfs/"),
                ),
                (
                    "doc_file",
                    models.FileField(blank=True, null=True, upload_to="quote_docs/"),
                ),
                ("is_active", models.BooleanField(default=True)),
                (
                    "status",
                    models.PositiveSmallIntegerField(
                        choices=[
                            (0, "Created"),
                            (1, "Sented"),
                            (2, "Accepted"),
                            (3, "Converted Invoice"),
                            (4, "Rejected"),
                            (5, "Approved Admin"),
                        ],
                        default=0,
                    ),
                ),
                ("version_number", models.PositiveIntegerField(default=1)),
                ("required_send_to_admin", models.PositiveIntegerField(default=0)),
            ],
            options={
                "abstract": False,
            },
        ),
        migrations.CreateModel(
            name="QuotationItem",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("created_at", models.DateTimeField(auto_now_add=True, null=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
                ("deleted_at", models.DateTimeField(blank=True, null=True)),
                ("description", models.CharField(max_length=255, null=True)),
                ("cost_per_unit", models.DecimalField(decimal_places=2, max_digits=10)),
                ("qty", models.IntegerField()),
                ("subtotal", models.DecimalField(decimal_places=2, max_digits=10)),
                ("is_trade_product", models.PositiveSmallIntegerField(default=0)),
            ],
            options={
                "abstract": False,
            },
        ),
        migrations.CreateModel(
            name="QuotationVersion",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("created_at", models.DateTimeField(auto_now_add=True, null=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
                ("deleted_at", models.DateTimeField(blank=True, null=True)),
                ("quote_title", models.CharField(max_length=255, null=True)),
                ("quote_date", models.DateField(null=True)),
                ("subtotal", models.DecimalField(decimal_places=2, max_digits=10)),
                ("discount_type", models.CharField(max_length=50, null=True)),
                ("discount", models.DecimalField(decimal_places=2, max_digits=10)),
                (
                    "discount_percent",
                    models.IntegerField(blank=True, default=0, null=True),
                ),
                ("gst", models.DecimalField(decimal_places=2, max_digits=10)),
                ("gst_percent", models.IntegerField(blank=True, default=0, null=True)),
                ("email_to_financial_broker", models.BooleanField(default=False)),
                (
                    "total",
                    models.DecimalField(decimal_places=2, max_digits=10, null=True),
                ),
                (
                    "manual_quote_pdf",
                    models.FileField(
                        blank=True, null=True, upload_to="manual_quote_pdfs/"
                    ),
                ),
                (
                    "manual_quote_doc",
                    models.FileField(
                        blank=True, null=True, upload_to="manual_quote_docs/"
                    ),
                ),
                (
                    "pdf_file",
                    models.FileField(blank=True, null=True, upload_to="quote_pdfs/"),
                ),
                (
                    "doc_file",
                    models.FileField(blank=True, null=True, upload_to="quote_docs/"),
                ),
                ("is_active", models.BooleanField(default=True)),
                (
                    "status",
                    models.PositiveSmallIntegerField(
                        choices=[
                            (0, "Created"),
                            (1, "Sented"),
                            (2, "Accepted"),
                            (3, "Converted Invoice"),
                            (4, "Rejected"),
                        ],
                        default=0,
                    ),
                ),
                ("version_number", models.PositiveIntegerField(default=0)),
            ],
            options={
                "abstract": False,
            },
        ),
        migrations.CreateModel(
            name="Signature",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("created_at", models.DateTimeField(auto_now_add=True, null=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
                ("deleted_at", models.DateTimeField(blank=True, null=True)),
                ("email", models.EmailField(max_length=254)),
                ("signature_text", models.CharField(max_length=255)),
                ("signature_image", models.ImageField(upload_to="signatures/")),
                ("terms1_accepted", models.BooleanField(default=False)),
            ],
            options={
                "abstract": False,
            },
        ),
        migrations.CreateModel(
            name="Technician_Assigned_Order_Item",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("created_at", models.DateTimeField(auto_now_add=True, null=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
                ("deleted_at", models.DateTimeField(blank=True, null=True)),
                ("installation_date", models.DateField(blank=True, null=True)),
                ("installation_end_date", models.DateField(blank=True, null=True)),
                ("installation_time", models.TimeField(null=True)),
                (
                    "service_request_date",
                    models.DateField(auto_now_add=True, null=True),
                ),
                (
                    "service_request_time",
                    models.TimeField(auto_now_add=True, null=True),
                ),
                ("booking_date", models.DateField(auto_now_add=True)),
                ("comment", models.CharField(max_length=50, null=True)),
                (
                    "job_type",
                    models.PositiveSmallIntegerField(
                        choices=[(1, "Installation"), (2, "Service")], default=1
                    ),
                ),
                (
                    "working_status",
                    models.PositiveSmallIntegerField(
                        choices=[
                            (0, "Installation Requested"),
                            (1, "Installation Requested"),
                            (2, "In Progress"),
                            (3, "Installed"),
                            (4, "Service Requested"),
                            (5, "Service Requested"),
                            (6, "In Progress"),
                            (7, "Service Completed"),
                            (8, "Parts Needed"),
                            (9, "Parts Received"),
                        ],
                        default=0,
                        null=True,
                    ),
                ),
                ("view_by_technician", models.BooleanField(default=False)),
                ("last_mail_sent_at", models.DateTimeField(blank=True, null=True)),
                (
                    "job_status",
                    models.PositiveSmallIntegerField(
                        choices=[
                            (0, "Not Started"),
                            (1, "In Progress"),
                            (2, "Parts Needed"),
                            (3, "Parts Arrived"),
                            (4, "Completed"),
                        ],
                        default=0,
                        null=True,
                    ),
                ),
                (
                    "pdf_file",
                    models.FileField(
                        blank=True, null=True, upload_to="checklist_pdfs/"
                    ),
                ),
                ("job_completed", models.BooleanField(default=False)),
                ("is_signature", models.BooleanField(default=False)),
                ("start_time_timer", models.DateTimeField(null=True)),
                ("stop_time_timer", models.DateTimeField(null=True)),
                ("total_time_timer", models.DurationField(blank=True, null=True)),
                ("job_complete_datetime", models.DateTimeField(null=True)),
                ("customer_signature_required", models.BooleanField(default=False)),
                (
                    "start_stop_job",
                    models.PositiveSmallIntegerField(default=0, null=True),
                ),
                (
                    "created_by",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="%(class)s_created",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "deleted_by",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="%(class)s_deleted",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "order_item",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="order_item",
                        to="quotation.order_item",
                    ),
                ),
                (
                    "secondary_technician",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="seconday_technicians",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            options={
                "abstract": False,
            },
        ),
        migrations.CreateModel(
            name="WorkOrder",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("installation_start_date", models.DateField(blank=True, null=True)),
                ("size", models.CharField(blank=True, max_length=50, null=True)),
                ("note", models.TextField(blank=True, null=True)),
                (
                    "business_hours_from_time",
                    models.CharField(blank=True, max_length=20, null=True),
                ),
                (
                    "business_hours_to_time",
                    models.CharField(blank=True, max_length=20, null=True),
                ),
                ("forklift_available", models.BooleanField(default=False)),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
                (
                    "address_type",
                    models.CharField(blank=True, max_length=50, null=True),
                ),
                ("suburb", models.TextField(blank=True, null=True)),
                ("street", models.TextField(blank=True, null=True)),
                ("postcode", models.CharField(blank=True, max_length=50, null=True)),
                ("state", models.TextField(blank=True, null=True)),
                ("country", models.TextField(blank=True, null=True)),
                (
                    "order_item",
                    models.OneToOneField(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="work_order",
                        to="quotation.order_item",
                    ),
                ),
                (
                    "technician",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
        ),
        migrations.CreateModel(
            name="Technician_Comment",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("created_at", models.DateTimeField(auto_now_add=True, null=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
                ("deleted_at", models.DateTimeField(blank=True, null=True)),
                ("comment", models.CharField(max_length=50, null=True)),
                ("installation_date", models.DateField(blank=True, null=True)),
                ("installation_time", models.TimeField(null=True)),
                (
                    "created_by",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="%(class)s_created",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "deleted_by",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="%(class)s_deleted",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "technician_assigend_order_item",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="techniciancomment_set",
                        to="quotation.technician_assigned_order_item",
                    ),
                ),
                (
                    "updated_by",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="%(class)s_updated",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            options={
                "abstract": False,
            },
        ),
    ]
