# Generated by Django 5.2.1 on 2025-11-04 17:07

import django.contrib.auth.models
import django.db.models.deletion
import django.utils.timezone
import django_countries.fields
import functools
import ichec_django_core.models.utils
from django.conf import settings
from django.db import migrations, models


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ("auth", "0012_alter_user_first_name_max_length"),
    ]

    operations = [
        migrations.CreateModel(
            name="Address",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "created_at",
                    models.DateTimeField(
                        default=django.utils.timezone.now, editable=False
                    ),
                ),
                ("updated_at", models.DateTimeField(default=django.utils.timezone.now)),
                ("line1", models.CharField(max_length=200)),
                ("line2", models.CharField(max_length=200, null=True)),
                ("line3", models.CharField(max_length=200, null=True)),
                ("city", models.CharField(max_length=200, null=True)),
                ("region", models.CharField(max_length=200)),
                ("postcode", models.CharField(max_length=200, null=True)),
                ("country", django_countries.fields.CountryField(max_length=2)),
            ],
            options={
                "verbose_name_plural": "Addresses",
            },
        ),
        migrations.CreateModel(
            name="Form",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "created_at",
                    models.DateTimeField(
                        default=django.utils.timezone.now, editable=False
                    ),
                ),
                ("updated_at", models.DateTimeField(default=django.utils.timezone.now)),
            ],
            options={
                "verbose_name": "Form",
                "verbose_name_plural": "Forms",
            },
        ),
        migrations.CreateModel(
            name="Member",
            fields=[
                (
                    "user_ptr",
                    models.OneToOneField(
                        auto_created=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        parent_link=True,
                        primary_key=True,
                        serialize=False,
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "created_at",
                    models.DateTimeField(
                        default=django.utils.timezone.now, editable=False
                    ),
                ),
                ("updated_at", models.DateTimeField(default=django.utils.timezone.now)),
                ("phone", models.CharField(blank=True, max_length=100, null=True)),
                (
                    "profile",
                    models.ImageField(
                        null=True,
                        upload_to=functools.partial(
                            ichec_django_core.models.utils.content_file_name,
                            *("profile",),
                            **{},
                        ),
                    ),
                ),
                ("profile_thumbnail", models.ImageField(null=True, upload_to="")),
            ],
            options={
                "verbose_name": "Portal Member",
                "verbose_name_plural": "Portal Members",
            },
            bases=("auth.user", models.Model),
            managers=[
                ("objects", django.contrib.auth.models.UserManager()),
            ],
        ),
        migrations.CreateModel(
            name="PopulatedForm",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "created_at",
                    models.DateTimeField(
                        default=django.utils.timezone.now, editable=False
                    ),
                ),
                ("updated_at", models.DateTimeField(default=django.utils.timezone.now)),
            ],
            options={
                "verbose_name": "Populated Form",
                "verbose_name_plural": "Populated Forms",
            },
        ),
        migrations.CreateModel(
            name="FormGroup",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("label", models.CharField(max_length=200, null=True)),
                ("description", models.TextField(null=True)),
                ("order", models.IntegerField(default=0)),
                (
                    "form",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="groups",
                        to="ichec_django_core.form",
                    ),
                ),
            ],
            options={
                "verbose_name": "Form Group",
                "verbose_name_plural": "Form Groups",
            },
        ),
        migrations.CreateModel(
            name="FormField",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("label", models.CharField(max_length=200)),
                ("key", models.CharField(max_length=200)),
                ("required", models.BooleanField(default=False)),
                ("order", models.IntegerField(default=0)),
                (
                    "field_type",
                    models.CharField(
                        choices=[
                            ("BOOLEAN", "Boolean"),
                            ("CHAR", "Short Text"),
                            ("TEXT", "Long Text"),
                            ("RICH_TEXT", "Rich Text"),
                            ("SELECTION", "Selection"),
                            ("INTEGER", "Integer"),
                            ("FILE", "File"),
                        ],
                        default="CHAR",
                        max_length=10,
                    ),
                ),
                ("description", models.TextField(blank=True)),
                (
                    "template",
                    models.FileField(
                        null=True,
                        upload_to=functools.partial(
                            ichec_django_core.models.utils.content_file_name,
                            *("form_field_template",),
                            **{},
                        ),
                    ),
                ),
                ("default", models.CharField(blank=True, max_length=500)),
                ("options", models.CharField(max_length=200, null=True)),
                (
                    "group",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="fields",
                        to="ichec_django_core.formgroup",
                    ),
                ),
            ],
            options={
                "verbose_name": "Form Field",
                "verbose_name_plural": "Form Fields",
            },
        ),
        migrations.CreateModel(
            name="Feedback",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "created_at",
                    models.DateTimeField(
                        default=django.utils.timezone.now, editable=False
                    ),
                ),
                ("updated_at", models.DateTimeField(default=django.utils.timezone.now)),
                ("comments", models.TextField()),
                (
                    "creator",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="ichec_django_core.member",
                    ),
                ),
            ],
            options={
                "abstract": False,
            },
        ),
        migrations.CreateModel(
            name="Organization",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "created_at",
                    models.DateTimeField(
                        default=django.utils.timezone.now, editable=False
                    ),
                ),
                ("updated_at", models.DateTimeField(default=django.utils.timezone.now)),
                ("name", models.CharField(max_length=200)),
                ("acronym", models.CharField(blank=True, max_length=100, null=True)),
                ("description", models.TextField(blank=True)),
                ("website", models.CharField(blank=True, max_length=250, null=True)),
                (
                    "address",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="ichec_django_core.address",
                    ),
                ),
                (
                    "members",
                    models.ManyToManyField(
                        blank=True,
                        related_name="organizations",
                        to="ichec_django_core.member",
                    ),
                ),
            ],
            options={
                "abstract": False,
            },
        ),
        migrations.CreateModel(
            name="FormFieldValue",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("value", models.CharField(max_length=500)),
                (
                    "asset",
                    models.FileField(
                        null=True,
                        upload_to=functools.partial(
                            ichec_django_core.models.utils.content_file_name,
                            *("form_field_value",),
                            **{},
                        ),
                    ),
                ),
                (
                    "field",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="values",
                        to="ichec_django_core.formfield",
                    ),
                ),
                (
                    "form",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="values",
                        to="ichec_django_core.populatedform",
                    ),
                ),
            ],
            options={
                "verbose_name": "Form Field Value",
                "verbose_name_plural": "Form Field Values",
            },
        ),
    ]
