<reponame>shumwe/rental-house-management-system
# Generated by Django 4.0.2 on 2022-02-20 10:27

import datetime
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import rental_property.models


class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='Building',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100)),
                ('slug', models.SlugField(max_length=100, unique=True)),
                ('registered_owner', models.CharField(max_length=50)),
                ('address_line', models.CharField(max_length=50)),
                ('country', models.CharField(default='Kenya', max_length=50)),
                ('building_status', models.CharField(choices=[('op', 'Operational'), ('um', 'Under Maintanance'), ('fo', 'Fully Occupied'), ('dc', 'Decomisioned')], max_length=5)),
                ('added', models.DateTimeField(default=datetime.datetime.now)),
                ('updated', models.DateTimeField(auto_now=True)),
                ('added_by', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='Counties',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=30, unique=True)),
                ('slug', models.SlugField(max_length=30, unique=True)),
                ('created', models.DateTimeField(default=datetime.datetime.now)),
                ('updated', models.DateTimeField(auto_now=True)),
            ],
            options={
                'verbose_name_plural': 'Counties',
                'ordering': ('name',),
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='RentalUnit',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('unit_number', models.CharField(max_length=50)),
                ('slug', models.SlugField(blank=True, help_text='This field is autogenerated', null=True, unique=True)),
                ('bathrooms', models.PositiveIntegerField()),
                ('bedrooms', models.PositiveIntegerField()),
                ('dimension', models.CharField(max_length=50)),
                ('kitchen', models.BooleanField(default=True)),
                ('status', models.CharField(choices=[('occupied', 'Currently Occupied'), ('ready', 'Ready To Move In'), ('hold', 'On Hold'), ('maintanance', 'Under Maintanance')], max_length=20)),
                ('maintanance_status', models.CharField(choices=[('nm', 'Needs Inspection'), ('ip', 'Inspection In Progress'), ('op', 'No Active Reports')], default='op', max_length=6)),
                ('total_occupants', models.PositiveIntegerField(blank=True, help_text='Number of people in the unit', null=True)),
                ('water_available', models.BooleanField(default=True)),
                ('electricity_available', models.BooleanField(default=True)),
                ('added', models.DateTimeField(default=datetime.datetime.now)),
                ('updated', models.DateTimeField(auto_now=True)),
                ('added_by', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
                ('building', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='rental_property.building')),
            ],
        ),
        migrations.CreateModel(
            name='UnitType',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=55)),
                ('slug', models.SlugField(max_length=55, unique=True)),
                ('added', models.DateTimeField(default=datetime.datetime.now)),
                ('updated', models.DateTimeField(auto_now=True)),
                ('added_by', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name_plural': 'Available Unit Types',
                'ordering': ('name',),
            },
        ),
        migrations.CreateModel(
            name='UnitAlbum',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('image', models.ImageField(height_field='image_height', upload_to=rental_property.models.get_house_album_path, width_field='image_width')),
                ('image_width', models.IntegerField(default=600)),
                ('image_height', models.IntegerField(default=500)),
                ('unit', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='rental_property.rentalunit')),
            ],
        ),
        migrations.AddField(
            model_name='rentalunit',
            name='unit_type',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='rental_property.unittype'),
        ),
        migrations.CreateModel(
            name='Estate',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=55)),
                ('slug', models.SlugField(max_length=100, unique=True)),
                ('registered_owner', models.CharField(max_length=50)),
                ('registered_country', models.CharField(default='Kenya', max_length=50)),
                ('added', models.DateTimeField(default=datetime.datetime.now)),
                ('updated', models.DateTimeField(auto_now=True)),
                ('added_by', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': 'Estate',
                'verbose_name_plural': 'Estates',
                'ordering': ('name',),
            },
        ),
        migrations.AddField(
            model_name='building',
            name='county',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='rental_property.counties'),
        ),
        migrations.AddField(
            model_name='building',
            name='estate',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='rental_property.estate'),
        ),
        migrations.AddField(
            model_name='building',
            name='manager',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='building_manager', to='accounts.managers'),
        ),
        migrations.AlterUniqueTogether(
            name='rentalunit',
            unique_together={('building', 'unit_number')},
        ),
    ]
