# Generated by Django 3.2 on 2021-05-31 18:25

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='Cidade',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('ativo', models.BooleanField(default=True)),
                ('data_criou', models.DateTimeField(auto_now_add=True)),
                ('data_editou', models.DateTimeField(auto_now=True)),
                ('usuario_modificou', models.IntegerField(blank=True, null=True)),
                ('cidade', models.CharField(max_length=100, unique=True)),
                ('ddd', models.CharField(max_length=3)),
                ('sigla', models.CharField(max_length=5)),
                ('codigo_municipio', models.IntegerField(default=0, help_text='Necessário para emitir NFS-e.', verbose_name='Código Municipio (IBGE)')),
            ],
            options={
                'verbose_name_plural': 'Cidades',
            },
        ),
        migrations.CreateModel(
            name='Imovel',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('ativo', models.BooleanField(default=True)),
                ('data_criou', models.DateTimeField(auto_now_add=True)),
                ('data_editou', models.DateTimeField(auto_now=True)),
                ('usuario_modificou', models.IntegerField(blank=True, null=True)),
                ('imovel', models.CharField(max_length=100, unique=True)),
                ('cep', models.CharField(max_length=10)),
                ('numero', models.CharField(max_length=100)),
                ('rua', models.CharField(max_length=100)),
                ('bairro', models.CharField(max_length=100)),
                ('complemento', models.CharField(max_length=100)),
            ],
            options={
                'verbose_name_plural': 'Imóveis',
            },
        ),
        migrations.CreateModel(
            name='Obra',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('ativo', models.BooleanField(default=True)),
                ('data_criou', models.DateTimeField(auto_now_add=True)),
                ('data_editou', models.DateTimeField(auto_now=True)),
                ('usuario_modificou', models.IntegerField(blank=True, null=True)),
                ('obra', models.CharField(max_length=100, unique=True)),
                ('status_obra', models.CharField(choices=[('Fut', 'Obra Futura'), ('Exe', 'Em execução'), ('Fin', 'Finalizada'), ('Par', 'Paralizada')], max_length=10)),
                ('imovel', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='bases.imovel')),
            ],
            options={
                'verbose_name_plural': 'Obras',
            },
        ),
        migrations.CreateModel(
            name='TipoObra',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('ativo', models.BooleanField(default=True)),
                ('data_criou', models.DateTimeField(auto_now_add=True)),
                ('data_editou', models.DateTimeField(auto_now=True)),
                ('usuario_modificou', models.IntegerField(blank=True, null=True)),
                ('tipo_obra', models.CharField(max_length=100, unique=True)),
                ('usuario_criou', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name_plural': 'Tipos de Obra',
            },
        ),
        migrations.CreateModel(
            name='Projeto',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('ativo', models.BooleanField(default=True)),
                ('data_criou', models.DateTimeField(auto_now_add=True)),
                ('data_editou', models.DateTimeField(auto_now=True)),
                ('usuario_modificou', models.IntegerField(blank=True, null=True)),
                ('projeto', models.CharField(max_length=100, unique=True)),
                ('obra', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='bases.obra')),
                ('usuario_criou', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name_plural': 'Obras',
            },
        ),
        migrations.CreateModel(
            name='Pais',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('ativo', models.BooleanField(default=True)),
                ('data_criou', models.DateTimeField(auto_now_add=True)),
                ('data_editou', models.DateTimeField(auto_now=True)),
                ('usuario_modificou', models.IntegerField(blank=True, null=True)),
                ('pais', models.CharField(max_length=100, unique=True)),
                ('ddi', models.CharField(max_length=4)),
                ('sigla', models.CharField(max_length=5)),
                ('usuario_criou', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name_plural': 'Paises',
            },
        ),
        migrations.CreateModel(
            name='OrgaoPublico',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('ativo', models.BooleanField(default=True)),
                ('data_criou', models.DateTimeField(auto_now_add=True)),
                ('data_editou', models.DateTimeField(auto_now=True)),
                ('usuario_modificou', models.IntegerField(blank=True, null=True)),
                ('orgao_publico', models.CharField(max_length=100, unique=True)),
                ('cidade', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='bases.cidade')),
                ('usuario_criou', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name_plural': 'Órgãos Públicos',
            },
        ),
        migrations.CreateModel(
            name='ObraAnexo',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('arquivo', models.FileField(blank=True, null=True, upload_to='arquivos_de_projeto')),
                ('obra', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='bases.obra')),
            ],
        ),
        migrations.AddField(
            model_name='obra',
            name='tipo_obra',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='bases.tipoobra'),
        ),
        migrations.AddField(
            model_name='obra',
            name='usuario_criou',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='imovel',
            name='orgao_publico',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='bases.orgaopublico'),
        ),
        migrations.AddField(
            model_name='imovel',
            name='usuario_criou',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
        ),
        migrations.CreateModel(
            name='Estado',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('ativo', models.BooleanField(default=True)),
                ('data_criou', models.DateTimeField(auto_now_add=True)),
                ('data_editou', models.DateTimeField(auto_now=True)),
                ('usuario_modificou', models.IntegerField(blank=True, null=True)),
                ('estado', models.CharField(max_length=100, unique=True)),
                ('uf', models.CharField(max_length=2)),
                ('pais', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='bases.pais')),
                ('usuario_criou', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name_plural': 'Estados',
            },
        ),
        migrations.AddField(
            model_name='cidade',
            name='estado',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='bases.estado'),
        ),
        migrations.AddField(
            model_name='cidade',
            name='usuario_criou',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
        ),
        migrations.CreateModel(
            name='Arquivo',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('ativo', models.BooleanField(default=True)),
                ('data_criou', models.DateTimeField(auto_now_add=True)),
                ('data_editou', models.DateTimeField(auto_now=True)),
                ('usuario_modificou', models.IntegerField(blank=True, null=True)),
                ('titulo', models.CharField(max_length=100)),
                ('arquivo', models.FileField(upload_to='arquivos_de_projeto/')),
                ('projeto', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='bases.projeto')),
                ('usuario_criou', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name_plural': 'Arquivos',
            },
        ),
    ]
