# Generated by Django 4.2.24 on 2025-09-16 18:51

import django.contrib.postgres.indexes
from django.db import migrations, models
import django.db.models.deletion
import uuid


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Developer',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('developer_number', models.CharField(db_index=True, max_length=20, unique=True)),
                ('developer_name_en', models.CharField(max_length=255)),
            ],
            options={
                'db_table': 'developers',
            },
        ),
        migrations.CreateModel(
            name='Project',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('project_number', models.CharField(db_index=True, max_length=20, unique=True)),
                ('project_name_en', models.CharField(max_length=255)),
                ('start_date', models.DateTimeField()),
                ('end_date', models.DateTimeField(blank=True, null=True)),
                ('adoption_date', models.DateTimeField(blank=True, null=True)),
                ('project_type', models.CharField(choices=[('Normal', 'Normal'), ('Escrow', 'Escrow')], max_length=50)),
                ('project_value', models.DecimalField(blank=True, decimal_places=2, max_digits=15, null=True)),
                ('escrow_account_number', models.CharField(blank=True, max_length=50)),
                ('project_status', models.CharField(choices=[('ACTIVE', 'Active'), ('PENDING', 'Pending'), ('CANCELLED', 'Cancelled'), ('COMPLETED', 'Completed')], max_length=20)),
                ('percent_completed', models.DecimalField(blank=True, decimal_places=2, max_digits=5, null=True)),
                ('inspection_date', models.DateTimeField(blank=True, null=True)),
                ('completion_date', models.DateTimeField(blank=True, null=True)),
                ('description_en', models.TextField(blank=True)),
                ('area_en', models.CharField(max_length=100)),
                ('zone_en', models.CharField(max_length=100)),
                ('count_land', models.IntegerField(default=0)),
                ('count_building', models.IntegerField(default=0)),
                ('count_villa', models.IntegerField(default=0)),
                ('count_unit', models.IntegerField(default=0)),
                ('master_project_en', models.CharField(blank=True, max_length=255)),
                ('developer', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='projects', to='analytics.developer')),
            ],
            options={
                'db_table': 'projects',
            },
        ),
        migrations.CreateModel(
            name='Valuation',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('property_total_value', models.DecimalField(decimal_places=2, max_digits=15)),
                ('area_en', models.CharField(max_length=100)),
                ('actual_area', models.DecimalField(decimal_places=2, max_digits=10)),
                ('procedure_year', models.IntegerField()),
                ('procedure_number', models.CharField(max_length=20)),
                ('instance_date', models.DateTimeField()),
                ('actual_worth', models.DecimalField(decimal_places=2, max_digits=15)),
                ('procedure_area', models.DecimalField(decimal_places=2, max_digits=10)),
                ('property_type', models.CharField(choices=[('Unit', 'Unit'), ('Villa', 'Villa'), ('Land', 'Land'), ('Building', 'Building')], max_length=50)),
                ('property_sub_type', models.CharField(max_length=50)),
            ],
            options={
                'db_table': 'valuations',
                'indexes': [django.contrib.postgres.indexes.BTreeIndex(fields=['area_en'], name='valuations_area_en_ed1677_btree'), django.contrib.postgres.indexes.BTreeIndex(fields=['property_type'], name='valuations_propert_180e4b_btree'), django.contrib.postgres.indexes.BTreeIndex(fields=['procedure_year'], name='valuations_procedu_3bf0d9_btree'), django.contrib.postgres.indexes.BTreeIndex(fields=['instance_date'], name='valuations_instanc_68649f_btree'), django.contrib.postgres.indexes.BTreeIndex(fields=['property_total_value'], name='valuations_propert_e9ba02_btree')],
            },
        ),
        migrations.CreateModel(
            name='MarketTrend',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('area_en', models.CharField(max_length=100)),
                ('property_type', models.CharField(max_length=50)),
                ('period_start', models.DateTimeField()),
                ('period_end', models.DateTimeField()),
                ('average_price', models.DecimalField(decimal_places=2, max_digits=15)),
                ('median_price', models.DecimalField(decimal_places=2, max_digits=15)),
                ('price_change_percent', models.DecimalField(decimal_places=2, max_digits=5)),
                ('transaction_count', models.IntegerField()),
                ('volume', models.DecimalField(decimal_places=2, max_digits=15)),
                ('price_per_sqft', models.DecimalField(blank=True, decimal_places=2, max_digits=10, null=True)),
            ],
            options={
                'db_table': 'market_trends',
                'indexes': [django.contrib.postgres.indexes.BTreeIndex(fields=['area_en'], name='market_tren_area_en_f508af_btree'), django.contrib.postgres.indexes.BTreeIndex(fields=['property_type'], name='market_tren_propert_cc3ff3_btree'), django.contrib.postgres.indexes.BTreeIndex(fields=['period_start'], name='market_tren_period__1c6afd_btree'), django.contrib.postgres.indexes.BTreeIndex(fields=['period_end'], name='market_tren_period__fdd6ac_btree')],
            },
        ),
        migrations.CreateModel(
            name='Land',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('land_type', models.CharField(choices=[('Agricultural', 'Agricultural'), ('Commercial', 'Commercial'), ('Residential', 'Residential'), ('Industrial', 'Industrial')], max_length=50)),
                ('property_sub_type', models.CharField(max_length=50)),
                ('actual_area', models.DecimalField(decimal_places=2, max_digits=10)),
                ('is_offplan', models.CharField(choices=[('Ready', 'Ready'), ('Off-Plan', 'Off-Plan')], max_length=10)),
                ('pre_registration_number', models.CharField(blank=True, max_length=50)),
                ('is_freehold', models.CharField(choices=[('Free Hold', 'Free Hold'), ('Non Free Hold', 'Non Free Hold')], max_length=20)),
                ('dm_zip_code', models.CharField(blank=True, max_length=10)),
                ('master_project', models.CharField(blank=True, max_length=255)),
                ('area_en', models.CharField(max_length=100)),
                ('zone_en', models.CharField(max_length=100)),
                ('project', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='lands', to='analytics.project')),
            ],
            options={
                'db_table': 'lands',
            },
        ),
        migrations.CreateModel(
            name='Forecast',
            fields=[
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('area_en', models.CharField(max_length=100)),
                ('property_type', models.CharField(max_length=50)),
                ('property_sub_type', models.CharField(blank=True, max_length=50)),
                ('forecast_date', models.DateTimeField()),
                ('predicted_price', models.DecimalField(decimal_places=2, max_digits=15)),
                ('confidence_interval_lower', models.DecimalField(decimal_places=2, max_digits=15)),
                ('confidence_interval_upper', models.DecimalField(decimal_places=2, max_digits=15)),
                ('model_version', models.CharField(default='1.0', max_length=20)),
                ('accuracy_score', models.DecimalField(blank=True, decimal_places=4, max_digits=5, null=True)),
                ('metadata', models.JSONField(default=dict)),
            ],
            options={
                'db_table': 'forecasts',
                'indexes': [django.contrib.postgres.indexes.BTreeIndex(fields=['area_en'], name='forecasts_area_en_11cdb4_btree'), django.contrib.postgres.indexes.BTreeIndex(fields=['property_type'], name='forecasts_propert_ba8084_btree'), django.contrib.postgres.indexes.BTreeIndex(fields=['forecast_date'], name='forecasts_forecas_5092f3_btree'), django.contrib.postgres.indexes.BTreeIndex(fields=['predicted_price'], name='forecasts_predict_dd61f3_btree')],
            },
        ),
        migrations.CreateModel(
            name='Broker',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('broker_number', models.CharField(db_index=True, max_length=20, unique=True)),
                ('broker_name_en', models.CharField(max_length=255)),
                ('gender', models.CharField(choices=[('male', 'Male'), ('female', 'Female'), ('أنثى', 'Female (Arabic)')], max_length=10)),
                ('license_start_date', models.DateTimeField()),
                ('license_end_date', models.DateTimeField()),
                ('webpage', models.URLField(blank=True, null=True)),
                ('phone', models.CharField(blank=True, max_length=50)),
                ('fax', models.CharField(blank=True, max_length=50)),
                ('real_estate_number', models.CharField(blank=True, max_length=20)),
                ('real_estate_name_en', models.CharField(blank=True, max_length=255)),
            ],
            options={
                'db_table': 'brokers',
                'indexes': [django.contrib.postgres.indexes.BTreeIndex(fields=['broker_number'], name='brokers_broker__af1383_btree'), django.contrib.postgres.indexes.BTreeIndex(fields=['real_estate_name_en'], name='brokers_real_es_8151b8_btree'), django.contrib.postgres.indexes.BTreeIndex(fields=['license_end_date'], name='brokers_license_364105_btree')],
            },
        ),
        migrations.CreateModel(
            name='Transaction',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('transaction_number', models.CharField(db_index=True, max_length=50, unique=True)),
                ('instance_date', models.DateTimeField()),
                ('group', models.CharField(choices=[('Mortgage', 'Mortgage'), ('Sale', 'Sale'), ('Rent', 'Rent'), ('Other', 'Other')], max_length=50)),
                ('procedure', models.CharField(max_length=100)),
                ('is_offplan', models.CharField(choices=[('Off-Plan', 'Off-Plan'), ('Ready', 'Ready')], max_length=10)),
                ('is_freehold', models.CharField(choices=[('Free Hold', 'Free Hold'), ('Non Free Hold', 'Non Free Hold')], max_length=20)),
                ('usage', models.CharField(choices=[('Residential', 'Residential'), ('Commercial', 'Commercial'), ('Industrial', 'Industrial'), ('Mixed', 'Mixed')], max_length=50)),
                ('area_en', models.CharField(max_length=100)),
                ('property_type', models.CharField(choices=[('Unit', 'Unit'), ('Villa', 'Villa'), ('Land', 'Land'), ('Building', 'Building')], max_length=50)),
                ('property_sub_type', models.CharField(max_length=50)),
                ('transaction_value', models.DecimalField(decimal_places=2, max_digits=15)),
                ('procedure_area', models.DecimalField(decimal_places=2, max_digits=10)),
                ('actual_area', models.DecimalField(decimal_places=2, max_digits=10)),
                ('rooms', models.CharField(blank=True, max_length=20)),
                ('parking', models.CharField(blank=True, max_length=20)),
                ('nearest_metro', models.CharField(blank=True, max_length=100)),
                ('nearest_mall', models.CharField(blank=True, max_length=100)),
                ('nearest_landmark', models.CharField(blank=True, max_length=100)),
                ('total_buyer', models.IntegerField(default=0)),
                ('total_seller', models.IntegerField(default=0)),
                ('master_project', models.CharField(blank=True, max_length=255)),
                ('project', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='transactions', to='analytics.project')),
            ],
            options={
                'db_table': 'transactions',
                'indexes': [django.contrib.postgres.indexes.BTreeIndex(fields=['transaction_number'], name='transaction_transac_cb7167_btree'), django.contrib.postgres.indexes.BTreeIndex(fields=['instance_date'], name='transaction_instanc_860e4d_btree'), django.contrib.postgres.indexes.BTreeIndex(fields=['area_en'], name='transaction_area_en_32b046_btree'), django.contrib.postgres.indexes.BTreeIndex(fields=['property_type'], name='transaction_propert_050c21_btree'), django.contrib.postgres.indexes.BTreeIndex(fields=['transaction_value'], name='transaction_transac_ced5e2_btree'), django.contrib.postgres.indexes.BTreeIndex(fields=['group'], name='transaction_group_dff2f7_btree'), django.contrib.postgres.indexes.BTreeIndex(fields=['usage'], name='transaction_usage_cbb322_btree')],
            },
        ),
        migrations.CreateModel(
            name='Rent',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('registration_date', models.DateTimeField()),
                ('start_date', models.DateTimeField()),
                ('end_date', models.DateTimeField()),
                ('version', models.CharField(choices=[('New', 'New'), ('Renewed', 'Renewed')], max_length=20)),
                ('area_en', models.CharField(max_length=100)),
                ('contract_amount', models.DecimalField(decimal_places=2, max_digits=15)),
                ('annual_amount', models.DecimalField(decimal_places=2, max_digits=15)),
                ('is_freehold', models.CharField(choices=[('Free Hold', 'Free Hold'), ('Non Free Hold', 'Non Free Hold')], max_length=20)),
                ('actual_area', models.DecimalField(decimal_places=2, max_digits=10)),
                ('property_type', models.CharField(choices=[('Unit', 'Unit'), ('Villa', 'Villa'), ('Land', 'Land'), ('Building', 'Building')], max_length=50)),
                ('property_sub_type', models.CharField(max_length=50)),
                ('rooms', models.CharField(blank=True, max_length=20)),
                ('usage', models.CharField(choices=[('Residential', 'Residential'), ('Commercial', 'Commercial'), ('Industrial', 'Industrial'), ('Mixed', 'Mixed')], max_length=50)),
                ('nearest_metro', models.CharField(blank=True, max_length=100)),
                ('nearest_mall', models.CharField(blank=True, max_length=100)),
                ('nearest_landmark', models.CharField(blank=True, max_length=100)),
                ('parking', models.CharField(blank=True, max_length=20)),
                ('total_properties', models.IntegerField(default=1)),
                ('master_project', models.CharField(blank=True, max_length=255)),
                ('project', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='rents', to='analytics.project')),
            ],
            options={
                'db_table': 'rents',
                'indexes': [django.contrib.postgres.indexes.BTreeIndex(fields=['area_en'], name='rents_area_en_65e0af_btree'), django.contrib.postgres.indexes.BTreeIndex(fields=['property_type'], name='rents_propert_26942d_btree'), django.contrib.postgres.indexes.BTreeIndex(fields=['registration_date'], name='rents_registr_f97ec7_btree'), django.contrib.postgres.indexes.BTreeIndex(fields=['start_date'], name='rents_start_d_2ade73_btree'), django.contrib.postgres.indexes.BTreeIndex(fields=['end_date'], name='rents_end_dat_a35991_btree'), django.contrib.postgres.indexes.BTreeIndex(fields=['contract_amount'], name='rents_contrac_e5a0c2_btree'), django.contrib.postgres.indexes.BTreeIndex(fields=['annual_amount'], name='rents_annual__9b7544_btree')],
            },
        ),
        migrations.AddIndex(
            model_name='project',
            index=django.contrib.postgres.indexes.BTreeIndex(fields=['project_number'], name='projects_project_aade24_btree'),
        ),
        migrations.AddIndex(
            model_name='project',
            index=django.contrib.postgres.indexes.BTreeIndex(fields=['project_status'], name='projects_project_88dc90_btree'),
        ),
        migrations.AddIndex(
            model_name='project',
            index=django.contrib.postgres.indexes.BTreeIndex(fields=['area_en'], name='projects_area_en_699858_btree'),
        ),
        migrations.AddIndex(
            model_name='project',
            index=django.contrib.postgres.indexes.BTreeIndex(fields=['zone_en'], name='projects_zone_en_f0caa4_btree'),
        ),
        migrations.AddIndex(
            model_name='project',
            index=django.contrib.postgres.indexes.BTreeIndex(fields=['developer'], name='projects_develop_2fe1f2_btree'),
        ),
        migrations.AddIndex(
            model_name='land',
            index=django.contrib.postgres.indexes.BTreeIndex(fields=['land_type'], name='lands_land_ty_91d1c0_btree'),
        ),
        migrations.AddIndex(
            model_name='land',
            index=django.contrib.postgres.indexes.BTreeIndex(fields=['area_en'], name='lands_area_en_048760_btree'),
        ),
        migrations.AddIndex(
            model_name='land',
            index=django.contrib.postgres.indexes.BTreeIndex(fields=['zone_en'], name='lands_zone_en_6165db_btree'),
        ),
        migrations.AddIndex(
            model_name='land',
            index=django.contrib.postgres.indexes.BTreeIndex(fields=['is_freehold'], name='lands_is_free_d51a4a_btree'),
        ),
        migrations.AddIndex(
            model_name='land',
            index=django.contrib.postgres.indexes.BTreeIndex(fields=['actual_area'], name='lands_actual__3a7c21_btree'),
        ),
    ]
