text: # -*- coding: utf-8 -*-
  # Generated by Django 1.11.20 on 2019-10-16 20:08
  from __future__ import unicode_literals
  
  from django.conf import settings
  from django.db import migrations, models
  import django.db.models.deletion
  import django_userforeignkey.models.fields
  
  
  class Migration(migrations.Migration):
  
      initial = True
  
      dependencies = [
          migrations.swappable_dependency(settings.AUTH_USER_MODEL),
      ]
  
      operations = [
          migrations.CreateModel(
              name='Room',
              fields=[
                  ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                  ('last_updated_at', models.DateTimeField(auto_created=True, auto_now=True, verbose_name='When was this room last updated')),
                  ('created_at', models.DateTimeField(auto_created=True, auto_now_add=True, verbose_name='When was this room created')),
                  ('name', models.CharField(max_length=128, verbose_name='Name of the room')),
                  ('comment', models.TextField(verbose_name='Comment for this room')),
                  ('public', models.BooleanField(default=False, verbose_name='Whether this room is public or not')),
                  ('has_temperature', models.BooleanField(default=False, verbose_name='Whether this room has a working temperature sensor')),
                  ('has_humidity', models.BooleanField(default=False, verbose_name='Whether this room has a working humidity sensor')),
                  ('has_air_pressure', models.BooleanField(default=False, verbose_name='Whether this room has a working air pressure sensor')),
              ],
              options={
                  'verbose_name': 'Room',
                  'verbose_name_plural': 'Rooms',
                  'ordering': ('created_at',),
              },
          ),
          migrations.CreateModel(
              name='Sensor',
              fields=[
                  ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                  ('last_updated_at', models.DateTimeField(auto_created=True, auto_now=True, verbose_name='When was this sensor config was last updated')),
                  ('created_at', models.DateTimeField(auto_created=True, auto_now_add=True, verbose_name='When was this sensor created')),
                  ('name', models.CharField(max_length=128, verbose_name='Name of the sensor')),
                  ('comment', models.TextField(blank=True, null=True, verbose_name='Comment for this sensor')),
                  ('public', models.BooleanField(db_index=True, default=False, verbose_name='Whether this sensor is public or not')),
                  ('type', models.CharField(choices=[('air_pressure', 'Air Pressure'), ('camera', 'Camera'), ('door', 'Door'), ('temperature', 'Temperature'), ('window', 'Window'), ('main_door', 'Main Door'), ('movement', 'Movement'), ('network_speed', 'Network Speed')], db_index=True, max_length=24, verbose_name='Type of the sensor')),
                  ('room', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='sensors', to='smarthome.Room', verbose_name='Room that this label belongs to')),
              ],
              options={
                  'verbose_name': 'Sensor',
                  'verbose_name_plural': 'Sensors',
                  'ordering': ('room', 'created_at', 'name'),
              },
          ),
          migrations.CreateModel(
              name='SensorIdToSensorMapping',
              fields=[
                  ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                  ('sensor_id', models.IntegerField(db_index=True, verbose_name='The sensor id that the sensor is mapped to')),
                  ('start_date', models.DateTimeField(verbose_name='Date time after when this mapping is valid')),
                  ('end_date', models.DateTimeField(blank=True, null=True, verbose_name='Date time until when this mapping is valid')),
                  ('real_sensor', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='sensor_ids', to='smarthome.Sensor')),
              ],
              options={
                  'verbose_name': 'Mapping between sensor and sensor id',
                  'verbose_name_plural': 'Mappings between sensors and sensor ids',
              },
          ),
          migrations.CreateModel(
              name='SmartHome',
              fields=[
                  ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                  ('name', models.CharField(max_length=256, verbose_name='Name of the smart home')),
                  ('description', models.TextField(verbose_name='Additional information for the smart home')),
                  ('address', models.CharField(max_length=256, verbose_name='Address of the smart home (e.g., used for weather information)')),
                  ('created_at', models.DateTimeField(auto_now_add=True)),
                  ('created_by', django_userforeignkey.models.fields.UserForeignKey(blank=True, editable=False, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL)),
              ],
              options={
                  'verbose_name': 'Smart Home',
                  'verbose_name_plural': 'Smart Homes',
              },
          ),
          migrations.CreateModel(
              name='SmartHomeApiKey',
              fields=[
                  ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                  ('access_type', models.CharField(choices=[('read', 'Read only access'), ('read_write', 'Read and write access'), ('disabled', 'No access')], default='disabled', max_length=16, verbose_name='Access Type for the API Key')),
                  ('key', models.CharField(default='', max_length=128, verbose_name='API Key')),
                  ('smarthome', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='api_keys', to='smarthome.SmartHome', verbose_name='Smart Home that this API Key belongs to')),
              ],
              options={
                  'verbose_name': 'API Key',
                  'verbose_name_plural': 'API Keys',
              },
          ),
          migrations.AddField(
              model_name='room',
              name='smarthome',
              field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='rooms', to='smarthome.SmartHome', verbose_name='Smart Home that this Room belongs to'),
          ),
          migrations.AlterUniqueTogether(
              name='smarthomeapikey',
              unique_together=set([('key', 'smarthome')]),
          ),
      ]
  