# Generated by Django 5.2.3 on 2025-11-04 17:11

import django.db.models.deletion
import django.utils.timezone
import functools
import ichec_django_core.models.utils
from django.db import migrations, models


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ("ichec_django_core", "0001_initial"),
        (
            "marinerg_facility",
            "0004_equipment_created_at_equipment_updated_at_and_more",
        ),
    ]

    operations = [
        migrations.CreateModel(
            name="AccessApplication",
            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)),
                ("request_start_date", models.DateTimeField(null=True)),
                ("request_end_date", models.DateTimeField(null=True)),
                ("dates_flexible", models.BooleanField(default=False)),
                ("summary", models.FileField(null=True, upload_to="")),
                (
                    "status",
                    models.CharField(
                        choices=[
                            ("CREATED", "Created"),
                            ("SUBMITTED", "Submitted"),
                            ("FACILITY", "Awaiting Facility Review"),
                            ("BOARD", "Awaiting Board Review"),
                            ("ACCEPTED", "Accepted"),
                            ("REJECTED", "Rejected"),
                        ],
                        default="CREATED",
                        max_length=10,
                    ),
                ),
                ("submitted", models.DateTimeField(null=True)),
                (
                    "applicant",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="ichec_django_core.member",
                    ),
                ),
                (
                    "chosen_facility",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="applications",
                        to="marinerg_facility.facility",
                    ),
                ),
                (
                    "facilities",
                    models.ManyToManyField(
                        blank=True,
                        related_name="application_choices",
                        to="marinerg_facility.facility",
                    ),
                ),
                (
                    "form",
                    models.OneToOneField(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="ichec_django_core.populatedform",
                    ),
                ),
            ],
            options={
                "verbose_name": "Access Application",
                "verbose_name_plural": "Access Application",
            },
        ),
        migrations.CreateModel(
            name="AccessApplicationFacilityReview",
            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)),
                (
                    "confirmed_preapplication_discussion",
                    models.BooleanField(default=False),
                ),
                (
                    "confirmed_app_info_in_line_with_discussion",
                    models.BooleanField(default=False),
                ),
                ("supporting_comments", models.TextField(blank=True)),
                ("supporting_documents", models.FileField(null=True, upload_to="")),
                (
                    "application",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="marinerg_test_access.accessapplication",
                    ),
                ),
                (
                    "facility",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="marinerg_facility.facility",
                    ),
                ),
            ],
            options={
                "abstract": False,
            },
        ),
        migrations.CreateModel(
            name="AccessCall",
            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)),
                ("title", models.CharField(max_length=200)),
                ("description", models.TextField()),
                (
                    "status",
                    models.CharField(
                        choices=[
                            ("OPEN", "Open"),
                            ("CLOSED", "Closed"),
                            ("DRAFT", "Draft"),
                        ],
                        default="DRAFT",
                        max_length=10,
                    ),
                ),
                ("closing_date", models.DateTimeField()),
                (
                    "applications_summary",
                    models.FileField(
                        null=True,
                        upload_to=functools.partial(
                            ichec_django_core.models.utils.content_file_name,
                            *("access_call_applications_summary",),
                            **{},
                        ),
                    ),
                ),
                (
                    "board_chair",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="chaired_access_boards",
                        to="ichec_django_core.member",
                    ),
                ),
                (
                    "board_members",
                    models.ManyToManyField(
                        blank=True,
                        related_name="access_boards",
                        to="ichec_django_core.member",
                        verbose_name="list of review board members",
                    ),
                ),
                (
                    "coordinator",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="ichec_django_core.member",
                    ),
                ),
                (
                    "form",
                    models.OneToOneField(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="ichec_django_core.form",
                    ),
                ),
                (
                    "selectable_facilities",
                    models.ManyToManyField(
                        blank=True,
                        related_name="selectable_access_calls",
                        to="marinerg_facility.facility",
                        verbose_name="Selectable Facilities",
                    ),
                ),
            ],
            options={
                "verbose_name": "Access Call",
                "verbose_name_plural": "Access Calls",
            },
        ),
        migrations.CreateModel(
            name="AccessApplicationBoardReview",
            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)),
                (
                    "decision",
                    models.CharField(
                        choices=[("1", "ACCEPT"), ("2", "REJECT")], max_length=10
                    ),
                ),
                ("comments", models.TextField(blank=True)),
                (
                    "creator",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="ichec_django_core.member",
                    ),
                ),
                (
                    "call",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="marinerg_test_access.accesscall",
                    ),
                ),
            ],
            options={
                "abstract": False,
            },
        ),
        migrations.AddField(
            model_name="accessapplication",
            name="call",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                to="marinerg_test_access.accesscall",
            ),
        ),
        migrations.CreateModel(
            name="AccessCallFacilityReview",
            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)),
                (
                    "decision",
                    models.CharField(
                        choices=[("ACCEPT", "Accept"), ("REJECT", "Reject")],
                        max_length=10,
                    ),
                ),
                ("comments", models.TextField(blank=True)),
                (
                    "call",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="marinerg_test_access.accesscall",
                    ),
                ),
                (
                    "facility",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="marinerg_facility.facility",
                    ),
                ),
            ],
            options={
                "verbose_name": "Access Call Facility Review",
                "verbose_name_plural": "Access Call Facility Reviews",
            },
        ),
        migrations.CreateModel(
            name="FacilityTestReport",
            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)),
                ("report", models.FileField(null=True, upload_to="")),
                ("dataset_uri", models.CharField(blank=True, max_length=200)),
                ("confirmed_complies_data_mgmt", models.BooleanField(default=False)),
                (
                    "application",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="marinerg_test_access.accessapplication",
                    ),
                ),
                (
                    "creator",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="ichec_django_core.member",
                    ),
                ),
            ],
            options={
                "abstract": False,
            },
        ),
    ]
