# -*- coding: utf-8 -*-
# Generated by Django 1.11.7 on 2017-11-18 22:21
from __future__ import unicode_literals

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='Broker',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100)),
            ],
        ),
        migrations.CreateModel(
            name='Company',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100)),
                ('symbol', models.CharField(max_length=4)),
                ('cnpj', models.CharField(max_length=19)),
                ('activity', models.CharField(max_length=300)),
                ('market_value', models.CharField(blank=True, max_length=100, null=True)),
                ('ev', models.CharField(blank=True, max_length=100, null=True)),
                ('bookkeeper', models.CharField(max_length=100)),
                ('majority_shareholder', models.CharField(max_length=100)),
                ('site', models.URLField()),
                ('headquarters', models.CharField(max_length=150)),
                ('bovespa_page', models.URLField()),
                ('shareholders', models.PositiveIntegerField()),
                ('category', models.CharField(choices=[('AL', 'Alerta'), ('NC', 'Não Classificada'), ('EQ', 'Equilibrada'), ('CL', 'Cíclica')], max_length=2)),
                ('ibov', models.BooleanField(default=False)),
                ('next_balance', models.DateField(blank=True, null=True)),
            ],
            options={
                'verbose_name_plural': 'Companies',
            },
        ),
        migrations.CreateModel(
            name='CompanySector',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100)),
            ],
        ),
        migrations.CreateModel(
            name='CompanySegment',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100)),
            ],
        ),
        migrations.CreateModel(
            name='CompanySubSector',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100)),
            ],
        ),
        migrations.CreateModel(
            name='FixedIncome',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('product_type', models.CharField(max_length=50)),
                ('signer', models.CharField(max_length=100)),
                ('start_date', models.DateField()),
                ('due_date', models.DateField()),
                ('validity_date', models.DateField()),
                ('tax', models.CharField(max_length=50)),
                ('available_amount', models.DecimalField(blank=True, decimal_places=2, max_digits=50, null=True)),
                ('guarantee', models.DecimalField(blank=True, decimal_places=2, max_digits=50, null=True)),
                ('start_amount', models.DecimalField(blank=True, decimal_places=2, max_digits=50, null=True)),
                ('position', models.DecimalField(blank=True, decimal_places=2, max_digits=50, null=True)),
            ],
        ),
        migrations.CreateModel(
            name='InvestmentFund',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('ativo', models.CharField(max_length=100, unique=True)),
                ('quota_date', models.DateField()),
                ('quota_value', models.DecimalField(blank=True, decimal_places=8, max_digits=50, null=True)),
                ('quote_amount', models.DecimalField(blank=True, decimal_places=8, max_digits=50, null=True)),
                ('position', models.DecimalField(blank=True, decimal_places=2, max_digits=50, null=True)),
                ('net_value', models.DecimalField(blank=True, decimal_places=2, max_digits=50, null=True)),
                ('fund_type', models.CharField(choices=[('RF', 'Renda Fixa'), ('MM', 'Multimercado'), ('FI', 'Fundo Imobiliário')], max_length=2)),
            ],
        ),
        migrations.CreateModel(
            name='ListingSegment',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100)),
            ],
        ),
        migrations.CreateModel(
            name='Loan',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('loan_name', models.CharField(max_length=100)),
                ('description', models.TextField(blank=True, null=True)),
                ('date', models.DateField()),
                ('value', models.DecimalField(blank=True, decimal_places=2, max_digits=50, null=True)),
                ('person', models.CharField(max_length=150)),
            ],
        ),
        migrations.CreateModel(
            name='Stock',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('symbol', models.CharField(max_length=8)),
                ('stock_type', models.CharField(choices=[('ON', 'Ordinary'), ('PN', 'Preffered')], max_length=2)),
                ('description', models.TextField(blank=True, null=True)),
            ],
        ),
        migrations.CreateModel(
            name='StockProfile',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100)),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='Transaction',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('operation_type', models.CharField(blank=True, choices=[('BUY', 'Buy'), ('SEL', 'Sell'), ('DIV', 'Dividends'), ('SPL', 'Split'), ('AGR', 'Aggregation')], max_length=3, null=True)),
                ('operation_date', models.DateField()),
                ('shares', models.PositiveIntegerField()),
                ('price', models.DecimalField(decimal_places=9, max_digits=15)),
                ('commission', models.DecimalField(decimal_places=2, max_digits=6)),
                ('notes', models.TextField(blank=True, null=True)),
                ('broker', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='investments.Broker')),
                ('profile', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='investments.StockProfile')),
                ('stock', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='investments.Stock')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.AddField(
            model_name='company',
            name='listing_segment',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='investments.ListingSegment'),
        ),
        migrations.AddField(
            model_name='company',
            name='market_segment',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='investments.CompanySegment'),
        ),
        migrations.AddField(
            model_name='company',
            name='sector',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='investments.CompanySector'),
        ),
        migrations.AddField(
            model_name='company',
            name='stocks',
            field=models.ManyToManyField(to='investments.Stock'),
        ),
        migrations.AddField(
            model_name='company',
            name='subsector',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='investments.CompanySubSector'),
        ),
    ]
