# Generated by Django 5.2 on 2025-04-23 12:46

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('base', '0004_initial'),
        ('careteams', '0003_initial'),
        ('coverages', '0002_initial'),
        ('devices', '0001_initial'),
        ('encounters', '0003_initial'),
        ('groups', '0001_initial'),
        ('healthcareservices', '0001_initial'),
        ('locations', '0001_initial'),
        ('organizations', '0001_initial'),
        ('patients', '0001_initial'),
        ('practitionerroles', '0001_initial'),
        ('practitioners', '0001_initial'),
        ('provenances', '0001_initial'),
        ('relatedpersons', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='TaskInput',
            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)),
                ('value', models.CharField(max_length=255, null=True)),
                ('type', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, related_name='task_input_type', to='base.codeableconcept')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='TaskOutput',
            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)),
                ('value', models.CharField(max_length=255, null=True)),
                ('type', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, related_name='task_output_type', to='base.codeableconcept')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='TaskOwnerReference',
            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)),
                ('reference', models.CharField(max_length=255, null=True)),
                ('type', models.CharField(max_length=255, null=True)),
                ('display', models.CharField(max_length=255, null=True)),
                ('care_team', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='task_owner_practitioner_care_team', to='careteams.careteam')),
                ('identifier', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='task_owner_reference_identifier', to='base.identifier')),
                ('organization', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='task_owner_reference_organization', to='organizations.organization')),
                ('patient', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='task_owner_reference_patient', to='patients.patient')),
                ('practitioner', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='task_owner_reference_practitioner', to='practitioners.practitioner')),
                ('practitioner_role', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='task_owner_reference_practitioner_role', to='practitionerroles.practitionerrole')),
                ('related_person', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='task_owner_reference_related_person', to='relatedpersons.relatedperson')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='TaskPerformer',
            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)),
                ('function', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='task_performer_model', to='base.codeableconcept')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Task',
            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)),
                ('instantiate_uri', models.URLField(null=True)),
                ('status', models.CharField(choices=[('draft', 'Draft'), ('requested', 'Requested'), ('received', 'Received'), ('accepted', 'Accepted'), ('rejected', 'Rejected'), ('ready', 'Ready'), ('cancelled', 'Cancelled'), ('in-progress', 'In Progress'), ('on-hold', 'On Hold'), ('failed', 'Failed'), ('completed', 'Completed'), ('entered-in-error', 'Entered in Error')], max_length=255, null=True)),
                ('intent', models.CharField(choices=[('unknown', 'unknown'), ('proposal', 'proposal'), ('plan', 'plan'), ('order', 'order'), ('original-order', 'original-order'), ('reflex-order', 'reflex-order'), ('filler-order', 'filler-order'), ('instance-order', 'instance-order'), ('option', 'option')], max_length=255, null=True)),
                ('priority', models.CharField(choices=[('routine', 'routine'), ('urgent', 'urgent'), ('asap', 'asap'), ('stat', 'stat')], max_length=255, null=True)),
                ('do_not_perform', models.BooleanField(default=False)),
                ('description', models.TextField(null=True)),
                ('authored_on', models.DateTimeField(null=True)),
                ('last_modified', models.DateTimeField(null=True)),
                ('based_on', models.ManyToManyField(blank=True, related_name='task_based_on', to='base.reference')),
                ('business_status', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='task_business_status', to='base.codeableconcept')),
                ('code', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='task_code', to='base.codeableconcept')),
                ('encounter', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='task_encounter', to='encounters.encounterreference')),
                ('execution_period', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='task_execution_period', to='base.period')),
                ('focus', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='task_focus', to='base.reference')),
                ('for_value', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='task_for', to='base.reference')),
                ('group_identifier', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='task_group_identifier', to='base.identifier')),
                ('identifier', models.ManyToManyField(related_name='task_identifier', to='base.identifier')),
                ('insurance', models.ManyToManyField(blank=True, related_name='task_insurance', to='coverages.coverageclaimresponsereference')),
                ('location', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='task_location', to='locations.locationreference')),
                ('note', models.ManyToManyField(blank=True, related_name='task_note', to='base.annotation')),
                ('reason', models.ManyToManyField(blank=True, related_name='task_reason', to='base.codeablereference')),
                ('relevant_history', models.ManyToManyField(blank=True, related_name='task_relevant_history', to='provenances.provenancereference')),
                ('requested_period', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='task_requested_period', to='base.period')),
                ('status_reason', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='task_status_reason', to='base.codeablereference')),
                ('input', models.ManyToManyField(blank=True, related_name='task_input', to='tasks.taskinput')),
                ('output', models.ManyToManyField(blank=True, related_name='task_output', to='tasks.taskoutput')),
                ('owner', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='task_owner', to='tasks.taskownerreference')),
                ('performer', models.ManyToManyField(blank=True, related_name='task_performer', to='tasks.taskperformer')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='TaskPerformerActorReference',
            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)),
                ('reference', models.CharField(max_length=255, null=True)),
                ('type', models.CharField(max_length=255, null=True)),
                ('display', models.CharField(max_length=255, null=True)),
                ('care_team', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='task_performer_actor_reference_practitioner_care_team', to='careteams.careteam')),
                ('device', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='task_performer_actor_reference_device', to='devices.device')),
                ('identifier', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='task_performer_actor_reference_identifier', to='base.identifier')),
                ('organization', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='task_performer_actor_reference_organization', to='organizations.organization')),
                ('patient', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='task_performer_actor_reference_patient', to='patients.patient')),
                ('practitioner', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='task_performer_actor_reference_practitioner', to='practitioners.practitioner')),
                ('practitioner_role', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='task_performer_actor_reference_practitioner_role', to='practitionerroles.practitionerrole')),
                ('related_person', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='task_performer_actor_reference_related_person', to='relatedpersons.relatedperson')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.AddField(
            model_name='taskperformer',
            name='actor',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='task_performer_actor', to='tasks.taskperformeractorreference'),
        ),
        migrations.CreateModel(
            name='TaskReference',
            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)),
                ('reference', models.CharField(max_length=255, null=True)),
                ('type', models.CharField(max_length=255, null=True)),
                ('display', models.CharField(max_length=255, null=True)),
                ('identifier', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='task_reference_identifier', to='base.identifier')),
                ('task', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='task_reference_task', to='tasks.task')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.AddField(
            model_name='task',
            name='part_of',
            field=models.ManyToManyField(blank=True, related_name='task_part_of', to='tasks.taskreference'),
        ),
        migrations.CreateModel(
            name='TaskRequestedPerformerCodeableReference',
            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)),
                ('concept', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='task_requested_performer_codeable_reference_concept', to='base.codeableconcept')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.AddField(
            model_name='task',
            name='requested_performer',
            field=models.ManyToManyField(blank=True, related_name='task_requested_performer', to='tasks.taskrequestedperformercodeablereference'),
        ),
        migrations.CreateModel(
            name='TaskRequestedPerformerReference',
            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)),
                ('reference', models.CharField(max_length=255, null=True)),
                ('type', models.CharField(max_length=255, null=True)),
                ('display', models.CharField(max_length=255, null=True)),
                ('care_team', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='task_requested_practitioner_care_team', to='careteams.careteam')),
                ('device', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='task_requested_performer_reference_device', to='devices.device')),
                ('healthcare_service', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='task_requested_practitioner_healthcare_service', to='healthcareservices.healthcareservice')),
                ('identifier', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='task_requested_performer_reference_identifier', to='base.identifier')),
                ('organization', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='task_requested_performer_reference_organization', to='organizations.organization')),
                ('patient', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='task_requested_performer_reference_patient', to='patients.patient')),
                ('practitioner', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='task_requested_performer_reference_practitioner', to='practitioners.practitioner')),
                ('practitioner_role', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='task_requested_performer_reference_practitioner_role', to='practitionerroles.practitionerrole')),
                ('related_person', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='task_requested_performer_reference_related_person', to='relatedpersons.relatedperson')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.AddField(
            model_name='taskrequestedperformercodeablereference',
            name='reference',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='task_requested_performer_codeable_reference_reference', to='tasks.taskrequestedperformerreference'),
        ),
        migrations.CreateModel(
            name='TaskRequesterReference',
            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)),
                ('reference', models.CharField(max_length=255, null=True)),
                ('type', models.CharField(max_length=255, null=True)),
                ('display', models.CharField(max_length=255, null=True)),
                ('device', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='task_requester_reference_device', to='devices.device')),
                ('identifier', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='task_requester_reference_identifier', to='base.identifier')),
                ('organization', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='task_requester_reference_organization', to='organizations.organization')),
                ('patient', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='task_requester_reference_patient', to='patients.patient')),
                ('practitioner', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='task_requester_reference_practitioner', to='practitioners.practitioner')),
                ('practitioner_role', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='task_requester_reference_practitioner_role', to='practitionerroles.practitionerrole')),
                ('related_person', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='task_requester_reference_related_person', to='relatedpersons.relatedperson')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.AddField(
            model_name='task',
            name='requester',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='task_requester', to='tasks.taskrequesterreference'),
        ),
        migrations.CreateModel(
            name='TaskRestriction',
            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)),
                ('repetition', models.PositiveIntegerField(null=True)),
                ('period', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='task_restriction_period', to='base.period')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.AddField(
            model_name='task',
            name='restriction',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='task_restriction', to='tasks.taskrestriction'),
        ),
        migrations.CreateModel(
            name='TaskRestrictionRecipientReference',
            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)),
                ('reference', models.CharField(max_length=255, null=True)),
                ('type', models.CharField(max_length=255, null=True)),
                ('display', models.CharField(max_length=255, null=True)),
                ('group', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='task_requested_practitioner_care_team', to='groups.group')),
                ('identifier', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='task_restriction_recipient_reference', to='base.identifier')),
                ('organization', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='task_restriction_recipient_reference_organization', to='organizations.organization')),
                ('patient', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='task_restriction_recipient_reference_patient', to='patients.patient')),
                ('practitioner', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='task_restriction_recipient_reference_practitioner', to='practitioners.practitioner')),
                ('practitioner_role', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='task_restriction_recipient_reference_practitioner_role', to='practitionerroles.practitionerrole')),
                ('related_person', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='task_restriction_recipient_reference_related_person', to='relatedpersons.relatedperson')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.AddField(
            model_name='taskrestriction',
            name='recipient',
            field=models.ManyToManyField(blank=True, related_name='ask_restrictions_recipient', to='tasks.taskrestrictionrecipientreference'),
        ),
    ]
