# Generated by Django 3.0.7 on 2021-01-27 13:51

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='Book',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(max_length=600)),
                ('author', models.CharField(blank=True, max_length=800, null=True)),
                ('suply', models.CharField(blank=True, max_length=800, null=True)),
                ('edition', models.CharField(blank=True, max_length=50, null=True)),
                ('year_of_publication', models.PositiveIntegerField(blank=True, null=True)),
                ('price_foreign_currency', models.FloatField(blank=True, null=True)),
                ('price_indian_currency', models.FloatField(blank=True, null=True)),
                ('ISBN', models.CharField(blank=True, max_length=200, null=True)),
                ('stock', models.PositiveIntegerField(default=1, validators=[django.core.validators.MinValueValidator(0)])),
                ('discount', models.PositiveSmallIntegerField(default=0, validators=[django.core.validators.MaxValueValidator(100), django.core.validators.MinValueValidator(0)])),
                ('expected_price', models.FloatField(validators=[django.core.validators.MinValueValidator(0)])),
                ('description', models.CharField(blank=True, max_length=2000)),
                ('subject', models.CharField(blank=True, max_length=200, null=True)),
                ('image', models.URLField(blank=True, null=True)),
                ('thumbnail', models.URLField(blank=True, null=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('visible', models.BooleanField(default=True)),
                ('expired', models.BooleanField(default=False)),
            ],
        ),
        migrations.CreateModel(
            name='Buyer',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100)),
                ('contact_no', phonenumber_field.modelfields.PhoneNumberField(blank=True, max_length=128, null=True, region=None, unique=True)),
                ('PSRN', models.CharField(blank=True, max_length=2000, null=True, unique=True)),
                ('email', models.EmailField(max_length=254)),
                ('is_professor', models.BooleanField(default=False)),
                ('is_complete', models.BooleanField(default=False)),
                ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='buyer_profile', to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='Publisher',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100)),
                ('contact_no', phonenumber_field.modelfields.PhoneNumberField(blank=True, max_length=128, null=True, region=None, unique=True)),
                ('address', models.TextField(blank=True, max_length=2000, null=True)),
                ('email', models.EmailField(max_length=254)),
                ('logo', models.ImageField(blank=True, null=True, upload_to='publisher_logos')),
                ('is_complete', models.BooleanField(default=False)),
                ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='publisher_profile', to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='Order',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('recommended_to_library', models.BooleanField(default=False)),
                ('is_ordered', models.BooleanField(default=False)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('book', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='orders', to='BookFest.Book')),
                ('buyer', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='orders', to='BookFest.Buyer')),
                ('seller', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='orders', to='BookFest.Publisher')),
            ],
        ),
        migrations.AddField(
            model_name='book',
            name='publisher',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='books', to='BookFest.Publisher'),
        ),
    ]
