# -*- coding: utf-8 -*-
# Generated by Django 1.11.16 on 2019-01-31 08:48
from __future__ import unicode_literals

import apps.servers.models
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import uuid


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('cameras', '0001_initial'),
        ('location', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='FTP',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid1, editable=False, primary_key=True, serialize=False)),
                ('host', models.CharField(max_length=100)),
                ('port', models.PositiveIntegerField(default=21, validators=[django.core.validators.MinValueValidator(0), django.core.validators.MaxValueValidator(65535)])),
                ('username', models.CharField(max_length=100)),
                ('password', models.CharField(max_length=150)),
                ('ssl', models.BooleanField(default=False)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('is_online', models.BooleanField(default=False, verbose_name='Online')),
                ('camera', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='ftp_camera', to='cameras.Camera')),
            ],
        ),
        migrations.CreateModel(
            name='Server',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid1, editable=False, primary_key=True, serialize=False)),
                ('ip_address', models.CharField(max_length=15, validators=[apps.servers.models.validate_ipv46_address], verbose_name='IP Address')),
                ('name', models.CharField(blank=True, max_length=50)),
                ('domain_name', models.CharField(max_length=150, validators=[django.core.validators.URLValidator(schemes=['http', 'https'])], verbose_name='Host')),
                ('port', models.PositiveIntegerField(validators=[django.core.validators.MinValueValidator(0), django.core.validators.MaxValueValidator(65535)])),
                ('ssl', models.BooleanField(default=False)),
                ('type', models.PositiveSmallIntegerField(choices=[(0, 'Live'), (1, 'Storage'), (2, 'Alert'), (3, 'MQTT'), (4, 'Wowza'), (5, 'SRS')])),
                ('quantity', models.PositiveIntegerField(default=0, validators=[django.core.validators.MinValueValidator(0)])),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('modified_at', models.DateTimeField(auto_now=True)),
                ('created_by', models.CharField(max_length=150, null=True)),
                ('status', models.PositiveSmallIntegerField(choices=[(0, 'Offline'), (1, 'Online')], default=0)),
                ('camera', models.ManyToManyField(blank=True, related_name='server_camera', to='cameras.Camera')),
                ('city', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='server_city', to='location.City')),
            ],
            options={
                'verbose_name_plural': 'Servers',
            },
        ),
        migrations.AddField(
            model_name='ftp',
            name='server',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='ftp_server', to='servers.Server'),
        ),
        migrations.AlterUniqueTogether(
            name='server',
            unique_together=set([('ip_address', 'port', 'city')]),
        ),
        migrations.AlterUniqueTogether(
            name='ftp',
            unique_together=set([('host', 'port', 'username', 'camera', 'server')]),
        ),
    ]
