# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-04-18 05:32
from __future__ import unicode_literals

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


class Migration(migrations.Migration):

    dependencies = [
        ('venda', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='Fornecedor',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('cnpj', models.CharField(max_length=20, validators=[django.core.validators.RegexValidator('\\d{2}\\.\\d{3}\\.\\d{3}\\/\\d{4}\\-\\d{2}')])),
                ('nome', models.CharField(max_length=30)),
                ('endereco', models.CharField(max_length=35)),
                ('complemento', models.CharField(max_length=50)),
                ('cidade', models.CharField(max_length=25)),
                ('estado', models.CharField(max_length=2)),
                ('cep', models.CharField(max_length=8)),
                ('fone', models.CharField(max_length=9, validators=[django.core.validators.RegexValidator('^\\d{4}-\\d{4}$')])),
                ('responsavel', models.CharField(max_length=30)),
                ('website', models.URLField()),
            ],
        ),
        migrations.CreateModel(
            name='ItemPedido',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('preco_unitario', models.DecimalField(decimal_places=2, max_digits=10)),
                ('quantidade', models.IntegerField()),
            ],
        ),
        migrations.CreateModel(
            name='ItemVenda',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('preco_unitario', models.DecimalField(decimal_places=2, max_digits=10)),
                ('quantidade', models.IntegerField()),
            ],
        ),
        migrations.CreateModel(
            name='Pedido',
            fields=[
                ('codigo', models.IntegerField(primary_key=True, serialize=False)),
                ('data_pedido', models.DateField(auto_now_add=True)),
                ('data_recebimento', models.DateField(auto_now_add=True)),
                ('preco_total', models.DecimalField(decimal_places=2, max_digits=10)),
                ('codigo_fornecedor', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='pedidos', to='venda.Fornecedor')),
            ],
        ),
        migrations.CreateModel(
            name='Produto',
            fields=[
                ('codigo_produto', models.IntegerField(primary_key=True, serialize=False)),
                ('nome_produto', models.CharField(max_length=35)),
                ('quantidade', models.IntegerField()),
                ('min_quantidade', models.DecimalField(decimal_places=2, max_digits=10)),
            ],
        ),
        migrations.CreateModel(
            name='Venda',
            fields=[
                ('codigo_venda', models.IntegerField(primary_key=True, serialize=False)),
                ('data_venda', models.DateField(auto_now_add=True)),
                ('valor_total', models.DecimalField(decimal_places=2, max_digits=10)),
            ],
        ),
        migrations.AlterField(
            model_name='cliente',
            name='cep',
            field=models.CharField(max_length=10, validators=[django.core.validators.RegexValidator('^\\d{5}-\\d{4}$')]),
        ),
        migrations.AlterField(
            model_name='cliente',
            name='cpf',
            field=models.CharField(max_length=14, validators=[django.core.validators.RegexValidator('^\\d{3}\\.\\d{3}\\.\\d{3}-\\d{2}$')]),
        ),
        migrations.AlterField(
            model_name='cliente',
            name='email',
            field=models.EmailField(max_length=50),
        ),
        migrations.AlterField(
            model_name='cliente',
            name='fone_residencial',
            field=models.CharField(max_length=9, validators=[django.core.validators.RegexValidator('^\\d{4}-\\d{4}$')]),
        ),
        migrations.AlterField(
            model_name='cliente',
            name='fone_trabalho',
            field=models.CharField(max_length=9, validators=[django.core.validators.RegexValidator('^\\d{4}-\\d{4}$')]),
        ),
        migrations.AlterField(
            model_name='cliente',
            name='renda_familiar',
            field=models.DecimalField(decimal_places=2, max_digits=10),
        ),
        migrations.AddField(
            model_name='venda',
            name='codigo_cliente',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='vendas', to='venda.Cliente'),
        ),
        migrations.AddField(
            model_name='itemvenda',
            name='codigo_produto',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='produto_venda', to='venda.Produto'),
        ),
        migrations.AddField(
            model_name='itemvenda',
            name='codigo_venda',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='itens_venda', to='venda.Venda'),
        ),
        migrations.AddField(
            model_name='itempedido',
            name='codigo_pedido',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='itens', to='venda.Pedido'),
        ),
        migrations.AddField(
            model_name='itempedido',
            name='codigo_produto',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='itens_produto', to='venda.Produto'),
        ),
    ]
