# -*- coding: utf-8 -*-
# Copyright (C) 2018 Freetech Solutions

# This file is part of OMniLeads

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3, as published by
# the Free Software Foundation.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Lesser General Public License for more details.

# You should have received a copy of the GNU Lesser General Public License
# along with this program.  If not, see http://www.gnu.org/licenses/.
#
# Generated by Django 1.9.7 on 2018-07-20 17:42
from __future__ import unicode_literals

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('contenttypes', '0002_remove_content_type_name'),
        ('ominicontacto_app', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='DestinoEntrante',
            fields=[
                ('id', models.AutoField(
                    auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('nombre', models.CharField(max_length=128, unique=True)),
                ('tipo', models.PositiveIntegerField(
                    choices=[(1, 'Campa\xf1a entrante'), (2, 'Validaci\xf3n de fecha/hora'),
                             (3, 'IVR')])),
                ('object_id', models.PositiveIntegerField()),
                ('content_type', models.ForeignKey(
                    on_delete=django.db.models.deletion.CASCADE, to='contenttypes.ContentType')),
            ],
        ),
        migrations.CreateModel(
            name='GrupoHorario',
            fields=[
                ('id', models.AutoField(
                    auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('nombre', models.CharField(max_length=50, unique=True)),
            ],
        ),
        migrations.CreateModel(
            name='IVR',
            fields=[
                ('id', models.AutoField(
                    auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('nombre', models.CharField(max_length=30, unique=True)),
                ('descripcion', models.CharField(max_length=30)),
                ('time_out', models.PositiveIntegerField()),
                ('time_out_retries', models.PositiveIntegerField(
                    validators=[django.core.validators.MinValueValidator(1),
                                django.core.validators.MaxValueValidator(99)])),
                ('invalid_retries', models.PositiveIntegerField()),
                ('audio_principal', models.ForeignKey(
                    on_delete=django.db.models.deletion.PROTECT,
                    related_name='audio_principal_ivrs', to='ominicontacto_app.ArchivoDeAudio')),
                ('invalid_audio', models.ForeignKey(
                    blank=True, null=True, on_delete=django.db.models.deletion.PROTECT,
                    related_name='audio_invalid_ivrs', to='ominicontacto_app.ArchivoDeAudio')),
                ('time_out_audio', models.ForeignKey(
                    blank=True, null=True, on_delete=django.db.models.deletion.PROTECT,
                    related_name='audio_time_out_ivrs', to='ominicontacto_app.ArchivoDeAudio')),
            ],
        ),
        migrations.CreateModel(
            name='OpcionDestino',
            fields=[
                ('id', models.AutoField(
                    auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('valor', models.CharField(max_length=30)),
                ('destino_anterior', models.ForeignKey(
                    on_delete=django.db.models.deletion.CASCADE, related_name='destinos_siguientes',
                    to='configuracion_telefonia_app.DestinoEntrante')),
                ('destino_siguiente', models.ForeignKey(
                    on_delete=django.db.models.deletion.CASCADE, related_name='destinos_anteriores',
                    to='configuracion_telefonia_app.DestinoEntrante')),
            ],
        ),
        migrations.CreateModel(
            name='OrdenTroncal',
            fields=[
                ('id', models.AutoField(
                    auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('orden', models.PositiveIntegerField()),
            ],
            options={
                'ordering': ['orden'],
            },
        ),
        migrations.CreateModel(
            name='PatronDeDiscado',
            fields=[
                ('id', models.AutoField(
                    auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('prepend', models.CharField(
                    blank=True, max_length=32, null=True,
                    validators=[django.core.validators.RegexValidator('^\\d+$')])),
                ('prefix', models.CharField(
                    blank=True, max_length=32, null=True,
                    validators=[django.core.validators.RegexValidator('^\\d+$')])),
                ('match_pattern', models.CharField(
                    max_length=100,
                    validators=[django.core.validators.RegexValidator('^[\\w|\\.|\\[|\\]|-]+$')])),
                ('orden', models.PositiveIntegerField()),
            ],
            options={
                'ordering': ['orden'],
            },
        ),
        migrations.CreateModel(
            name='RutaEntrante',
            fields=[
                ('id', models.AutoField(
                    auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('nombre', models.CharField(max_length=30, unique=True)),
                ('telefono', models.CharField(
                    max_length=30, unique=True,
                    validators=[django.core.validators.RegexValidator('^[\\w|\\.|\\[|\\]|-]+$')])),
                ('prefijo_caller_id', models.CharField(blank=True, max_length=30, null=True)),
                ('idioma', models.PositiveIntegerField(
                    choices=[(1, 'Ingl\xe9s'), (2, 'Espa\xf1ol')])),
                ('destino', models.ForeignKey(
                    on_delete=django.db.models.deletion.CASCADE, related_name='rutas_entrantes',
                    to='configuracion_telefonia_app.DestinoEntrante')),
            ],
        ),
        migrations.CreateModel(
            name='RutaSaliente',
            fields=[
                ('id', models.AutoField(
                    auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('nombre', models.CharField(
                    max_length=128, unique=True,
                    validators=[django.core.validators.RegexValidator('^[\\w]+$')])),
                ('ring_time', models.PositiveIntegerField(
                    default=25, validators=[django.core.validators.MaxValueValidator(3600),
                                            django.core.validators.MinValueValidator(1)])),
                ('dial_options', models.CharField(
                    default='Tt', max_length=512,
                    validators=[django.core.validators.RegexValidator('^[HhKkRrL():MATtWw]+$')])),
            ],
        ),
        migrations.CreateModel(
            name='TroncalSIP',
            fields=[
                ('id', models.AutoField(
                    auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('nombre', models.CharField(
                    max_length=128, unique=True,
                    validators=[django.core.validators.RegexValidator('^[\\w]+$')])),
                ('canales_maximos', models.PositiveIntegerField(
                    default=1000, validators=[django.core.validators.MinValueValidator(0),
                                              django.core.validators.MaxValueValidator(1000)])),
                ('caller_id', models.CharField(
                    blank=True, max_length=100, null=True,
                    validators=[django.core.validators.RegexValidator('^[\\w]+$')])),
                ('register_string', models.CharField(blank=True, max_length=100, null=True)),
                ('text_config', models.TextField()),
            ],
        ),
        migrations.CreateModel(
            name='ValidacionFechaHora',
            fields=[
                ('id', models.AutoField(
                    auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('nombre', models.CharField(max_length=50, unique=True)),
                ('grupo_horario', models.ForeignKey(
                    on_delete=django.db.models.deletion.PROTECT,
                    related_name='validaciones_fecha_hora',
                    to='configuracion_telefonia_app.GrupoHorario')),
            ],
        ),
        migrations.CreateModel(
            name='ValidacionTiempo',
            fields=[
                ('id', models.AutoField(
                    auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('tiempo_inicial', models.TimeField(help_text='Tiempo inicio')),
                ('tiempo_final', models.TimeField(help_text='Tiempo final')),
                ('dia_semana_inicial', models.PositiveIntegerField(
                    blank=True, choices=[(0, 'Lunes'), (1, 'Martes'), (2, 'Mi\xe9rcoles'),
                                         (3, 'Jueves'), (4, 'Viernes'), (5, 'S\xe1bado'),
                                         (6, 'Domingo')],
                    help_text='D\xeda de la semana inicio', null=True)),
                ('dia_semana_final', models.PositiveIntegerField(
                    blank=True, choices=[(0, 'Lunes'), (1, 'Martes'), (2, 'Mi\xe9rcoles'),
                                         (3, 'Jueves'), (4, 'Viernes'), (5, 'S\xe1bado'),
                                         (6, 'Domingo')], help_text='D\xeda de la semana final',
                    null=True)),
                ('dia_mes_inicio', models.PositiveIntegerField(
                    blank=True,
                    choices=[(1, b'1'), (2, b'2'), (3, b'3'), (4, b'4'), (5, b'5'),
                             (6, b'6'), (7, b'7'), (8, b'8'), (9, b'9'), (10, b'10'),
                             (11, b'11'), (12, b'12'), (13, b'13'), (14, b'14'),
                             (15, b'15'), (16, b'16'), (17, b'17'), (18, b'18'),
                             (19, b'19'), (20, b'20'), (21, b'21'), (22, b'22'),
                             (23, b'23'), (24, b'24'), (25, b'25'), (26, b'26'),
                             (27, b'27'), (28, b'28'), (29, b'29'), (30, b'30'),
                             (31, b'31')], help_text='D\xeda del mes inicio', null=True)),
                ('dia_mes_final', models.PositiveIntegerField(
                    blank=True,
                    choices=[(1, b'1'), (2, b'2'), (3, b'3'), (4, b'4'), (5, b'5'),
                             (6, b'6'), (7, b'7'), (8, b'8'), (9, b'9'), (10, b'10'),
                             (11, b'11'), (12, b'12'), (13, b'13'), (14, b'14'),
                             (15, b'15'), (16, b'16'), (17, b'17'), (18, b'18'),
                             (19, b'19'), (20, b'20'), (21, b'21'), (22, b'22'),
                             (23, b'23'), (24, b'24'), (25, b'25'), (26, b'26'),
                             (27, b'27'), (28, b'28'), (29, b'29'), (30, b'30'),
                             (31, b'31')], help_text='D\xeda del mes final', null=True)),
                ('mes_inicio', models.PositiveIntegerField(
                    blank=True,
                    choices=[(1, 'Enero'), (2, 'Febrero'), (3, 'Marzo'), (4, 'Abril'), (5, 'Mayo'),
                             (6, 'Junio'), (7, 'Julio'), (8, 'Agosto'), (9, 'Septiembre'),
                             (10, 'Octubre'), (11, 'Noviembre'), (12, 'Diciembre')],
                    help_text='Mes inicio', null=True)),
                ('mes_final', models.PositiveIntegerField(
                    blank=True, choices=[(1, 'Enero'), (2, 'Febrero'), (3, 'Marzo'), (4, 'Abril'),
                                         (5, 'Mayo'), (6, 'Junio'), (7, 'Julio'), (8, 'Agosto'),
                                         (9, 'Septiembre'), (10, 'Octubre'), (11, 'Noviembre'),
                                         (12, 'Diciembre')], help_text='Mes final', null=True)),
                ('grupo_horario', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                                    related_name='validaciones_tiempo',
                                                    to='configuracion_telefonia_app.GrupoHorario')),
            ],
        ),
        migrations.AddField(
            model_name='patrondediscado',
            name='ruta_saliente',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE, related_name='patrones_de_discado',
                to='configuracion_telefonia_app.RutaSaliente'),
        ),
        migrations.AddField(
            model_name='ordentroncal',
            name='ruta_saliente',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE, related_name='secuencia_troncales',
                to='configuracion_telefonia_app.RutaSaliente'),
        ),
        migrations.AddField(
            model_name='ordentroncal',
            name='troncal',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.PROTECT,
                related_name='ordenes_en_rutas_salientes',
                to='configuracion_telefonia_app.TroncalSIP'),
        ),
        migrations.AddField(
            model_name='destinoentrante',
            name='destinos',
            field=models.ManyToManyField(
                through='configuracion_telefonia_app.OpcionDestino',
                to='configuracion_telefonia_app.DestinoEntrante'),
        ),
        migrations.AlterUniqueTogether(
            name='patrondediscado',
            unique_together=set([('orden', 'ruta_saliente')]),
        ),
        migrations.AlterUniqueTogether(
            name='ordentroncal',
            unique_together=set([('orden', 'ruta_saliente')]),
        ),
        migrations.AlterUniqueTogether(
            name='opciondestino',
            unique_together=set([('destino_anterior', 'valor')]),
        ),
    ]
