# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-04-28 10:10
from __future__ import unicode_literals

from django.db import migrations, models
import django.db.models.deletion
import uuid


class Migration(migrations.Migration):

    dependencies = [
        ('permabots', '0004_auto_20160427_0856'),
    ]

    operations = [
        migrations.CreateModel(
            name='MessengerBot',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='Date created')),
                ('updated_at', models.DateTimeField(auto_now=True, verbose_name='Date updated')),
                ('enabled', models.BooleanField(default=True, help_text='Enable/disable telegram bot', verbose_name='Enable')),
                ('token', models.CharField(db_index=True, max_length=512, verbose_name='Messenger Token')),
            ],
            options={
                'verbose_name': 'Messenger Bot',
                'verbose_name_plural': 'Messenger Bots',
            },
        ),
        migrations.CreateModel(
            name='MessengerChatState',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='Date created')),
                ('updated_at', models.DateTimeField(auto_now=True, verbose_name='Date updated')),
                ('context', models.TextField(blank=True, help_text='Context serialized to json when this state was set', null=True, verbose_name='Context')),
                ('chat', models.CharField(db_index=True, max_length=255, verbose_name='Sender Id')),
                ('state', models.ForeignKey(help_text='State related to the chat', on_delete=django.db.models.deletion.CASCADE, related_name='messengerchatstate_chat', to='permabots.State', verbose_name='State')),
            ],
            options={
                'verbose_name': 'Messenger Chat State',
                'verbose_name_plural': 'Messenger Chats States',
            },
        ),
        migrations.CreateModel(
            name='MessengerMessage',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='Date created')),
                ('updated_at', models.DateTimeField(auto_now=True, verbose_name='Date updated')),
                ('sender', models.CharField(max_length=255, verbose_name='Sender Id')),
                ('recipient', models.CharField(max_length=255, verbose_name='Recipient Id')),
                ('timestamp', models.DateTimeField(verbose_name='Timestamp')),
                ('type', models.CharField(choices=[(b'message', 'Message'), (b'postback', 'Postback'), (b'delivery', 'Delivery')], max_length=255)),
                ('postback', models.CharField(blank=True, max_length=255, null=True, verbose_name='PostBack')),
                ('text', models.TextField(blank=True, null=True, verbose_name='Text')),
                ('bot', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='messages', to='permabots.MessengerBot', verbose_name='Messenger Bot')),
            ],
            options={
                'ordering': ['-timestamp'],
                'verbose_name': 'Messenger Message',
                'verbose_name_plural': 'Messenger Messages',
            },
        ),
        migrations.CreateModel(
            name='MessengerRecipient',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='Date created')),
                ('updated_at', models.DateTimeField(auto_now=True, verbose_name='Date updated')),
                ('chat_id', models.CharField(db_index=True, help_text='Chat identifier provided by Messenger API', max_length=150, verbose_name='Chat Id')),
                ('name', models.CharField(db_index=True, help_text='Name of recipient', max_length=100, verbose_name='Name')),
                ('hook', models.ForeignKey(help_text='Hook which recipient is attached to', on_delete=django.db.models.deletion.CASCADE, related_name='messenger_recipients', to='permabots.Hook', verbose_name='Hook')),
            ],
            options={
                'verbose_name': 'Messenger Recipient',
                'verbose_name_plural': 'Messenger Recipients',
            },
        ),
        migrations.AlterModelOptions(
            name='kikchatstate',
            options={'verbose_name': 'Kik Chat State', 'verbose_name_plural': 'Kik Chats States'},
        ),
        migrations.AlterModelOptions(
            name='telegramchatstate',
            options={'verbose_name': 'Telegram Chat State', 'verbose_name_plural': 'Telegram Chats States'},
        ),
        migrations.AddField(
            model_name='bot',
            name='messenger_bot',
            field=models.OneToOneField(blank=True, help_text='Messenger Bot', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='bot', to='permabots.MessengerBot', verbose_name='Messenger Bot'),
        ),
    ]
