# Generated by Django 5.2 on 2025-04-27 15:57

import django.contrib.postgres.fields
import django.db.models.deletion
from django.db import migrations, models


class Migration(migrations.Migration):

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

    operations = [
        migrations.AddField(
            model_name='provenance',
            name='activity',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='provenance_activity', to='base.codeableconcept'),
        ),
        migrations.AddField(
            model_name='provenance',
            name='authorization',
            field=models.ManyToManyField(blank=True, related_name='provenance_authorization', to='base.codeablereference'),
        ),
        migrations.AddField(
            model_name='provenance',
            name='based_on',
            field=models.ManyToManyField(blank=True, related_name='provenance_based_on', to='base.reference'),
        ),
        migrations.AddField(
            model_name='provenance',
            name='encounter',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='provenance_encounter', to='encounters.encounterreference'),
        ),
        migrations.AddField(
            model_name='provenance',
            name='location',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='provenance_location', to='locations.locationreference'),
        ),
        migrations.AddField(
            model_name='provenance',
            name='occurred_date_time',
            field=models.DateTimeField(null=True),
        ),
        migrations.AddField(
            model_name='provenance',
            name='occurred_period',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='provinance_occurred_period', to='base.period'),
        ),
        migrations.AddField(
            model_name='provenance',
            name='patient',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='provenance_patient', to='patients.patientreference'),
        ),
        migrations.AddField(
            model_name='provenance',
            name='policy',
            field=django.contrib.postgres.fields.ArrayField(base_field=models.URLField(), null=True, size=None),
        ),
        migrations.AddField(
            model_name='provenance',
            name='recorded',
            field=models.DateTimeField(null=True),
        ),
        migrations.AddField(
            model_name='provenance',
            name='signature',
            field=models.ManyToManyField(blank=True, related_name='provenance_signature', to='base.signature'),
        ),
        migrations.AddField(
            model_name='provenance',
            name='why',
            field=models.TextField(null=True),
        ),
        migrations.CreateModel(
            name='ProvenanceAgent',
            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)),
                ('role', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='provenance_agent_role', to='base.codeableconcept')),
                ('type', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='provenance_agent_type', to='base.codeableconcept')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.AddField(
            model_name='provenance',
            name='agent',
            field=models.ManyToManyField(blank=True, related_name='provenance_agent', to='provenances.provenanceagent'),
        ),
        migrations.CreateModel(
            name='ProvenanceAgentOnBehalfOf',
            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='provenance_agent_on_behalf_of_care_team', to='careteams.careteamreference')),
                ('group', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='provenance_agent_on_behalf_of_group', to='groups.groupreference')),
                ('healthcare_service', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='provenance_agent_on_behalf_of_healthcare_service', to='healthcareservices.healthcareservicereference')),
                ('identifier', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='provenance_agent_on_behalf_of_identifier', to='base.identifier')),
                ('organization', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='provenance_agent_on_behalf_of_organization', to='base.organizationreference')),
                ('patient', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='provenance_agent_on_behalf_of_patient', to='patients.patientreference')),
                ('practitioner', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='provenance_agent_on_behalf_of_practitioner', to='practitioners.practitionerreference')),
                ('practitioner_role', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='provenance_agent_on_behalf_of_practitioner_role', to='practitionerroles.practitionerrolereference')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.AddField(
            model_name='provenanceagent',
            name='on_behalf_of',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='provenance_agent_on_behalf_of', to='provenances.provenanceagentonbehalfof'),
        ),
        migrations.CreateModel(
            name='ProvenanceAgentWhoReference',
            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='provenance_agent_who_reference_care_team', to='careteams.careteamreference')),
                ('device', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='provenance_agent_who_reference_device', to='devices.devicereference')),
                ('group', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='provenance_agent_who_reference_group', to='groups.groupreference')),
                ('healthcare_service', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='provenance_agent_who_reference_healthcare_service', to='healthcareservices.healthcareservicereference')),
                ('identifier', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='provenance_agent_who_reference_identifier', to='base.identifier')),
                ('organization', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='provenance_agent_who_reference_organization', to='base.organizationreference')),
                ('practitioner', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='provenance_agent_who_reference_practitioner', to='practitioners.practitionerreference')),
                ('practitioner_role', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='provenance_agent_who_reference_practitioner_role', to='practitionerroles.practitionerrolereference')),
                ('related_person', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='provenance_agent_who_reference_related_person', to='relatedpersons.relatedpersonreference')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.AddField(
            model_name='provenanceagent',
            name='who',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='provenance_agent_who', to='provenances.provenanceagentwhoreference'),
        ),
        migrations.CreateModel(
            name='ProvenanceEntry',
            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)),
                ('role', models.CharField(choices=[('revision', 'Revision'), ('quotation', 'Quotation'), ('source', 'Source'), ('instantiates', 'Instantiates'), ('removal', 'Removal')], default='revision', max_length=255, null=True)),
                ('agent', models.ManyToManyField(blank=True, related_name='provenance_entry_agent', to='provenances.provenanceagent')),
                ('what', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='provenance_entry_what', to='base.reference')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.AddField(
            model_name='provenance',
            name='entity',
            field=models.ManyToManyField(blank=True, related_name='provenance_entity', to='provenances.provenanceentry'),
        ),
    ]
