# Generated by Django 2.1.4 on 2018-12-11 12:39

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Bill',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('price', models.DecimalField(decimal_places=2, max_digits=6)),
            ],
            options={
                'verbose_name': 'Bill',
                'verbose_name_plural': 'Billing',
            },
        ),
        migrations.CreateModel(
            name='Call',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('call_id', models.IntegerField(default=0)),
                ('source', models.CharField(max_length=15, validators=[django.core.validators.RegexValidator(message='Invalid phone number.', regex='^(([1-9]{2})(?:[2-8]|9[1-9])[0-9]{7})$'), django.core.validators.MaxLengthValidator(15)], verbose_name='Source Phone')),
                ('destination', models.CharField(max_length=15, validators=[django.core.validators.RegexValidator(message='Invalid phone number.', regex='^(([1-9]{2})(?:[2-8]|9[1-9])[0-9]{7})$'), django.core.validators.MaxLengthValidator(15)], verbose_name='Destination Phone')),
            ],
            options={
                'verbose_name': 'Call',
                'verbose_name_plural': 'Calls',
            },
        ),
        migrations.CreateModel(
            name='CallEvent',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('type_call', models.CharField(choices=[('start', 'Start Call'), ('end', 'End Call')], max_length=10)),
                ('timestamp', models.DateTimeField()),
                ('call_id', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='core.Call')),
            ],
            options={
                'verbose_name': 'Call Event',
                'verbose_name_plural': 'Call Events',
                'ordering': ('timestamp',),
            },
        ),
        migrations.CreateModel(
            name='Price',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('type_price', models.CharField(choices=[('1', 'Standard time call'), ('2', 'Reduced tariff time call')], default='1', max_length=2, unique=True)),
                ('fixed_charge', models.DecimalField(decimal_places=2, max_digits=7, verbose_name='Value fixed by call')),
                ('periodic_charge', models.DecimalField(decimal_places=2, max_digits=7, verbose_name='Value by minute')),
                ('start_period', models.TimeField(verbose_name='Hour of start')),
                ('end_period', models.TimeField(verbose_name='Hour of end')),
            ],
            options={
                'verbose_name': 'Price',
                'verbose_name_plural': 'Prices',
            },
        ),
        migrations.AddField(
            model_name='bill',
            name='call',
            field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='core.Call'),
        ),
        migrations.AlterUniqueTogether(
            name='callevent',
            unique_together={('call_id', 'type_call')},
        ),
    ]
