# Generated by Django 3.2.4 on 2021-06-16 15:14

from decimal import Decimal
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('shop', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='Order',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('phone_number', models.CharField(blank=True, max_length=15)),
                ('address_second', models.CharField(blank=True, max_length=250, null=True)),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('updated', models.DateTimeField(auto_now=True)),
                ('payment_type', models.CharField(blank=True, choices=[('0', 'Thanh toán khi nhận hàng'), ('1', 'Thanh toán bằng paypal')], default='0', max_length=1)),
                ('paid', models.BooleanField(default=False)),
                ('state', models.CharField(blank=True, choices=[('0', 'Chờ xác nhận'), ('1', 'Đã xác nhận'), ('2', 'Đang giao hàng'), ('3', 'Giao hàng thành công'), ('4', 'Huỷ'), ('5', 'Giao hàng thất bại')], default='0', max_length=1)),
                ('shipment_name', models.CharField(blank=True, default='Giao hàng tiết kiệm', max_length=50, null=True)),
                ('shipment_price', models.DecimalField(blank=True, decimal_places=0, default=Decimal('10000'), max_digits=6, null=True)),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'ordering': ('-created',),
            },
        ),
        migrations.CreateModel(
            name='OrderItem',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('price', models.DecimalField(decimal_places=0, max_digits=10)),
                ('quantity', models.PositiveIntegerField(default=1)),
                ('isComment', models.BooleanField(default=False)),
                ('order', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='items', to='orders.order')),
                ('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='shop.product')),
            ],
        ),
    ]
