# Generated by Django 2.1.3 on 2019-03-06 14:34

from django.conf import settings
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import education.models


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('file_app', '0001_initial'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='AbstractDiscount',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False)),
                ('uuid', models.UUIDField(blank=True, db_index=True, null=True, unique=True)),
                ('percent', models.IntegerField(default=0, validators=[django.core.validators.MaxValueValidator(100), django.core.validators.MinValueValidator(1)])),
                ('used', models.BooleanField(default=False)),
            ],
        ),
        migrations.CreateModel(
            name='AbstractInvoice',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('uuid', models.UUIDField(blank=True, db_index=True, null=True, unique=True)),
                ('amount_to_pay', models.DecimalField(decimal_places=3, max_digits=10)),
                ('index', models.IntegerField(default=1)),
                ('due_date', models.DateField(help_text='The day that user must pay.')),
                ('payed_or_not', models.BooleanField(default=False)),
            ],
        ),
        migrations.CreateModel(
            name='AbstractPayment',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('uuid', models.UUIDField(blank=True, db_index=True, null=True, unique=True)),
                ('pending', models.BooleanField(default=True)),
            ],
        ),
        migrations.CreateModel(
            name='CostUnit',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False)),
                ('unit_id', models.PositiveSmallIntegerField(choices=[(1, 'Rial'), (2, 'Dollor'), (3, 'Euro')], default=1)),
            ],
        ),
        migrations.CreateModel(
            name='Course',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False)),
                ('uuid', models.UUIDField(blank=True, db_index=True, null=True, unique=True)),
                ('title', models.CharField(blank=True, max_length=511, null=True)),
                ('rate', models.IntegerField(default=0, validators=[django.core.validators.MaxValueValidator(100), django.core.validators.MinValueValidator(1)])),
                ('rate_numbers', models.IntegerField(default=0)),
                ('online', models.BooleanField(default=False)),
                ('timestamp', models.DateTimeField(auto_now_add=True)),
                ('prepayment', models.BooleanField(default=False)),
                ('prepayment_percent', models.IntegerField(default=0, validators=[django.core.validators.MaxValueValidator(100), django.core.validators.MinValueValidator(1)])),
            ],
            options={
                'verbose_name': 'Course',
                'verbose_name_plural': 'Courses',
                'db_table': 'education_course',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='CourseBody',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False)),
                ('description', models.TextField(blank=True, null=True)),
            ],
        ),
        migrations.CreateModel(
            name='DiscountType',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False)),
                ('type_id', models.PositiveSmallIntegerField(choices=[(1, 'RaceDiscount'), (2, 'DateDiscount'), (3, 'PersonalDiscount')], default=1)),
            ],
        ),
        migrations.CreateModel(
            name='Price',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False)),
                ('uuid', models.UUIDField(blank=True, db_index=True, null=True, unique=True)),
                ('online', models.BooleanField(default=True)),
                ('cost', models.DecimalField(decimal_places=3, max_digits=10)),
                ('unit', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='education.CostUnit')),
            ],
        ),
        migrations.CreateModel(
            name='WorkshopFile',
            fields=[
                ('file_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='file_app.File')),
                ('file', models.FileField(upload_to=education.models.workshop_file_directory_path)),
            ],
            bases=('file_app.file',),
        ),
        migrations.CreateModel(
            name='WorkshopRates',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('uuid', models.UUIDField(blank=True, db_index=True, null=True, unique=True)),
                ('rate', models.IntegerField(default=0, validators=[django.core.validators.MaxValueValidator(100), django.core.validators.MinValueValidator(1)])),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='user_rate', to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='Workshop',
            fields=[
                ('course_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='education.Course')),
                ('city', models.CharField(max_length=255)),
                ('start_date', models.DateField(help_text='Start Day of the Workshop')),
                ('end_date', models.DateField(blank=True, help_text='End Day of the Workshop', null=True)),
                ('start_time', models.TimeField(help_text='Start Time of the Workshop')),
                ('end_time', models.TimeField(blank=True, help_text='End Time of the Workshop', null=True)),
            ],
            bases=('education.course',),
        ),
        migrations.CreateModel(
            name='WorkshopDiscount',
            fields=[
                ('abstractdiscount_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='education.AbstractDiscount')),
            ],
            bases=('education.abstractdiscount',),
        ),
        migrations.CreateModel(
            name='WorkshopInvoice',
            fields=[
                ('abstractinvoice_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='education.AbstractInvoice')),
            ],
            bases=('education.abstractinvoice',),
        ),
        migrations.CreateModel(
            name='WorkshopPayment',
            fields=[
                ('abstractpayment_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='education.AbstractPayment')),
                ('workshop', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='education.Workshop')),
            ],
            bases=('education.abstractpayment',),
        ),
        migrations.AddField(
            model_name='course',
            name='body',
            field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='education.CourseBody'),
        ),
        migrations.AddField(
            model_name='course',
            name='buyers',
            field=models.ManyToManyField(blank=True, to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='course',
            name='instructor',
            field=models.ForeignKey(blank=True, null=True, on_delete=models.SET(education.models.get_sentinel_user), related_name='course_instructor', to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='course',
            name='price',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='education.Price'),
        ),
        migrations.AddField(
            model_name='abstractpayment',
            name='discount_type',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='education.DiscountType'),
        ),
        migrations.AddField(
            model_name='abstractpayment',
            name='user',
            field=models.ForeignKey(on_delete=models.SET(education.models.get_sentinel_user), to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='abstractinvoice',
            name='created_by',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL),
        ),
        migrations.CreateModel(
            name='WorkshopDateDiscount',
            fields=[
                ('workshopdiscount_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='education.WorkshopDiscount')),
                ('start_date', models.DateField(help_text='Start Day of the Discount')),
                ('end_date', models.DateField(blank=True, help_text='End Day of the Discount', null=True)),
            ],
            bases=('education.workshopdiscount',),
        ),
        migrations.CreateModel(
            name='WorkshopPersonalDiscount',
            fields=[
                ('workshopdiscount_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='education.WorkshopDiscount')),
                ('coupon_text', models.CharField(max_length=15)),
                ('start_date', models.DateField(blank=True, help_text='Start Day of the Discount', null=True)),
                ('end_date', models.DateField(blank=True, help_text='End Day of the Discount', null=True)),
                ('person', models.ForeignKey(on_delete=models.SET(education.models.get_sentinel_user), to=settings.AUTH_USER_MODEL)),
            ],
            bases=('education.workshopdiscount',),
        ),
        migrations.CreateModel(
            name='WorkshopRaceDiscount',
            fields=[
                ('workshopdiscount_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='education.WorkshopDiscount')),
                ('coupon_text', models.CharField(blank=True, max_length=15, null=True)),
                ('limit', models.IntegerField(default=0, validators=[django.core.validators.MaxValueValidator(100), django.core.validators.MinValueValidator(0)])),
            ],
            bases=('education.workshopdiscount',),
        ),
        migrations.AddField(
            model_name='workshoprates',
            name='workshop',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='course_user_rate', to='education.Workshop'),
        ),
        migrations.AddField(
            model_name='workshopinvoice',
            name='payment',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='invoice', to='education.WorkshopPayment'),
        ),
        migrations.AddField(
            model_name='workshopfile',
            name='workshop',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='workshop_files', to='education.Workshop'),
        ),
        migrations.AddField(
            model_name='workshopdiscount',
            name='workshops',
            field=models.ManyToManyField(blank=True, to='education.Workshop'),
        ),
    ]
