# Generated by Django 6.0.5 on 2026-05-25 19:52

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Category',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100, unique=True)),
            ],
            options={
                'verbose_name_plural': 'Categories',
                'ordering': ['name'],
            },
        ),
        migrations.CreateModel(
            name='City',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=200)),
                ('slug', models.SlugField(unique=True)),
                ('bbox', models.JSONField(blank=True, null=True)),
                ('place_count', models.IntegerField(default=0)),
            ],
            options={
                'verbose_name_plural': 'Cities',
                'ordering': ['name'],
            },
        ),
        migrations.CreateModel(
            name='Place',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('osm_id', models.BigIntegerField()),
                ('osm_type', models.CharField(max_length=20)),
                ('name', models.CharField(max_length=500)),
                ('lat', models.FloatField()),
                ('lon', models.FloatField()),
                ('wikidata_qid', models.CharField(blank=True, max_length=20, null=True)),
                ('description', models.TextField(blank=True, null=True)),
                ('website', models.CharField(blank=True, max_length=500, null=True)),
                ('phone', models.CharField(blank=True, max_length=100, null=True)),
                ('opening_hours', models.CharField(blank=True, max_length=500, null=True)),
                ('historic', models.CharField(blank=True, max_length=100, null=True)),
                ('tourism', models.CharField(blank=True, max_length=100, null=True)),
                ('amenity', models.CharField(blank=True, max_length=100, null=True)),
                ('shop', models.CharField(blank=True, max_length=100, null=True)),
                ('leisure', models.CharField(blank=True, max_length=100, null=True)),
                ('man_made', models.CharField(blank=True, max_length=100, null=True)),
                ('memorial', models.CharField(blank=True, max_length=100, null=True)),
                ('artwork_type', models.CharField(blank=True, max_length=100, null=True)),
                ('heritage', models.CharField(blank=True, max_length=100, null=True)),
                ('pagerank', models.FloatField(blank=True, null=True)),
                ('interest_score', models.FloatField(db_index=True, default=0.0)),
                ('city', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='places', to='places.city')),
            ],
            options={
                'ordering': ['-interest_score'],
            },
        ),
        migrations.CreateModel(
            name='ImageFeature',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('image_path', models.CharField(max_length=500, unique=True)),
                ('category_name', models.CharField(max_length=100)),
                ('feature_vector', models.TextField()),
                ('city', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='places.city')),
                ('place', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='image_features', to='places.place')),
            ],
            options={
                'ordering': ['image_path'],
            },
        ),
        migrations.CreateModel(
            name='PlaceCategory',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('category', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='places.category')),
                ('place', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='places.place')),
            ],
            options={
                'unique_together': {('place', 'category')},
            },
        ),
        migrations.AddField(
            model_name='place',
            name='categories',
            field=models.ManyToManyField(through='places.PlaceCategory', to='places.category'),
        ),
        migrations.CreateModel(
            name='PlaceImage',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('image_path', models.CharField(max_length=500)),
                ('caption', models.CharField(blank=True, max_length=500, null=True)),
                ('place', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='images', to='places.place')),
            ],
            options={
                'ordering': ['image_path'],
            },
        ),
        migrations.CreateModel(
            name='SimilarPlace',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('score', models.FloatField()),
                ('method', models.CharField(max_length=50)),
                ('main_place', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='similar_to', to='places.place')),
                ('similar_place', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='similar_from', to='places.place')),
            ],
        ),
        migrations.AddIndex(
            model_name='place',
            index=models.Index(fields=['-interest_score'], name='places_plac_interes_393520_idx'),
        ),
        migrations.AlterUniqueTogether(
            name='place',
            unique_together={('city', 'osm_id', 'osm_type')},
        ),
        migrations.AddIndex(
            model_name='similarplace',
            index=models.Index(fields=['main_place', 'method', '-score'], name='places_simi_main_pl_61294e_idx'),
        ),
        migrations.AlterUniqueTogether(
            name='similarplace',
            unique_together={('main_place', 'similar_place', 'method')},
        ),
    ]
