# Generated by Django 4.2.14 on 2025-01-07 21:23

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


class Migration(migrations.Migration):

    dependencies = [
        ('base', '0003_communication'),
        ('patients', '0003_alter_patient_communication_and_more'),
        ('healthcareservices', '0002_rename_healthcareservice_healthcareservicecodeablereference_healthcare_service_and_more'),
        ('locations', '0001_initial'),
        ('organizations', '0001_initial'),
        ('practitioners', '0005_alter_practitioner_birth_date'),
    ]

    operations = [
        migrations.CreateModel(
            name='PractitionerReference',
            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.CASCADE, related_name='practitioner_reference_identifier', to='base.identifier')),
                ('practitioner', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='practitioner_reference_practitioner', to='practitioners.practitioner')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.RenameModel(
            old_name='GeneralPractitionerReference',
            new_name='PractitionerOrganizationPractitionerRoleReference',
        ),
        migrations.RemoveField(
            model_name='practitionerrolecontact',
            name='organization',
        ),
        migrations.RemoveField(
            model_name='practitionerrolecontact',
            name='practitioner_role',
        ),
        migrations.RemoveField(
            model_name='practitionerrolecontacttelecom',
            name='practitioner_role_contact',
        ),
        migrations.RemoveField(
            model_name='practitionerrole',
            name='health_care_service',
        ),
        migrations.AddField(
            model_name='practitionerrole',
            name='communication',
            field=models.ManyToManyField(blank=True, related_name='practitioner_role_communication', to='base.codeableconcept'),
        ),
        migrations.AddField(
            model_name='practitionerrole',
            name='contact',
            field=models.ManyToManyField(blank=True, related_name='practitioner_role_contact', to='base.extendedcontactdetail'),
        ),
        migrations.AddField(
            model_name='practitionerrole',
            name='display',
            field=models.TextField(null=True),
        ),
        migrations.AddField(
            model_name='practitionerrole',
            name='endpoint',
            field=models.ManyToManyField(blank=True, related_name='practitioner_role_endpoint', to='base.endpointreference'),
        ),
        migrations.AddField(
            model_name='practitionerrole',
            name='healthcare_service',
            field=models.ManyToManyField(related_name='practitioner_role_healthcareservice', to='healthcareservices.healthcareservicereference'),
        ),
        migrations.AddField(
            model_name='practitionerrole',
            name='identifier',
            field=models.ManyToManyField(blank=True, related_name='practitioner_role_identifier', to='base.identifier'),
        ),
        migrations.AddField(
            model_name='practitionerrole',
            name='network',
            field=models.ManyToManyField(blank=True, related_name='practitioner_role_network', to='base.organizationreference'),
        ),
        migrations.RemoveField(
            model_name='practitionerrole',
            name='characteristic',
        ),
        migrations.AlterField(
            model_name='practitionerrole',
            name='code',
            field=models.ManyToManyField(blank=True, related_name='practitioner_role_code', to='base.codeableconcept'),
        ),
        migrations.AlterField(
            model_name='practitionerrole',
            name='location',
            field=models.ManyToManyField(blank=True, related_name='practitioner_role_location', to='locations.locationreference'),
        ),
        migrations.AlterField(
            model_name='practitionerrole',
            name='organization',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='practitioner_role_organization', to='base.organizationreference'),
        ),
        migrations.AlterField(
            model_name='practitionerrole',
            name='period',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='base.period'),
        ),
        migrations.AlterField(
            model_name='practitionerrole',
            name='specialty',
            field=models.ManyToManyField(blank=True, related_name='practitioner_role_specialty', to='base.codeableconcept'),
        ),
        migrations.DeleteModel(
            name='PractitionerRoleCommunication',
        ),
        migrations.DeleteModel(
            name='PractitionerRoleContact',
        ),
        migrations.DeleteModel(
            name='PractitionerRoleContactTelecom',
        ),
        migrations.AddField(
            model_name='practitionerrole',
            name='characteristic',
            field=models.ManyToManyField(blank=True, related_name='practitioner_role_characteristic', to='base.codeableconcept'),
        ),
        migrations.AlterField(
            model_name='practitionerrole',
            name='practitioner',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='practitioner_role_practitioner', to='practitioners.practitionerreference'),
        ),
    ]
