# Generated by Django 4.2.14 on 2025-01-22 18:30

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


class Migration(migrations.Migration):

    dependencies = [
        ('base', '0007_merge_20250121_1502'),
        ('devices', '0001_initial'),
    ]

    operations = [
        migrations.AlterField(
            model_name='devicereference',
            name='device',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='devices.device'),
        ),
        migrations.AlterField(
            model_name='devicereference',
            name='identifier',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='base.identifier'),
        ),
        migrations.CreateModel(
            name='DeviceMetricCalibration',
            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)),
                ('time', models.TimeField(null=True)),
                ('state', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='device_metric_calibration_state', to='base.coding')),
                ('type', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='device_metric_calibration_type', to='base.codeableconcept')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='DeviceMetric',
            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)),
                ('calibration', models.ManyToManyField(blank=True, related_name='device_metrics_calibration', to='devices.devicemetriccalibration')),
                ('category', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='device_metrics_category', to='base.codeableconcept')),
                ('color', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='device_metrics_color', to='base.coding')),
                ('device', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='device_metrics_device', to='devices.devicereference')),
                ('identifier', models.ManyToManyField(blank=True, related_name='device_metrics_identifier', to='base.identifier')),
                ('measurement_frequency', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='device_metrics_measurement_frequency', to='base.quantity')),
                ('operational_status', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='device_metrics_operational_status', to='base.coding')),
                ('type', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='device_metrics_type', to='base.codeableconcept')),
                ('unit', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='device_metrics_unit', to='base.codeableconcept')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='DeviceDeviceMetricReference',
            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)),
                ('device', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='device_device_metrics_device', to='devices.device')),
                ('device_metric', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='device_device_metrics_device_metric', to='devices.devicemetric')),
                ('identifier', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='device_device_metrics_identifier', to='base.identifier')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='DeviceCodeableReference',
            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)),
                ('concept', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='device_codeable_reference_concept', to='base.codeableconcept')),
                ('device', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='device_reference_device', to='devices.device')),
                ('identifier', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='device_reference_identifier', to='base.identifier')),
                ('reference', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='device_codeable_reference_reference', to='devices.devicereference')),
            ],
            options={
                'abstract': False,
            },
        ),
    ]
