# Generated by Django 5.2.6

from django.db import migrations, models
import django.core.validators
import netbox.models
import utilities.choices


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('contenttypes', '0002_remove_content_type_name'),
    ]

    operations = [
        migrations.CreateModel(
            name='ZwaveNetwork',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('last_updated', models.DateTimeField(auto_now=True, null=True)),
                ('custom_field_data', models.JSONField(blank=True, default=dict)),
                ('name', models.CharField(help_text='Name of the Z-Wave network', max_length=100)),
                ('network_id', models.PositiveIntegerField(help_text='Z-Wave Network ID (1-255)', unique=True, validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(255)])),
                ('home_id', models.CharField(help_text='Z-Wave Home ID (hexadecimal)', max_length=16, unique=True)),
                ('status', models.CharField(choices=[('active', 'Active'), ('inactive', 'Inactive'), ('maintenance', 'Maintenance')], default='active', help_text='Network status', max_length=20)),
                ('description', models.TextField(blank=True, help_text='Network description')),
                ('controller_node_id', models.PositiveIntegerField(blank=True, help_text='Controller node ID', null=True, validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(232)])),
                ('security_enabled', models.BooleanField(default=False, help_text='Whether security is enabled on this network')),
                ('s2_enabled', models.BooleanField(default=False, help_text='Whether S2 security is enabled')),
                ('tags', models.ManyToManyField(blank=True, related_name='+', to='extras.tag')),
            ],
            options={
                'verbose_name': 'Z-Wave Network',
                'verbose_name_plural': 'Z-Wave Networks',
                'ordering': ['name'],
            },
            bases=(netbox.models.NetBoxModel, models.Model),
        ),
        migrations.CreateModel(
            name='ZwaveDevice',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('last_updated', models.DateTimeField(auto_now=True, null=True)),
                ('custom_field_data', models.JSONField(blank=True, default=dict)),
                ('name', models.CharField(help_text='Device name', max_length=100)),
                ('node_id', models.PositiveIntegerField(help_text='Z-Wave Node ID (1-232)', validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(232)])),
                ('device_type', models.CharField(choices=[('controller', 'Controller'), ('router', 'Router'), ('end_device', 'End Device'), ('sleeping_end_device', 'Sleeping End Device')], default='end_device', help_text='Device type', max_length=20)),
                ('status', models.CharField(choices=[('online', 'Online'), ('offline', 'Offline'), ('unknown', 'Unknown'), ('failed', 'Failed')], default='unknown', help_text='Device status', max_length=20)),
                ('manufacturer_id', models.PositiveIntegerField(blank=True, help_text='Manufacturer ID', null=True)),
                ('product_type', models.PositiveIntegerField(blank=True, help_text='Product Type', null=True)),
                ('product_id', models.PositiveIntegerField(blank=True, help_text='Product ID', null=True)),
                ('firmware_version', models.CharField(blank=True, help_text='Firmware version', max_length=20)),
                ('hardware_version', models.CharField(blank=True, help_text='Hardware version', max_length=20)),
                ('library_type', models.CharField(blank=True, help_text='Library type', max_length=20)),
                ('protocol_version', models.CharField(blank=True, help_text='Protocol version', max_length=20)),
                ('application_version', models.CharField(blank=True, help_text='Application version', max_length=20)),
                ('is_secure', models.BooleanField(default=False, help_text='Whether device supports security')),
                ('is_frequent_listener', models.BooleanField(default=False, help_text='Whether device is a frequent listener')),
                ('is_beaming', models.BooleanField(default=False, help_text='Whether device supports beaming')),
                ('is_routing', models.BooleanField(default=False, help_text='Whether device supports routing')),
                ('max_baud_rate', models.PositiveIntegerField(blank=True, help_text='Maximum baud rate', null=True)),
                ('last_seen', models.DateTimeField(blank=True, help_text='Last time device was seen', null=True)),
                ('battery_level', models.PositiveIntegerField(blank=True, help_text='Battery level (0-100)', null=True, validators=[django.core.validators.MaxValueValidator(100)])),
                ('signal_strength', models.IntegerField(blank=True, help_text='Signal strength (dBm)', null=True)),
                ('description', models.TextField(blank=True, help_text='Device description')),
                ('network', models.ForeignKey(help_text='Z-Wave network this device belongs to', on_delete=models.CASCADE, related_name='devices', to='netbox_zwave.zwavenetwork')),
                ('tags', models.ManyToManyField(blank=True, related_name='+', to='extras.tag')),
            ],
            options={
                'verbose_name': 'Z-Wave Device',
                'verbose_name_plural': 'Z-Wave Devices',
                'ordering': ['network', 'node_id'],
            },
            bases=(netbox.models.NetBoxModel, models.Model),
        ),
        migrations.CreateModel(
            name='ZwaveCommandClass',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('last_updated', models.DateTimeField(auto_now=True, null=True)),
                ('custom_field_data', models.JSONField(blank=True, default=dict)),
                ('command_class_id', models.PositiveIntegerField(help_text='Command Class ID', validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(255)])),
                ('name', models.CharField(help_text='Command class name', max_length=100)),
                ('version', models.PositiveIntegerField(default=1, help_text='Command class version')),
                ('is_secure', models.BooleanField(default=False, help_text='Whether command class is secure')),
                ('is_controlled', models.BooleanField(default=False, help_text='Whether command class is controlled')),
                ('is_supported', models.BooleanField(default=True, help_text='Whether command class is supported')),
                ('device', models.ForeignKey(help_text='Device this command class belongs to', on_delete=models.CASCADE, related_name='command_classes', to='netbox_zwave.zwavedevice')),
                ('tags', models.ManyToManyField(blank=True, related_name='+', to='extras.tag')),
            ],
            options={
                'verbose_name': 'Z-Wave Command Class',
                'verbose_name_plural': 'Z-Wave Command Classes',
                'ordering': ['device', 'command_class_id'],
            },
            bases=(netbox.models.NetBoxModel, models.Model),
        ),
        migrations.CreateModel(
            name='ZwaveAssociation',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('last_updated', models.DateTimeField(auto_now=True, null=True)),
                ('custom_field_data', models.JSONField(blank=True, default=dict)),
                ('group_id', models.PositiveIntegerField(default=1, help_text='Association group ID')),
                ('description', models.TextField(blank=True, help_text='Association description')),
                ('source_device', models.ForeignKey(help_text='Source device', on_delete=models.CASCADE, related_name='source_associations', to='netbox_zwave.zwavedevice')),
                ('target_device', models.ForeignKey(help_text='Target device', on_delete=models.CASCADE, related_name='target_associations', to='netbox_zwave.zwavedevice')),
                ('tags', models.ManyToManyField(blank=True, related_name='+', to='extras.tag')),
            ],
            options={
                'verbose_name': 'Z-Wave Association',
                'verbose_name_plural': 'Z-Wave Associations',
                'ordering': ['source_device', 'group_id'],
            },
            bases=(netbox.models.NetBoxModel, models.Model),
        ),
    ]
