# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-04-02 18:30
from __future__ import unicode_literals

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


class Migration(migrations.Migration):

    dependencies = [
        ('django_shop', '0020_auto_20170304_1349'),
    ]

    operations = [
        migrations.CreateModel(
            name='CartActionLog',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('action', models.CharField(choices=[('add', 'Добавление в корзину'), ('set', 'Установка количества'), ('remove', 'Удаление из корзины'), ('drop', 'Автоматическое удаление из корзины'), ('delivery', 'Выбор способа доставки'), ('payment', 'Выбор способа оплаты')], max_length=10, verbose_name='Действие')),
                ('message', models.CharField(max_length=200, verbose_name='Подробности')),
                ('log_date', models.DateTimeField(auto_now_add=True, verbose_name='Время')),
            ],
            options={
                'verbose_name': 'изменение корзины',
                'ordering': ['-log_date'],
                'verbose_name_plural': 'изменения корзины',
            },
        ),
        migrations.CreateModel(
            name='Customer',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', models.DateTimeField(auto_now_add=True, verbose_name='Создан')),
                ('updated', models.DateTimeField(auto_now=True, verbose_name='Последнее действие')),
            ],
            options={
                'verbose_name': 'клиент',
                'verbose_name_plural': 'клиенты',
            },
        ),
        migrations.CreateModel(
            name='CustomersCart',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', models.DateTimeField(auto_now_add=True, verbose_name='Дата первого действия')),
                ('updated', models.DateTimeField(auto_now=True, verbose_name='Дата последнего изменения')),
                ('customer', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='carts', to='django_shop.Customer', verbose_name='Клиент')),
                ('delivery_type', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='django_shop.DeliveryType', verbose_name='Способ доставки')),
            ],
            options={
                'verbose_name': 'корзина клиента',
                'ordering': ['-updated'],
                'verbose_name_plural': 'корзины клиента',
            },
        ),
        migrations.CreateModel(
            name='CustomersField',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('type', models.CharField(choices=[('name', 'Имя'), ('phone', 'Телефон'), ('email', 'Почта'), ('ip', 'IP'), ('session_id', 'Сессия'), ('yandex_id', 'Yandex ID'), ('google_id', 'Google ID')], db_index=True, max_length=20, verbose_name='Тип')),
                ('value', models.CharField(db_index=True, max_length=200, verbose_name='Значение')),
                ('created', models.DateTimeField(auto_now_add=True, verbose_name='Дата создания')),
                ('customer', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='fields', to='django_shop.Customer', verbose_name='Клиент')),
            ],
            options={
                'verbose_name': 'поле описания',
                'verbose_name_plural': 'поля описания',
            },
        ),
        migrations.CreateModel(
            name='ProductInCart',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('quantity', models.DecimalField(decimal_places=2, max_digits=9, verbose_name='Количество')),
                ('cart', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='products', to='django_shop.CustomersCart', verbose_name='Заказ')),
                ('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='django_shop.Product', verbose_name='Продукт')),
            ],
            options={
                'verbose_name': 'продукт в корзине',
                'verbose_name_plural': 'продукты в корзине',
            },
        ),
        migrations.AddField(
            model_name='customerscart',
            name='email',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='ecarts', to='django_shop.CustomersField', verbose_name='Email'),
        ),
        migrations.AddField(
            model_name='customerscart',
            name='name',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='ncarts', to='django_shop.CustomersField', verbose_name='Имя'),
        ),
        migrations.AddField(
            model_name='customerscart',
            name='order',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='django_shop.Order', verbose_name='Заказ'),
        ),
        migrations.AddField(
            model_name='customerscart',
            name='payment_method',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='django_shop.PaymentType', verbose_name='Способ оплаты'),
        ),
        migrations.AddField(
            model_name='customerscart',
            name='phone',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='pcarts', to='django_shop.CustomersField', verbose_name='Телефон'),
        ),
        migrations.AddField(
            model_name='cartactionlog',
            name='cart',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='logs', to='django_shop.CustomersCart', verbose_name='Корзина'),
        ),
    ]
