# Generated by Django 5.2 on 2025-04-10 13:09

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('base', '0004_initial'),
        ('patients', '0002_initial'),
        ('practitioners', '0001_initial'),
        ('relatedpersons', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='PersonLink',
            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)),
                ('assurance', models.CharField(choices=[('level1', 'level1'), ('level2', 'level2'), ('level3', 'level3'), ('level4', 'level4')], max_length=255, null=True)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Person',
            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)),
                ('active', models.BooleanField(default=True)),
                ('gender', models.CharField(choices=[('male', 'male'), ('female', 'female'), ('other', 'other'), ('unknown', 'unknown')], max_length=255, null=True)),
                ('birth_date', models.DateField(null=True)),
                ('deceased_boolean', models.BooleanField(null=True)),
                ('deceased_date_time', models.DateTimeField(null=True)),
                ('address', models.ManyToManyField(blank=True, related_name='persons_address', to='base.address')),
                ('communication', models.ManyToManyField(blank=True, related_name='persons_communication', to='base.communication')),
                ('identifier', models.ManyToManyField(blank=True, related_name='persons_identifier', to='base.identifier')),
                ('managing_organization', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='persons_managing_organization', to='base.organizationreference')),
                ('marital_status', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='persons_marital_status', to='base.codeableconcept')),
                ('name', models.ManyToManyField(blank=True, related_name='persons_name', to='base.humanname')),
                ('photo', models.ManyToManyField(blank=True, related_name='persons_photo', to='base.attachment')),
                ('telecom', models.ManyToManyField(blank=True, related_name='persons_telecom', to='base.contactpoint')),
                ('link', models.ManyToManyField(blank=True, related_name='persons_link', to='persons.personlink')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='PersonLinkTargetReference',
            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='person_link_target_reference_identifier', to='base.identifier')),
                ('patient', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='person_link_target_reference_patient', to='patients.patient')),
                ('person', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='person_link_target_reference_person', to='persons.person')),
                ('practitioner', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='person_link_target_reference_practitioner', to='practitioners.practitioner')),
                ('related_person', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='person_link_target_reference_related_person', to='relatedpersons.relatedperson')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.AddField(
            model_name='personlink',
            name='target',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='person_link_target', to='persons.personlinktargetreference'),
        ),
        migrations.CreateModel(
            name='PersonReference',
            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='person_reference_identifier', to='base.identifier')),
                ('person', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='person_reference_person', to='persons.person')),
            ],
            options={
                'abstract': False,
            },
        ),
    ]
