# Generated by Django 4.2.14 on 2025-02-18 12:47

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


class Migration(migrations.Migration):

    dependencies = [
        ("groups", "0004_group_code_group_combination_method_and_more"),
        ("organizations", "0003_organization_endpoint"),
        ("encounters", "0008_alter_encounterlocation_location"),
        ("episodeofcare", "0003_episodeofcarereasonvaluereference_procedure_and_more"),
        ("appointments", "0008_appointment_based_on_appointment_reason_and_more"),
        ("appointmentresponses", "0001_initial"),
        ("base", "0012_alter_repeat_duration_unit_alter_repeat_period_unit"),
        (
            "documentreferences",
            "0002_documentreferencebasedonreference_nutrition_order",
        ),
    ]

    operations = [
        migrations.RenameField(
            model_name="documentreference",
            old_name="base_on",
            new_name="based_on",
        ),
        migrations.RemoveField(
            model_name="documentreferenceattesterpartyreference",
            name="care_team",
        ),
        migrations.AddField(
            model_name="documentreferenceattesterpartyreference",
            name="group",
            field=models.ForeignKey(
                null=True,
                on_delete=django.db.models.deletion.DO_NOTHING,
                related_name="document_reference_attester_party_reference_group",
                to="groups.group",
            ),
        ),
        migrations.AddField(
            model_name="documentreferenceattesterpartyreference",
            name="organization",
            field=models.ForeignKey(
                null=True,
                on_delete=django.db.models.deletion.DO_NOTHING,
                related_name="document_reference_attester_party_reference_organization",
                to="organizations.organization",
            ),
        ),
        migrations.AddField(
            model_name="documentreferenceauthorreference",
            name="group",
            field=models.ForeignKey(
                null=True,
                on_delete=django.db.models.deletion.DO_NOTHING,
                related_name="document_reference_author_reference_group",
                to="groups.group",
            ),
        ),
        migrations.AddField(
            model_name="documentreferencebasedonreference",
            name="appointment_response",
            field=models.ForeignKey(
                null=True,
                on_delete=django.db.models.deletion.DO_NOTHING,
                related_name="document_reference_based_on_reference_appointment_response",
                to="appointmentresponses.appointmentresponse",
            ),
        ),
        migrations.AlterField(
            model_name="documentreference",
            name="event",
            field=models.ManyToManyField(
                blank=True,
                related_name="document_reference_events",
                to="base.codeablereference",
            ),
        ),
        migrations.CreateModel(
            name="DocumentReferenceContextReference",
            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)),
                (
                    "appointment",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="document_reference_context_reference_appointment",
                        to="appointments.appointment",
                    ),
                ),
                (
                    "encounter",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="document_reference_context_reference_encounter",
                        to="encounters.encounter",
                    ),
                ),
                (
                    "episode_of_care",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="document_reference_context_reference_episode_of_care",
                        to="episodeofcare.episodeofcare",
                    ),
                ),
                (
                    "identifier",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="document_reference_context_references_identifier",
                        to="base.identifier",
                    ),
                ),
            ],
            options={
                "abstract": False,
            },
        ),
        migrations.AlterField(
            model_name="documentreference",
            name="context",
            field=models.ManyToManyField(
                blank=True,
                related_name="document_reference_contexts",
                to="documentreferences.documentreferencecontextreference",
            ),
        ),
    ]
