# Generated by Django 4.2.14 on 2025-02-14 11:54

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('organizations', '0003_organization_endpoint'),
        ('relatedpersons', '0002_relatedperson_communication_relatedperson_gender'),
        ('base', '0012_alter_repeat_duration_unit_alter_repeat_period_unit'),
        ('patients', '0007_patientorganizationreference'),
    ]

    operations = [
        migrations.CreateModel(
            name='CoveragePolicyHolderReference',
            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='policy_holder_reference_identifier', to='base.identifier')),
                ('organization', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='policy_holder_reference_organization', to='organizations.organization')),
                ('patient', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='policy_holder_reference_patient', to='patients.patient')),
                ('related_person', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='policy_holder_reference_related_person', to='relatedpersons.relatedperson')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='CoveragePaymentByPartyReference',
            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='coverage_by_reference_identifier', to='base.identifier')),
                ('organization', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='coverage_by_reference_organization', to='organizations.organization')),
                ('patient', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='coverage_by_reference_patient', to='patients.patient')),
                ('related_person', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='coverage_by_reference_related_person', to='relatedpersons.relatedperson')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='CoveragePaymentBy',
            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)),
                ('responsibility', models.CharField(max_length=255, null=True)),
                ('party', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='coverage_payment_by_party', to='coverages.coveragepaymentbypartyreference')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='CoverageCostToBeneficiaryException',
            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)),
                ('period', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='coverage_cost_to_beneficiary_exception_period', to='base.period')),
                ('type', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='coverage_cost_to_beneficiary_exception_type', to='base.codeableconcept')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='CoverageCostToBeneficiary',
            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)),
                ('category', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='coverage_cost_to_beneficiary_category', to='base.codeableconcept')),
                ('network', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='coverage_cost_to_beneficiary_network', to='base.codeableconcept')),
                ('term', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='coverage_cost_to_beneficiary_term', to='base.codeableconcept')),
                ('type', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='coverage_cost_to_beneficiary_type', to='base.codeableconcept')),
                ('unit', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='coverage_cost_to_beneficiary_unit', to='base.codeableconcept')),
                ('value_quantity', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='coverage_cost_to_beneficiary_value_quantity', to='base.simplequantity')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='CoverageClass',
            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)),
                ('name', models.CharField(max_length=255, null=True)),
                ('type', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='coverage_class_type', to='base.codeableconcept')),
                ('value', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='coverage_class_value', to='base.identifier')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Coverage',
            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)),
                ('status', models.CharField(choices=[('active', 'Active'), ('cancelled', 'Cancelled'), ('draft', 'Draft'), ('entered-in-error', 'Entered in Error')], max_length=255)),
                ('kind', models.CharField(choices=[('insurance', 'Insurance'), ('self-pay', 'Self Pay'), ('other', 'Other')], max_length=255)),
                ('dependent', models.CharField(max_length=255, null=True)),
                ('order', models.IntegerField(null=True)),
                ('network', models.CharField(max_length=255, null=True)),
                ('subrogation', models.BooleanField(default=True)),
                ('beneficiary', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='coverage_beneficiary', to='patients.patientreference')),
                ('cost_to_beneficiary', models.ManyToManyField(blank=True, related_name='coverage_cost_to_beneficiary', to='coverages.coveragecosttobeneficiary')),
                ('identifier', models.ManyToManyField(blank=True, related_name='coverage_identifier', to='base.identifier')),
                ('insurer', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='coverage_insurer', to='base.organizationreference')),
                ('klass', models.ManyToManyField(blank=True, related_name='coverage_class', to='coverages.coverageclass')),
                ('payment_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='coverage_payment_by', to='coverages.coveragepaymentby')),
                ('period', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='coverage_period', to='base.period')),
                ('policy_holder', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='coverage_policy_holder', to='coverages.coveragepolicyholderreference')),
                ('relationship', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='coverage_relationship', to='base.codeableconcept')),
                ('subscriber', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='coverage_subscriber', to='patients.patientrelatedpersonreference')),
                ('subscriber_identifier', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='coverage_subscriber_identifier', to='base.identifier')),
                ('type', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='coverage_type', to='base.codeableconcept')),
            ],
            options={
                'abstract': False,
            },
        ),
    ]
