# Generated by Django 3.0.6 on 2020-05-22 15: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='Client',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('patronymic', models.CharField(max_length=50)),
                ('phone', models.CharField(max_length=14)),
            ],
        ),
        migrations.CreateModel(
            name='Company',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=50)),
                ('sphere', models.CharField(max_length=50)),
                ('company_type', models.CharField(choices=[('1', 'IP'), ('2', 'OOO')], default='2', max_length=1)),
            ],
        ),
        migrations.CreateModel(
            name='Employee',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('patronymic', models.CharField(max_length=50)),
                ('position', models.CharField(choices=[('1', 'Supervisor'), ('2', 'Executor')], default='2', max_length=1)),
                ('phone', models.CharField(max_length=14)),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='Product',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=50)),
                ('desc', models.CharField(max_length=1000)),
                ('thematic', models.CharField(max_length=50)),
                ('company', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='marketing.Company')),
            ],
        ),
        migrations.CreateModel(
            name='Request',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('target', models.CharField(max_length=250)),
                ('state', models.CharField(choices=[('1', 'Complete'), ('2', 'Not complete')], default='2', max_length=1)),
                ('materials', models.CharField(max_length=500)),
                ('date', models.DateField()),
                ('client', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='marketing.Client')),
                ('executor', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='marketing.Employee')),
                ('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='marketing.Product')),
            ],
        ),
        migrations.CreateModel(
            name='Service',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=50)),
                ('price', models.IntegerField()),
            ],
        ),
        migrations.CreateModel(
            name='ServiceForRequest',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('request', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='marketing.Request')),
                ('service', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='marketing.Service')),
            ],
        ),
        migrations.CreateModel(
            name='Payment',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('amount', models.IntegerField()),
                ('target', models.CharField(max_length=50)),
                ('billing_date', models.DateField()),
                ('payment_date', models.DateField()),
                ('state', models.CharField(choices=[('1', 'Paid'), ('2', 'Not paid')], default='2', max_length=1)),
                ('request', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='marketing.Request')),
            ],
        ),
        migrations.AddField(
            model_name='client',
            name='company',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='marketing.Company'),
        ),
        migrations.AddField(
            model_name='client',
            name='user',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
        ),
    ]
