# Generated by Django 3.1 on 2020-09-02 20:25

import datetime
from django.conf import settings
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import listings.models
import smart_selects.db_fields


class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='Destrict',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=80)),
            ],
        ),
        migrations.CreateModel(
            name='Fav',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('added_at', models.DateTimeField(auto_now_add=True)),
            ],
        ),
        migrations.CreateModel(
            name='Governorate',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=30)),
            ],
        ),
        migrations.CreateModel(
            name='Listing',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('prop_status', models.IntegerField(choices=[(1, 'For Rent'), (2, 'For Sale'), (3, 'For Timeshare')])),
                ('prop_type', models.IntegerField(choices=[(1, 'Apartment'), (2, 'Chalet'), (3, 'House'), (4, 'Studio'), (5, 'Villa')])),
                ('price', models.DecimalField(decimal_places=0, max_digits=9, validators=[django.core.validators.MinValueValidator(1, 'Price must be greater than 0')])),
                ('number_of_bedrooms', models.PositiveSmallIntegerField()),
                ('number_of_baths', models.PositiveSmallIntegerField()),
                ('square_metre', models.PositiveSmallIntegerField()),
                ('date_created', models.DateTimeField(auto_now_add=True)),
                ('date_modified', models.DateTimeField(auto_now=True)),
                ('destrict', smart_selects.db_fields.ChainedForeignKey(auto_choose=True, chained_field='governorate', chained_model_field='governorate', on_delete=django.db.models.deletion.CASCADE, to='listings.destrict')),
                ('favorites', models.ManyToManyField(blank=True, related_name='favorite_listings', through='listings.Fav', to=settings.AUTH_USER_MODEL)),
                ('governorate', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='listings.governorate')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='listings', to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='Propty',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('finish_type', models.IntegerField(choices=[(1, 'Unfinished'), (2, 'Semi Finished'), (3, 'Fully Finished'), (4, 'Lux'), (5, 'Super Lux'), (6, 'Ultra Lux'), (7, 'Deluxe')], null=True)),
                ('payment_method', models.IntegerField(choices=[(1, 'Cash'), (2, 'Installments')], null=True)),
                ('view', models.IntegerField(choices=[(1, 'Corner'), (2, 'Water'), (3, 'Main Street'), (4, 'Side Street'), (5, 'Garden'), (6, 'Yard')], null=True)),
                ('storeys', models.IntegerField(choices=[(1, 'Single'), (2, 'Duplex'), (3, 'Triplex')], null=True)),
                ('flooring', models.IntegerField(choices=[(1, 'Marble'), (2, 'Hardwood'), (3, 'Ceramic Tile'), (4, 'Stone'), (5, 'Parquet'), (6, 'Softwood'), (7, 'Non Ceramic Tile'), (8, 'Laminate'), (9, 'Linoleum')], null=True)),
                ('address', models.CharField(blank=True, max_length=100)),
                ('level', models.PositiveSmallIntegerField(null=True)),
                ('number_of_balconies', models.PositiveSmallIntegerField(null=True)),
                ('year_built', models.IntegerField(null=True, validators=[django.core.validators.MinValueValidator(1900), listings.models.max_value_current_year])),
                ('available_on', models.DateField(default=datetime.date.today, null=True)),
                ('description', models.TextField(blank=True, validators=[django.core.validators.MinLengthValidator(100, 'ad must be greater than 99 characters')])),
                ('has_garage_parking', models.BooleanField(null=True)),
                ('has_central_air_conditioning', models.BooleanField(null=True)),
                ('has_wall_air_conditioning', models.BooleanField(null=True)),
                ('has_security_system', models.BooleanField(null=True)),
                ('has_elevator', models.BooleanField(null=True)),
                ('in_compound', models.BooleanField(null=True)),
                ('has_intercom_system', models.BooleanField(null=True)),
                ('has_bool', models.BooleanField(null=True)),
                ('is_furnished', models.BooleanField(null=True)),
                ('listing', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='propty', to='listings.listing')),
            ],
        ),
        migrations.CreateModel(
            name='Picture',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('description', models.CharField(max_length=20, validators=[django.core.validators.MinLengthValidator(6, 'description must be greater than 5 characters')])),
                ('picture', models.ImageField(upload_to='uploads/%Y/%m/%d', validators=[django.core.validators.validate_image_file_extension])),
                ('listing', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='pictures', to='listings.listing')),
            ],
        ),
        migrations.AddField(
            model_name='fav',
            name='listing',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='listings.listing'),
        ),
        migrations.AddField(
            model_name='fav',
            name='user',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='destrict',
            name='governorate',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='destricts', to='listings.governorate'),
        ),
        migrations.AlterUniqueTogether(
            name='fav',
            unique_together={('listing', 'user')},
        ),
    ]
