# Generated by Django 4.2.14 on 2025-02-05 11:59

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


class Migration(migrations.Migration):

    dependencies = [
        ('relatedpersons', '0002_relatedperson_communication_relatedperson_gender'),
        ('careteams', '0004_remove_careteamparticipant_role_and_more'),
        ('base', '0010_expression_relativetime'),
        ('practitioners', '0010_practitionerrole_endpoint'),
        ('organizations', '0003_organization_endpoint'),
        ('devices', '0007_alter_device_status_and_more'),
        ('patients', '0007_patientorganizationreference'),
        ('careplans', '0003_remove_careplan_contributor_and_more'),
    ]

    operations = [
        migrations.CreateModel(
            name='CarePlanCustodianReference',
            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.SET_NULL, to='careteams.careteam')),
                ('device', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='devices.device')),
                ('identifier', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='custodian_contributor_reference_identifier', to='base.identifier')),
                ('organization', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='organizations.organization')),
                ('patient', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='patients.patient')),
                ('practitioner', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='practitioners.practitioner')),
                ('practitioner_role', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='practitioners.practitionerrole')),
                ('related_person', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='relatedpersons.relatedperson')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='CarePlanContributorReference',
            fields=[
                ('careplancustodianreference_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='careplans.careplancustodianreference')),
            ],
            options={
                'abstract': False,
            },
            bases=('careplans.careplancustodianreference',),
        ),
        migrations.AddField(
            model_name='careplan',
            name='custodian',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='care_plan_custodian', to='careplans.careplancustodianreference'),
        ),
        migrations.AddField(
            model_name='careplan',
            name='contributor',
            field=models.ManyToManyField(blank=True, related_name='care_plan_contributor', to='careplans.careplancontributorreference'),
        ),
    ]
