# Generated by Django 6.0.3 on 2026-03-26 11:23

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


class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='EstablishmentType',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=50, unique=True, verbose_name='الاسم')),
                ('code', models.CharField(max_length=20, unique=True, verbose_name='الكود')),
                ('description', models.TextField(blank=True, null=True, verbose_name='الوصف')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('deleted_at', models.DateTimeField(blank=True, null=True)),
                ('created_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='esttype_created', to=settings.AUTH_USER_MODEL)),
                ('deleted_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='esttype_deleted', to=settings.AUTH_USER_MODEL)),
                ('updated_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='esttype_updated', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': 'نوع المنشأة',
                'verbose_name_plural': 'أنواع المنشآت',
            },
        ),
        migrations.CreateModel(
            name='Establishment',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name_ar', models.CharField(max_length=200, verbose_name='الاسم بالعربية')),
                ('name_en', models.CharField(blank=True, max_length=200, null=True, verbose_name='الاسم بالإنجليزية')),
                ('license_number', models.CharField(blank=True, max_length=50, null=True, unique=True, verbose_name='رقم الترخيص')),
                ('owner_name', models.CharField(blank=True, max_length=100, null=True, verbose_name='اسم المالك')),
                ('phone', models.CharField(blank=True, max_length=20, null=True, verbose_name='الهاتف')),
                ('address', models.TextField(blank=True, null=True, verbose_name='العنوان التفصيلي')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('deleted_at', models.DateTimeField(blank=True, null=True)),
                ('created_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='establishment_created', to=settings.AUTH_USER_MODEL)),
                ('deleted_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='establishment_deleted', to=settings.AUTH_USER_MODEL)),
                ('location', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='establishments', to='geography.location', verbose_name='الموقع')),
                ('updated_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='establishment_updated', to=settings.AUTH_USER_MODEL)),
                ('establishment_type', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='establishments', to='establishments.establishmenttype', verbose_name='نوع المنشأة')),
            ],
            options={
                'verbose_name': 'منشأة',
                'verbose_name_plural': 'المنشآت',
            },
        ),
        migrations.AddIndex(
            model_name='establishmenttype',
            index=models.Index(fields=['deleted_at'], name='establishme_deleted_f0f5eb_idx'),
        ),
        migrations.AddIndex(
            model_name='establishmenttype',
            index=models.Index(fields=['name'], name='establishme_name_e6e0e5_idx'),
        ),
        migrations.AddIndex(
            model_name='establishment',
            index=models.Index(fields=['deleted_at'], name='establishme_deleted_4359c3_idx'),
        ),
        migrations.AddIndex(
            model_name='establishment',
            index=models.Index(fields=['name_ar'], name='establishme_name_ar_71d9b2_idx'),
        ),
        migrations.AddIndex(
            model_name='establishment',
            index=models.Index(fields=['license_number'], name='establishme_license_54ca39_idx'),
        ),
    ]
