# Generated by Django 3.0.7 on 2020-07-06 16:18

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),
    ]

    operations = [
        migrations.CreateModel(
            name='Categoria',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('nome', models.CharField(max_length=250, unique=True)),
                ('slug', models.SlugField(blank=True, max_length=250, null=True, unique=True)),
                ('descricao', models.TextField(blank=True)),
                ('imagem', models.ImageField(blank=True, upload_to='categorias')),
            ],
        ),
        migrations.CreateModel(
            name='Cliente',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('nome', models.CharField(max_length=200, null=True)),
                ('email', models.EmailField(max_length=255, null=True)),
                ('user', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='Produto',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('nome', models.CharField(max_length=250, unique=True)),
                ('slug', models.SlugField(max_length=250, unique=True)),
                ('descricao', models.TextField(blank=True)),
                ('preco', models.DecimalField(decimal_places=2, max_digits=10)),
                ('imagem', models.ImageField(blank=True, upload_to='produto')),
                ('stock', models.IntegerField()),
                ('ano', models.IntegerField(null=True)),
                ('disponivel', models.BooleanField(default=True)),
                ('data_criacao', models.DateTimeField(auto_now_add=True)),
                ('data_actualizacao', models.DateTimeField(auto_now=True)),
                ('categoria', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Categoria')),
            ],
            options={
                'ordering': ('nome',),
            },
        ),
        migrations.CreateModel(
            name='Pedido',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('data_pedido', models.DateTimeField(auto_now_add=True)),
                ('concluido', models.BooleanField(blank=True, default=False, null=True)),
                ('codigo_transacao', models.CharField(max_length=200, null=True)),
                ('cliente', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='core.Cliente')),
            ],
            options={
                'db_table': 'Pedido',
                'ordering': ['-data_pedido'],
            },
        ),
        migrations.CreateModel(
            name='ItemPedido',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('quantidade', models.IntegerField(blank=True, default=0, null=True)),
                ('preco', models.DecimalField(decimal_places=2, max_digits=10)),
                ('data_criacao', models.DateTimeField(auto_now_add=True)),
                ('pedido', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='core.Pedido')),
                ('produto', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='core.Produto')),
            ],
            options={
                'verbose_name': 'Item Pedido',
                'verbose_name_plural': 'Items Pedido',
                'db_table': 'ItemPedido',
            },
        ),
        migrations.CreateModel(
            name='EnderecoEntrega',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('endereco', models.CharField(max_length=200)),
                ('cidade', models.CharField(choices=[('Maputo', 'Maputo'), ('Matola', 'Matola'), ('Xai-Xai', 'Xai-Xai'), ('Inhambane', 'Inhambane'), ('Chimoio', 'Chimoio'), ('Beira', 'Beira'), ('Tete', 'Tete'), ('Quelimane', 'Quelimane'), ('Nampula', 'Nampula'), ('Pemba', 'Pemba'), ('Lichinga', 'Lichinga')], max_length=10)),
                ('bairro', models.CharField(max_length=200)),
                ('rua', models.CharField(max_length=200)),
                ('numero', models.CharField(max_length=200)),
                ('data_criacao', models.DateTimeField(auto_now_add=True)),
                ('cliente', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='core.Cliente')),
                ('pedido', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='core.Pedido')),
            ],
        ),
    ]
