# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2018-02-26 00:20
from __future__ import unicode_literals

from django.db import migrations, models
import django.db.models.deletion
import djing.fields
from djing.fields import MyGenericIPAddressField


class Migration(migrations.Migration):
    initial = True

    dependencies = [
        ('group_app', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='Device',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('ip_address', MyGenericIPAddressField(max_length=8, protocol='ipv4', verbose_name='Ip address')),
                ('mac_addr', djing.fields.MACAddressField(blank=True, integer=True, null=True, unique=True,
                                                          verbose_name='Mac address')),
                ('comment', models.CharField(max_length=256, verbose_name='Comment')),
                ('devtype', models.CharField(
                    choices=[('Dl', 'DLink switch'), ('Pn', 'PON OLT'), ('On', 'PON ONU'), ('Ex', 'Eltex switch')],
                    default='Dl', max_length=2, verbose_name='Device type')),
                ('man_passw', models.CharField(blank=True, max_length=16, null=True, verbose_name='SNMP password')),
                ('snmp_item_num', models.PositiveSmallIntegerField(blank=True, default=0, verbose_name='SNMP Number')),
                ('status',
                 models.CharField(choices=[('und', 'Undefined'), ('up', 'Up'), ('unr', 'Unreachable'), ('dwn', 'Down')],
                                  default='und', max_length=3, verbose_name='Status')),
                ('is_noticeable',
                 models.BooleanField(default=False, verbose_name='Send notify when monitoring state changed')),
                ('group', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL,
                                            to='group_app.Group', verbose_name='Device group')),
                ('parent_dev', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL,
                                                 to='devapp.Device', verbose_name='Parent device')),
            ],
            options={
                'verbose_name': 'Device',
                'verbose_name_plural': 'Devices',
                'db_table': 'dev',
                'ordering': ['comment']
            },
        ),
        migrations.CreateModel(
            name='Port',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('num', models.PositiveSmallIntegerField(default=0, verbose_name='Number')),
                ('descr', models.CharField(blank=True, max_length=60, null=True, verbose_name='Description')),
                ('device', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='devapp.Device',
                                             verbose_name='Device')),
            ],
            options={
                'verbose_name': 'Port',
                'verbose_name_plural': 'Ports',
                'db_table': 'dev_port',
                'permissions': (('can_toggle_ports', 'Can toggle ports'),),
            },
        ),
        migrations.AlterUniqueTogether(
            name='port',
            unique_together={('device', 'num')},
        ),
    ]
