# -*- coding: utf-8 -*-
# Generated by Django 1.9.12 on 2017-06-22 15:39
from __future__ import unicode_literals

from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import phonenumber_field.modelfields
import uuid


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Message',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, help_text='UUID.', primary_key=True, serialize=False, verbose_name='UUID')),
                ('remote_uuid', models.UUIDField(help_text='UUID bij gateway.', null=True, verbose_name='gateway UUID')),
                ('gateway', models.CharField(choices=[('plivo', 'Plivo'), ('twilio', 'Twilio')], help_text='SMS gateway.', max_length=6, verbose_name='gateway')),
                ('status', models.CharField(choices=[('queued', 'In de wachtrij'), ('sending', 'Wordt verzonden'), ('sent', 'Verzonden'), ('failed', 'Gefaald'), ('delivered', 'Afgeleverd'), ('undelivered', 'Niet afgeleverd'), ('rejected', 'Afgewezen')], default='queued', help_text='Status.', max_length=11, verbose_name='status')),
                ('sent_at', models.DateTimeField(blank=True, default=django.utils.timezone.now, help_text='Verzonden om.', verbose_name='verzonden om')),
                ('error', models.TextField(blank=True, help_text='Fout informatie.', verbose_name='fout')),
            ],
            options={
                'verbose_name': 'bericht',
                'verbose_name_plural': 'berichten',
            },
        ),
        migrations.CreateModel(
            name='Phone',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('phone', phonenumber_field.modelfields.PhoneNumberField(help_text='Telefoonnummer.', max_length=128, unique=True, verbose_name='telefoonnummer')),
                ('pin', models.CharField(blank=True, help_text='PIN code.', max_length=6, verbose_name='PIN code')),
                ('tries', models.PositiveIntegerField(default=0, help_text='Aantal keer PIN code geprobeerd.', verbose_name='pogingen')),
                ('confirmed_at', models.DateTimeField(blank=True, help_text='Moment waarop er voor het eerste een correcte PIN code werd ingegeven.', null=True, verbose_name='bevestigd op')),
                ('expires_at', models.DateTimeField(blank=True, help_text='Moment waarop PIN code vervalt.', null=True, verbose_name='PIN code vervalt op')),
                ('created_at', models.DateTimeField(auto_now_add=True, help_text='Moment waarop dit telefoonnummer werd toegevoegd.', verbose_name='aangemaakt op')),
                ('last_confirmed_message', models.OneToOneField(blank=True, help_text='Bericht dat laatst bevestigd werd.', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='confirmed_phone', to='django_sms.Message', verbose_name='laatst bevestigd bericht')),
            ],
            options={
                'verbose_name': 'telefoon',
                'verbose_name_plural': 'telefoons',
            },
        ),
        migrations.AddField(
            model_name='message',
            name='phone',
            field=models.ForeignKey(help_text='Telefoon.', on_delete=django.db.models.deletion.CASCADE, related_name='messages', to='django_sms.Phone', verbose_name='telefoon'),
        ),
    ]
