# Generated by Django 5.1.1 on 2024-09-16 17:28

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


class Migration(migrations.Migration):
    dependencies = [
        ("bloomerp", "0008_alter_file_file_alter_kpi_table_and_more"),
        ("contenttypes", "0002_remove_content_type_name"),
    ]

    operations = [
        migrations.CreateModel(
            name="DocumentTemplateFreeVariable",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
                ("name", models.CharField(max_length=100)),
                (
                    "variable_type",
                    models.CharField(
                        choices=[
                            ("date", "Date"),
                            ("boolean", "Boolean"),
                            ("text", "Text"),
                            ("list", "List"),
                            ("integer", "Integer"),
                            ("float", "Decimal"),
                            ("model", "Model"),
                        ],
                        max_length=10,
                    ),
                ),
                ("options", models.TextField(blank=True, null=True)),
                ("required", models.BooleanField(default=False)),
            ],
            options={
                "db_table": "bloomerp_document_template_free_variable",
                "managed": True,
            },
        ),
        migrations.CreateModel(
            name="DocumentTemplateHeader",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
                ("name", models.CharField(max_length=100)),
                ("header", models.ImageField(upload_to="")),
            ],
            options={
                "db_table": "bloomerp_document_template_header",
                "managed": True,
            },
        ),
        migrations.RenameField(
            model_name="file",
            old_name="datetime_created",
            new_name="created_at",
        ),
        migrations.AddField(
            model_name="file",
            name="updated_at",
            field=models.DateTimeField(auto_now=True),
        ),
        migrations.AddField(
            model_name="userkpidashboardviewpreference",
            name="created_at",
            field=models.DateTimeField(
                auto_now_add=True, default=django.utils.timezone.now
            ),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name="userkpidashboardviewpreference",
            name="updated_at",
            field=models.DateTimeField(auto_now=True),
        ),
        migrations.AddField(
            model_name="userkpilistviewpreference",
            name="created_at",
            field=models.DateTimeField(
                auto_now_add=True, default=django.utils.timezone.now
            ),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name="userkpilistviewpreference",
            name="updated_at",
            field=models.DateTimeField(auto_now=True),
        ),
        migrations.AlterField(
            model_name="file",
            name="file",
            field=models.FileField(upload_to=bloomerp.models.File.upload_to),
        ),
        migrations.CreateModel(
            name="DocumentTemplate",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
                ("name", models.CharField(max_length=100)),
                ("template", models.TextField(default="")),
                ("footer", models.TextField(blank=True, null=True)),
                ("standard_document", models.BooleanField(default=False)),
                (
                    "model_variable",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        to="contenttypes.contenttype",
                    ),
                ),
                (
                    "free_variables",
                    models.ManyToManyField(
                        blank=True, to="bloomerp.documenttemplatefreevariable"
                    ),
                ),
                (
                    "template_header",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        to="bloomerp.documenttemplateheader",
                    ),
                ),
            ],
            options={
                "db_table": "bloomerp_document_template",
                "managed": True,
            },
        ),
    ]
