<?php

namespace Database\Seeders;

use App\Models\Company;
use App\Models\ConsultantProfile;
use App\Models\Listing;
use App\Models\ListingCategory;
use App\Models\ListingFeature;
use App\Models\ListingFeatureValue;
use App\Models\ListingMedia;
use App\Models\Permission;
use App\Models\User;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\Hash;

class DemoListingSeeder extends Seeder
{
    /**
     * Listing görselleri için kullanılan Unsplash havuzu.
     * Her ilan bu havuzdan dönerek kapak + galeri görselleri alır.
     */
    private array $imagePool = [
        'https://images.unsplash.com/photo-1600585154340-be6161a56a0c?auto=format&fit=crop&w=1400&q=80',
        'https://images.unsplash.com/photo-1613490493576-7fde63acd811?auto=format&fit=crop&w=1400&q=80',
        'https://images.unsplash.com/photo-1600596542815-ffad4c1539a9?auto=format&fit=crop&w=1400&q=80',
        'https://images.unsplash.com/photo-1512917774080-9991f1c4c750?auto=format&fit=crop&w=1400&q=80',
        'https://images.unsplash.com/photo-1605276374104-dee2a0ed3cd6?auto=format&fit=crop&w=1400&q=80',
        'https://images.unsplash.com/photo-1600607687939-ce8a6c25118c?auto=format&fit=crop&w=1400&q=80',
        'https://images.unsplash.com/photo-1600047509807-ba8f99d2cdde?auto=format&fit=crop&w=1400&q=80',
        'https://images.unsplash.com/photo-1583608205776-bfd35f0d9f83?auto=format&fit=crop&w=1400&q=80',
        'https://images.unsplash.com/photo-1564013799919-ab600027ffc6?auto=format&fit=crop&w=1400&q=80',
        'https://images.unsplash.com/photo-1502672260266-1c1ef2d93688?auto=format&fit=crop&w=1400&q=80',
        'https://images.unsplash.com/photo-1493809842364-78817add7ffb?auto=format&fit=crop&w=1400&q=80',
        'https://images.unsplash.com/photo-1600566753086-00f18fb6b3ea?auto=format&fit=crop&w=1400&q=80',
        'https://images.unsplash.com/photo-1567496898669-ee935f5f647a?auto=format&fit=crop&w=1400&q=80',
        'https://images.unsplash.com/photo-1570129477492-45c003edd2be?auto=format&fit=crop&w=1400&q=80',
    ];

    public function run(): void
    {
        $consultants = $this->createConsultants();
        $categories = ListingCategory::pluck('id', 'slug');

        $listings = $this->listingData();
        $trTitles = $this->trTitles();
        $trShort = $this->trShortDescriptions();
        $trDesc = $this->trDescriptions();

        foreach ($listings as $index => $data) {
            $categoryId = $categories[$data['category']] ?? null;

            if (!$categoryId) {
                continue;
            }

            // Danışmanları sırayla dağıt.
            $consultant = $consultants[$index % count($consultants)];

            // title/short_description/description TR+EN (TR yoksa EN'e fallback).
            $titleTr = $trTitles[$data['slug']] ?? $data['title'];
            $shortTr = $trShort[$data['slug']] ?? $data['short_description'];
            $descTr = $trDesc[$data['slug']] ?? $data['description'];

            $listing = Listing::updateOrCreate(
                ['slug' => $data['slug']],
                [
                    'consultant_profile_id' => $consultant->id,
                    'category_id' => $categoryId,
                    'title' => ['en' => $data['title'], 'tr' => $titleTr],
                    'short_description' => ['en' => $data['short_description'], 'tr' => $shortTr],
                    'description' => ['en' => $data['description'], 'tr' => $descTr],
                    'price' => $data['price'],
                    'currency' => $data['currency'] ?? 'EUR',
                    'country' => $data['country'],
                    'city' => $data['city'],
                    'district' => $data['district'] ?? null,
                    'neighborhood' => $data['neighborhood'] ?? null,
                    'address' => $data['address'] ?? "{$data['city']}, {$data['country']}",
                    'latitude' => $data['latitude'] ?? null,
                    'longitude' => $data['longitude'] ?? null,
                    'gross_area' => $data['gross_area'] ?? null,
                    'net_area' => $data['net_area'] ?? null,
                    'status' => $data['status'] ?? 'published',
                    'is_featured' => $data['is_featured'] ?? false,
                    'view_count' => $data['view_count'] ?? rand(0, 4200),
                    'published_at' => ($data['status'] ?? 'published') === 'published' ? now()->subDays($index) : null,
                    'meta' => [
                        'seo_title' => $data['title'],
                        'seo_description' => $data['short_description'],
                    ],
                ]
            );

            $this->createMedia($listing, $index);
            $this->createFeatureValues($listing, $data['features'] ?? []);
        }
    }

    private function createConsultants(): array
    {
        $definitions = [
            [
                'email' => 'consultant@pella.test',
                'name' => 'Pella Global Consultant',
                'company_name' => 'Pella Global Realty',
                'slug' => 'pella-global-realty',
                'phone' => '+90 555 111 22 33',
                'city' => 'Istanbul',
                'district' => 'Besiktas',
                'license_number' => 'PELLA-2026-001',
                'profile_image' => 'https://images.unsplash.com/photo-1560250097-0b93528c311a?auto=format&fit=crop&w=400&q=80',
            ],
            [
                'email' => 'sofia@pella.test',
                'name' => 'Sofia Marin',
                'company_name' => 'Marin Luxury Estates',
                'slug' => 'marin-luxury-estates',
                'phone' => '+34 600 222 333',
                'city' => 'Marbella',
                'district' => 'Golden Mile',
                'license_number' => 'PELLA-2026-002',
                'profile_image' => 'https://images.unsplash.com/photo-1573496359142-b8d87734a5a2?auto=format&fit=crop&w=400&q=80',
            ],
            [
                'email' => 'omar@pella.test',
                'name' => 'Omar Al Rashid',
                'company_name' => 'Rashid Prime Properties',
                'slug' => 'rashid-prime-properties',
                'phone' => '+971 50 444 5555',
                'city' => 'Dubai',
                'district' => 'Downtown',
                'license_number' => 'PELLA-2026-003',
                'profile_image' => 'https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?auto=format&fit=crop&w=400&q=80',
            ],
        ];

        // Demo danışmanlar tek demo firmaya bağlı (Agency → Consultant → Listing hiyerarşisi).
        $company = $this->createDemoCompany();

        $consultants = [];

        foreach ($definitions as $def) {
            $user = User::updateOrCreate(
                ['email' => $def['email']],
                [
                    'name' => $def['name'],
                    'password' => Hash::make('password'),
                ]
            );

            $consultants[] = ConsultantProfile::updateOrCreate(
                ['user_id' => $user->id],
                [
                    'company_name' => $def['company_name'],
                    'slug' => $def['slug'],
                    'phone' => $def['phone'],
                    'whatsapp_phone' => $def['phone'],
                    'bio' => 'International real estate consultant focused on premium properties and investment opportunities.',
                    'profile_image' => $def['profile_image'],
                    'cover_image' => null,
                    'city' => $def['city'],
                    'district' => $def['district'],
                    'address' => "{$def['city']}",
                    'license_number' => $def['license_number'],
                    'website_url' => 'https://pellaglobal.com',
                    'instagram_url' => 'https://instagram.com/pellaglobal',
                    'linkedin_url' => null,
                    'is_verified' => true,
                    'verified_at' => now(),
                    'is_active' => true,
                    'application_status' => ConsultantProfile::STATUS_APPROVED,
                    'applied_at' => now(),
                    'company_id' => $company->id,
                ]
            );

            $this->assignConsultantPermissions($user);
        }

        return $consultants;
    }

    private function createMedia(Listing $listing, int $index): void
    {
        $count = count($this->imagePool);

        // İlan başına 4 görsel: kapak + 3 galeri (havuzdan dönerek).
        $mediaItems = [];
        for ($i = 0; $i < 4; $i++) {
            $url = $this->imagePool[($index + $i) % $count];
            $mediaItems[] = [
                'file_path' => $url,
                'file_url' => $url,
                'alt_text' => "{$listing->title} image " . ($i + 1),
                'sort_order' => $i + 1,
                'is_cover' => $i === 0,
            ];
        }

        foreach ($mediaItems as $media) {
            ListingMedia::updateOrCreate(
                [
                    'listing_id' => $listing->id,
                    'file_path' => $media['file_path'],
                ],
                [
                    'file_url' => $media['file_url'],
                    'alt_text' => $media['alt_text'],
                    'mime_type' => 'image/jpeg',
                    'size' => null,
                    'sort_order' => $media['sort_order'],
                    'is_cover' => $media['is_cover'],
                ]
            );
        }
    }

    /** İlan başlıklarının TR çevirileri (slug bazlı). */
    private function trTitles(): array
    {
        return [
            'luxury-villa-ostuni' => 'Ostuni\'de Lüks Villa',
            'seafront-villa-bodrum' => 'Bodrum\'da Denize Sıfır Villa',
            'mediterranean-villa-marbella' => 'Marbella\'da Akdeniz Villası',
            'cliffside-villa-santorini' => 'Santorini\'de Yamaç Villası',
            'riviera-villa-cannes' => 'Cannes\'da Fransız Rivierası Villası',
            'golf-villa-antalya-kas' => 'Kaş\'ta Taş Villa',
            'sea-view-apartment-istanbul' => 'İstanbul\'da Deniz Manzaralı Daire',
            'downtown-apartment-dubai' => 'Dubai Merkezde Daire',
            'old-town-apartment-lisbon' => 'Lizbon Eski Şehirde Daire',
            'beachfront-apartment-ibiza' => 'İbiza\'da Sahil Dairesi',
            'city-apartment-antalya' => 'Antalya\'da Şehir Dairesi',
            'branded-residence-dubai-marina' => 'Dubai Marina\'da Markalı Rezidans',
            'park-residence-istanbul' => 'İstanbul\'da Park Rezidansı',
            'lakeview-residence-zurich' => 'Zürih\'te Göl Manzaralı Rezidans',
            'sea-view-land-bodrum' => 'Bodrum\'da Deniz Manzaralı Arsa',
            'agricultural-land-puglia' => 'Puglia\'da Tarım Arazisi',
            'residential-land-antalya' => 'Antalya\'da Konut İmarlı Arsa',
            'retail-store-istanbul-nisantasi' => 'Nişantaşı\'nda Mağaza',
            'restaurant-space-marbella' => 'Marbella\'da Restoran Yeri',
            'business-bay-office-dubai' => 'Dubai Business Bay\'de Ofis',
            'creative-office-lisbon' => 'Lizbon\'da Kreatif Ofis',
            'corporate-office-istanbul-levent' => 'Levent\'te Kurumsal Ofis',
        ];
    }

    /** short_description TR çevirileri (slug bazlı). */
    private function trShortDescriptions(): array
    {
        return [
            'luxury-villa-ostuni' => 'Ostuni\'de özel havuzu, bahçesi ve panoramik manzarası olan üst düzey bir villa.',
            'seafront-villa-bodrum' => 'Sonsuzluk havuzlu ve denize doğrudan erişimli modern, denize sıfır villa.',
            'mediterranean-villa-marbella' => 'Golden Mile\'da tropikal bahçeli ve spa\'lı zarif bir villa.',
            'cliffside-villa-santorini' => 'Kaldera manzaralı, özel teraslı, beyaz badanalı yamaç villası.',
            'riviera-villa-cannes' => 'La Croisette\'e dakikalar uzaklıkta, deniz manzaralı havuzlu Belle Époque villası.',
            'golf-villa-antalya-kas' => 'Deniz manzaralı, zeytin bahçeli ve teraslı geleneksel taş villa.',
            'sea-view-apartment-istanbul' => 'Prestijli bir Beşiktaş rezidansında Boğaz manzaralı daire.',
            'downtown-apartment-dubai' => 'Downtown Dubai\'de Burç Halife manzaralı daire.',
            'old-town-apartment-lisbon' => 'Tarihi Alfama\'da nehir görünümlü, yenilenmiş daire.',
            'beachfront-apartment-ibiza' => 'Playa d\'en Bossa\'da teraslı modern sahil dairesi.',
            'city-apartment-antalya' => 'Lara Plajı yakınında akıllı ev sistemli, ferah aile dairesi.',
            'branded-residence-dubai-marina' => 'Marina manzaralı, 5 yıldızlı olanaklara sahip tam hizmet markalı rezidans.',
            'park-residence-istanbul' => 'Spor salonu, havuzu ve 7/24 güvenliğiyle şehir parkı yanında aile rezidansı.',
            'lakeview-residence-zurich' => 'Şehre yakın, premium malzemelerle bitirilmiş, ayrıcalıklı göl manzaralı rezidans.',
            'sea-view-land-bodrum' => 'Deniz manzaralı, villa geliştirmeye hazır turizm imarlı arsa.',
            'agricultural-land-puglia' => 'İtria Vadisi\'nde restore edilecek bir harabesi olan zeytinlik arazi.',
            'residential-land-antalya' => 'Şehre yakın, gelişmekte olan bir bölgede konut imarlı arsa.',
            'retail-store-istanbul-nisantasi' => 'Prestijli Nişantaşı alışveriş bölgesinde cadde üzeri mağaza.',
            'restaurant-space-marbella' => 'Puerto Banús\'ta teraslı, anahtar teslim denize sıfır restoran alanı.',
            'business-bay-office-dubai' => 'Business Bay\'de kanal manzaralı, hazır A sınıfı ofis katı.',
            'creative-office-lisbon' => 'Beato\'da depodan dönüştürülmüş açık planlı kreatif ofis.',
            'corporate-office-istanbul-levent' => 'Levent\'te Boğaz manzaralı, yüksek katlı kurumsal ofis.',
        ];
    }

    /** description TR çevirileri (slug bazlı). */
    private function trDescriptions(): array
    {
        return [
            'luxury-villa-ostuni' => 'Ostuni\'deki bu lüks villa; ferah iç mekânları, özel havuzu, peyzajlı bahçesi ve yüksek yatırım potansiyeliyle rafine bir yaşam sunar. Konfor ve mahremiyet için tasarlanmıştır.',
            'seafront-villa-bodrum' => 'Bodrum sahilinde, tavandan tabana cam cepheleri, Ege\'yle bütünleşen sonsuzluk havuzu ve özel iskelesiyle mimari bir başyapıt.',
            'mediterranean-villa-marbella' => 'Prestijli Golden Mile\'da yer alan bu villa; Endülüs zarafetini modern lüksle birleştirir, özel spa, şarap mahzeni ve olgun tropikal bahçeler sunar.',
            'cliffside-villa-santorini' => 'Oia\'nın kaldera kayalıklarına kurulu bu ikonik villa; nefes kesen gün batımı manzarası, ısıtmalı havuzu ve özgün Kiklad mimarisi sunar.',
            'riviera-villa-cannes' => 'Cannes tepelerinde restore edilmiş, La Croisette\'e yürüme mesafesinde bir Belle Époque villası; peyzajlı terasları ve panoramik deniz manzaralı havuzuyla.',
            'golf-villa-antalya-kas' => 'Kaş\'ın tepelerinde zeytin ağaçlarıyla çevrili, huzurlu taş villa; panoramik Akdeniz manzarası ve sakin bir yaşam sunar.',
            'sea-view-apartment-istanbul' => 'Beşiktaş\'ın merkezinde; concierge, spor salonu ve spa imkânları olan yönetimli bir rezidansta yer alan, Boğaz\'a bakan aydınlık ve yüksek katlı bir daire.',
            'downtown-apartment-dubai' => 'Dubai Mall\'a birkaç adım mesafede; tavandan tabana pencerelerinden Burç Halife ve fıskiye manzarasını çerçeveleyen şık, iki yatak odalı bir daire.',
            'old-town-apartment-lisbon' => 'Tarihi Alfama semtinde özenle yenilenmiş; özgün azulejo çinilerini modern konforla birleştiren ve Tagus nehrinden kesitler sunan bir daire.',
            'beachfront-apartment-ibiza' => 'Doğrudan sahil yürüyüş yoluna açılan çağdaş bir daire; denize bakan geniş terası ile ortak havuz ve spor salonuna erişim sunar.',
            'city-apartment-antalya' => 'Antalya\'nın Lara semtinde, plaja yakın, ferah ve modern bir aile dairesi; entegre akıllı ev sistemi ve geniş balkonuyla.',
            'branded-residence-dubai-marina' => 'Dubai Marina\'da otel tarzı hizmetler, sonsuzluk havuzu, spa, spor salonu ve her odadan panoramik marina manzarası sunan lüks bir markalı rezidans.',
            'park-residence-istanbul' => 'İstanbul\'un Avrupa yakasında, peyzajlı bahçeler içinde; kapalı havuzu, fitness merkezi ve kesintisiz güvenliğiyle modern bir rezidans kompleksi.',
            'lakeview-residence-zurich' => 'Zürih Gölü\'ne bakan ayrıcalıklı bir rezidans; premium malzemelerle bitirilmiş, concierge hizmeti, wellness alanı ve yeraltı otoparkı sunar.',
            'sea-view-land-bodrum' => 'Bodrum yarımadasında, kesintisiz deniz manzaralı ve lüks bir villa projesi için onaylı yapılaşma haklarına sahip, birinci sınıf turizm imarlı bir arsa.',
            'agricultural-land-puglia' => 'İtria Vadisi\'nin kalbinde geniş bir zeytinlik; restorasyon potansiyeli olan geleneksel bir trullo harabesi ve tarımsal imar içerir.',
            'residential-land-antalya' => 'Antalya\'nın hızla gelişen bir bölgesinde iyi konumlu konut imarlı arsa; apartman veya butik rezidans projesine uygun, güçlü değer artışı potansiyeliyle.',
            'retail-store-istanbul-nisantasi' => 'Nişantaşı\'nda yoğun yaya trafiğine sahip bir caddede, zemin kat birinci sınıf mağaza; flagship butik için ideal, uzun vadeli ticari kira sözleşmesiyle.',
            'restaurant-space-marbella' => 'Puerto Banús\'ta anahtar teslim, denize sıfır bir restoran mekânı; denize bakan geniş terası, tam donanımlı mutfağı ve mevcut işletme ruhsatıyla.',
            'business-bay-office-dubai' => 'Business Bay\'de tam donanımlı A sınıfı bir ofis katı; kanal manzarası, yükseltilmiş döşeme, toplantı odaları ve ortak iş loncasına erişim sunar.',
            'creative-office-lisbon' => 'Beato inovasyon bölgesinde depodan dönüştürülmüş, karakterli ve açık planlı bir ofis; açıkta bırakılmış tuğla, yüksek tavanlar ve bol doğal ışıkla.',
            'corporate-office-istanbul-levent' => 'Levent finans bölgesinde, geniş Boğaz manzarasına sahip premium ve yüksek katlı kurumsal ofis; akıllı bina sistemleri ve tahsisli otoparkıyla.',
        ];
    }

    /**
     * Feature değerlerini, feature'ın input_type'ına göre doğru kolona yazar.
     * boolean → value_boolean, number → value_number,
     * multiselect → value_json, diğerleri (text/select/date) → value_text
     */
    private function createFeatureValues(Listing $listing, array $features): void
    {
        foreach ($features as $featureKey => $rawValue) {
            $feature = ListingFeature::where('key', $featureKey)->first();

            if (!$feature) {
                continue;
            }

            $columns = [
                'value_text' => null,
                'value_number' => null,
                'value_boolean' => null,
                'value_json' => null,
            ];

            switch ($feature->input_type) {
                case 'boolean':
                    $columns['value_boolean'] = (bool) $rawValue;
                    break;
                case 'number':
                    $columns['value_number'] = $rawValue;
                    break;
                case 'multiselect':
                    $columns['value_json'] = is_array($rawValue) ? $rawValue : [$rawValue];
                    break;
                default:
                    $columns['value_text'] = (string) $rawValue;
                    break;
            }

            ListingFeatureValue::updateOrCreate(
                [
                    'listing_id' => $listing->id,
                    'feature_id' => $feature->id,
                ],
                $columns
            );
        }
    }

    private function assignConsultantPermissions(User $user): void
    {
        $permissionIds = Permission::whereIn('key', ConsultantProfile::AGENT_PERMISSION_KEYS)
            ->pluck('id')
            ->toArray();

        $user->permissions()->syncWithoutDetaching($permissionIds);
    }

    /**
     * Demo firma: 3 demo danışman bu firmaya bağlıdır.
     * Owner hesabı partner@pella.test / password ile Agency Panel'e girer.
     */
    private function createDemoCompany(): Company
    {
        $owner = User::updateOrCreate(
            ['email' => 'partner@pella.test'],
            [
                'name' => 'Pella Partners Owner',
                'password' => Hash::make('password'),
            ]
        );

        $company = Company::updateOrCreate(
            ['user_id' => $owner->id],
            [
                'name' => 'Pella Partners Realty',
                'slug' => 'pella-partners-realty',
                'email' => 'partners@pellaglobal.com',
                'phone' => '+90 212 000 00 00',
                'whatsapp_phone' => '+90 555 000 00 00',
                'website_url' => 'https://pellaglobal.com',
                'description' => 'International brokerage operating under the Pella Global marketplace with a multi-agent team.',
                'address' => 'Levent, Istanbul',
                'city' => 'Istanbul',
                'country' => 'Türkiye',
                'license_number' => 'PELLA-CO-2026-001',
                'application_status' => Company::STATUS_APPROVED,
                'rejection_reason' => null,
                'applied_at' => now(),
                'is_active' => true,
                'is_verified' => true,
                'verified_at' => now(),
            ]
        );

        // Owner'a Agency Panel izinleri.
        $permissionIds = Permission::whereIn('key', Company::OWNER_PERMISSION_KEYS)
            ->pluck('id')
            ->toArray();

        $owner->permissions()->syncWithoutDetaching($permissionIds);

        return $company;
    }

    /**
     * 22 demo ilan — farklı kategori, ülke, şehir, fiyat ve özellik kombinasyonları.
     */
    private function listingData(): array
    {
        return [
            // ---------------- VILLALAR ----------------
            [
                'category' => 'villa',
                'slug' => 'luxury-villa-ostuni',
                'title' => 'Luxury Villa in Ostuni',
                'short_description' => 'A premium villa with private pool, garden and panoramic views in Ostuni.',
                'description' => 'This luxury villa in Ostuni offers a refined living experience with spacious interiors, a private pool, landscaped garden and high investment potential. Designed for comfort and privacy.',
                'price' => 1250000, 'currency' => 'EUR',
                'country' => 'Italy', 'city' => 'Ostuni', 'district' => 'Puglia',
                'latitude' => 40.7295, 'longitude' => 17.5776,
                'gross_area' => 420, 'net_area' => 320, 'is_featured' => true,
                'features' => [
                    'gross_area' => 420, 'net_area' => 320, 'room_count' => 5, 'bathroom_count' => 4,
                    'pool' => true, 'garden' => true, 'parking' => true, 'sea_view' => true,
                    'heating_type' => 'Floor Heating', 'air_conditioning' => true, 'smart_home' => true,
                    'security' => true, 'furnishing_status' => 'Furnished', 'building_age' => 5,
                    'energy_class' => 'A', 'property_view' => ['Sea', 'Garden', 'Pool'], 'deed_status' => 'Freehold',
                ],
            ],
            [
                'category' => 'villa',
                'slug' => 'seafront-villa-bodrum',
                'title' => 'Seafront Villa in Bodrum',
                'short_description' => 'Contemporary seafront villa with infinity pool and direct beach access.',
                'description' => 'An architectural masterpiece on the Bodrum coastline featuring floor-to-ceiling glass, an infinity pool blending into the Aegean, and a private jetty.',
                'price' => 3450000, 'currency' => 'EUR',
                'country' => 'Türkiye', 'city' => 'Bodrum', 'district' => 'Yalıkavak',
                'latitude' => 37.1050, 'longitude' => 27.2876,
                'gross_area' => 560, 'net_area' => 460, 'is_featured' => true,
                'features' => [
                    'gross_area' => 560, 'net_area' => 460, 'room_count' => 6, 'bathroom_count' => 5,
                    'pool' => true, 'garden' => true, 'parking' => true, 'sea_view' => true,
                    'heating_type' => 'Central Heating', 'air_conditioning' => true, 'smart_home' => true,
                    'security' => true, 'furnishing_status' => 'Furnished', 'building_age' => 2,
                    'energy_class' => 'A', 'property_view' => ['Sea'], 'deed_status' => 'Freehold',
                ],
            ],
            [
                'category' => 'villa',
                'slug' => 'mediterranean-villa-marbella',
                'title' => 'Mediterranean Villa in Marbella',
                'short_description' => 'Elegant villa on the Golden Mile with tropical garden and spa.',
                'description' => 'Set on the prestigious Golden Mile, this villa combines Andalusian charm with modern luxury, offering a private spa, wine cellar and mature tropical gardens.',
                'price' => 5900000, 'currency' => 'EUR',
                'country' => 'Spain', 'city' => 'Marbella', 'district' => 'Golden Mile',
                'latitude' => 36.5101, 'longitude' => -4.8920,
                'gross_area' => 720, 'net_area' => 610, 'is_featured' => true,
                'features' => [
                    'gross_area' => 720, 'net_area' => 610, 'room_count' => 7, 'bathroom_count' => 7,
                    'pool' => true, 'garden' => true, 'parking' => true, 'sea_view' => true,
                    'heating_type' => 'Floor Heating', 'air_conditioning' => true, 'smart_home' => true,
                    'security' => true, 'furnishing_status' => 'Semi-Furnished', 'building_age' => 8,
                    'energy_class' => 'B', 'property_view' => ['Sea', 'Mountain', 'Garden'], 'deed_status' => 'Freehold',
                ],
            ],
            [
                'category' => 'villa',
                'slug' => 'cliffside-villa-santorini',
                'title' => 'Cliffside Villa in Santorini',
                'short_description' => 'Whitewashed cliffside villa with caldera views and private terrace.',
                'description' => 'Perched on the caldera cliffs of Oia, this iconic villa offers breathtaking sunset views, a heated plunge pool and authentic Cycladic architecture.',
                'price' => 2150000, 'currency' => 'EUR',
                'country' => 'Greece', 'city' => 'Santorini', 'district' => 'Oia',
                'latitude' => 36.4618, 'longitude' => 25.3753,
                'gross_area' => 240, 'net_area' => 200,
                'features' => [
                    'gross_area' => 240, 'net_area' => 200, 'room_count' => 4, 'bathroom_count' => 3,
                    'pool' => true, 'garden' => false, 'parking' => false, 'sea_view' => true,
                    'heating_type' => 'Electric', 'air_conditioning' => true, 'smart_home' => false,
                    'security' => true, 'furnishing_status' => 'Furnished', 'building_age' => 15,
                    'energy_class' => 'C', 'property_view' => ['Sea', 'City'], 'deed_status' => 'Freehold',
                ],
            ],
            [
                'category' => 'villa',
                'slug' => 'riviera-villa-cannes',
                'title' => 'French Riviera Villa in Cannes',
                'short_description' => 'Belle Époque villa minutes from La Croisette with sea-view pool.',
                'description' => 'A restored Belle Époque villa in the hills above Cannes, walking distance to La Croisette, featuring landscaped terraces and a panoramic sea-view pool.',
                'price' => 8750000, 'currency' => 'EUR',
                'country' => 'France', 'city' => 'Cannes', 'district' => 'Californie',
                'latitude' => 43.5528, 'longitude' => 7.0174,
                'gross_area' => 640, 'net_area' => 520, 'is_featured' => true,
                'features' => [
                    'gross_area' => 640, 'net_area' => 520, 'room_count' => 6, 'bathroom_count' => 6,
                    'pool' => true, 'garden' => true, 'parking' => true, 'sea_view' => true,
                    'heating_type' => 'Central Heating', 'air_conditioning' => true, 'smart_home' => true,
                    'security' => true, 'furnishing_status' => 'Furnished', 'building_age' => 20,
                    'energy_class' => 'B', 'property_view' => ['Sea', 'Garden'], 'deed_status' => 'Freehold',
                ],
            ],
            [
                'category' => 'villa',
                'slug' => 'golf-villa-antalya-kas',
                'title' => 'Stone Villa in Kaş',
                'short_description' => 'Traditional stone villa with sea view, olive garden and terrace.',
                'description' => 'A peaceful stone-built villa surrounded by olive trees on the hills of Kaş, offering panoramic Mediterranean views and a tranquil lifestyle.',
                'price' => 690000, 'currency' => 'EUR',
                'country' => 'Türkiye', 'city' => 'Antalya', 'district' => 'Kaş',
                'latitude' => 36.2020, 'longitude' => 29.6394,
                'gross_area' => 260, 'net_area' => 210,
                'features' => [
                    'gross_area' => 260, 'net_area' => 210, 'room_count' => 4, 'bathroom_count' => 3,
                    'pool' => true, 'garden' => true, 'parking' => true, 'sea_view' => true,
                    'heating_type' => 'Floor Heating', 'air_conditioning' => true, 'smart_home' => false,
                    'security' => false, 'furnishing_status' => 'Semi-Furnished', 'building_age' => 6,
                    'energy_class' => 'B', 'property_view' => ['Sea', 'Mountain'], 'deed_status' => 'Freehold',
                ],
            ],

            // ---------------- APARTMANLAR ----------------
            [
                'category' => 'apartment',
                'slug' => 'sea-view-apartment-istanbul',
                'title' => 'Sea-View Apartment in Istanbul',
                'short_description' => 'Bosphorus-view apartment in a prestigious Beşiktaş residence.',
                'description' => 'A bright, high-floor apartment overlooking the Bosphorus, located in a managed residence with concierge, gym and spa facilities in the heart of Beşiktaş.',
                'price' => 780000, 'currency' => 'EUR',
                'country' => 'Türkiye', 'city' => 'Istanbul', 'district' => 'Beşiktaş',
                'latitude' => 41.0438, 'longitude' => 29.0094,
                'gross_area' => 165, 'net_area' => 140, 'is_featured' => true,
                'features' => [
                    'gross_area' => 165, 'net_area' => 140, 'room_count' => 3, 'bathroom_count' => 2,
                    'parking' => true, 'sea_view' => true, 'heating_type' => 'Central Heating',
                    'balcony' => true, 'elevator' => true, 'air_conditioning' => true,
                    'furnishing_status' => 'Furnished', 'building_age' => 3, 'floor_number' => 12,
                    'total_floors' => 24, 'energy_class' => 'A', 'property_view' => ['Sea', 'City'], 'deed_status' => 'Condominium',
                ],
            ],
            [
                'category' => 'apartment',
                'slug' => 'downtown-apartment-dubai',
                'title' => 'Downtown Apartment in Dubai',
                'short_description' => 'Burj Khalifa view apartment in Downtown Dubai.',
                'description' => 'A sleek two-bedroom apartment with floor-to-ceiling windows framing the Burj Khalifa and fountain views, located steps from Dubai Mall.',
                'price' => 1100000, 'currency' => 'EUR',
                'country' => 'UAE', 'city' => 'Dubai', 'district' => 'Downtown',
                'latitude' => 25.1972, 'longitude' => 55.2744,
                'gross_area' => 130, 'net_area' => 115, 'is_featured' => true,
                'features' => [
                    'gross_area' => 130, 'net_area' => 115, 'room_count' => 2, 'bathroom_count' => 2,
                    'parking' => true, 'sea_view' => false, 'heating_type' => 'None',
                    'balcony' => true, 'elevator' => true, 'air_conditioning' => true,
                    'furnishing_status' => 'Furnished', 'building_age' => 4, 'floor_number' => 38,
                    'total_floors' => 60, 'energy_class' => 'A', 'property_view' => ['City'], 'deed_status' => 'Freehold',
                ],
            ],
            [
                'category' => 'apartment',
                'slug' => 'old-town-apartment-lisbon',
                'title' => 'Old Town Apartment in Lisbon',
                'short_description' => 'Renovated apartment in historic Alfama with river glimpses.',
                'description' => 'A tastefully renovated apartment in the historic Alfama district, blending original azulejo tiles with modern comforts and glimpses of the Tagus river.',
                'price' => 520000, 'currency' => 'EUR',
                'country' => 'Portugal', 'city' => 'Lisbon', 'district' => 'Alfama',
                'latitude' => 38.7128, 'longitude' => -9.1300,
                'gross_area' => 95, 'net_area' => 82,
                'features' => [
                    'gross_area' => 95, 'net_area' => 82, 'room_count' => 2, 'bathroom_count' => 1,
                    'parking' => false, 'sea_view' => false, 'heating_type' => 'Electric',
                    'balcony' => true, 'elevator' => false, 'air_conditioning' => true,
                    'furnishing_status' => 'Semi-Furnished', 'building_age' => 60, 'floor_number' => 3,
                    'total_floors' => 4, 'energy_class' => 'D', 'property_view' => ['City'], 'deed_status' => 'Condominium',
                ],
            ],
            [
                'category' => 'apartment',
                'slug' => 'beachfront-apartment-ibiza',
                'title' => 'Beachfront Apartment in Ibiza',
                'short_description' => 'Modern beachfront apartment with terrace in Playa d\'en Bossa.',
                'description' => 'A contemporary apartment opening directly onto the beach promenade, featuring a large sea-facing terrace and access to a communal pool and gym.',
                'price' => 845000, 'currency' => 'EUR',
                'country' => 'Spain', 'city' => 'Ibiza', 'district' => 'Playa d\'en Bossa',
                'latitude' => 38.8847, 'longitude' => 1.4090,
                'gross_area' => 110, 'net_area' => 96,
                'features' => [
                    'gross_area' => 110, 'net_area' => 96, 'room_count' => 2, 'bathroom_count' => 2,
                    'parking' => true, 'sea_view' => true, 'heating_type' => 'Electric',
                    'balcony' => true, 'elevator' => true, 'air_conditioning' => true,
                    'furnishing_status' => 'Furnished', 'building_age' => 7, 'floor_number' => 2,
                    'total_floors' => 6, 'energy_class' => 'B', 'property_view' => ['Sea'], 'deed_status' => 'Condominium',
                ],
            ],
            [
                'category' => 'apartment',
                'slug' => 'city-apartment-antalya',
                'title' => 'City Apartment in Antalya',
                'short_description' => 'Spacious family apartment near Lara Beach with smart home system.',
                'description' => 'A spacious, modern family apartment in the Lara district of Antalya, close to the beach, featuring an integrated smart home system and a generous balcony.',
                'price' => 295000, 'currency' => 'EUR',
                'country' => 'Türkiye', 'city' => 'Antalya', 'district' => 'Lara',
                'latitude' => 36.8600, 'longitude' => 30.7900,
                'gross_area' => 145, 'net_area' => 125,
                'features' => [
                    'gross_area' => 145, 'net_area' => 125, 'room_count' => 3, 'bathroom_count' => 2,
                    'parking' => true, 'sea_view' => false, 'heating_type' => 'Natural Gas',
                    'balcony' => true, 'elevator' => true, 'air_conditioning' => true,
                    'furnishing_status' => 'Unfurnished', 'building_age' => 1, 'floor_number' => 5,
                    'total_floors' => 10, 'energy_class' => 'A', 'property_view' => ['City'], 'deed_status' => 'Condominium',
                ],
            ],

            // ---------------- RESIDENCE ----------------
            [
                'category' => 'residence',
                'slug' => 'branded-residence-dubai-marina',
                'title' => 'Branded Residence in Dubai Marina',
                'short_description' => 'Full-service branded residence with marina views and 5-star amenities.',
                'description' => 'A luxury branded residence in Dubai Marina offering hotel-style services, infinity pool, spa, gym and panoramic marina views from every room.',
                'price' => 1650000, 'currency' => 'EUR',
                'country' => 'UAE', 'city' => 'Dubai', 'district' => 'Marina',
                'latitude' => 25.0805, 'longitude' => 55.1403,
                'gross_area' => 180, 'net_area' => 158, 'is_featured' => true,
                'features' => [
                    'gross_area' => 180, 'net_area' => 158, 'room_count' => 3, 'bathroom_count' => 3,
                    'pool' => true, 'parking' => true, 'sea_view' => true, 'heating_type' => 'None',
                    'balcony' => true, 'elevator' => true, 'air_conditioning' => true, 'smart_home' => true,
                    'security' => true, 'gym' => true, 'furnishing_status' => 'Furnished', 'building_age' => 2,
                    'floor_number' => 28, 'total_floors' => 52, 'energy_class' => 'A',
                    'property_view' => ['Sea', 'City'], 'deed_status' => 'Freehold',
                ],
            ],
            [
                'category' => 'residence',
                'slug' => 'park-residence-istanbul',
                'title' => 'Park Residence in Istanbul',
                'short_description' => 'Family residence by a city park with gym, pool and 24/7 security.',
                'description' => 'A modern residence complex on the European side of Istanbul, set within landscaped gardens with an indoor pool, fitness center and round-the-clock security.',
                'price' => 540000, 'currency' => 'EUR',
                'country' => 'Türkiye', 'city' => 'Istanbul', 'district' => 'Şişli',
                'latitude' => 41.0602, 'longitude' => 28.9870,
                'gross_area' => 150, 'net_area' => 128,
                'features' => [
                    'gross_area' => 150, 'net_area' => 128, 'room_count' => 3, 'bathroom_count' => 2,
                    'pool' => true, 'parking' => true, 'sea_view' => false, 'heating_type' => 'Central Heating',
                    'balcony' => true, 'elevator' => true, 'air_conditioning' => true, 'smart_home' => true,
                    'security' => true, 'gym' => true, 'furnishing_status' => 'Unfurnished', 'building_age' => 4,
                    'floor_number' => 8, 'total_floors' => 16, 'energy_class' => 'A',
                    'property_view' => ['City', 'Garden'], 'deed_status' => 'Condominium',
                ],
            ],
            [
                'category' => 'residence',
                'slug' => 'lakeview-residence-zurich',
                'title' => 'Lake-View Residence in Zürich',
                'short_description' => 'Exclusive lake-view residence with premium finishes near the city.',
                'description' => 'An exclusive residence overlooking Lake Zürich, finished with premium materials and offering concierge services, a wellness area and underground parking.',
                'price' => 4200000, 'currency' => 'CHF',
                'country' => 'Switzerland', 'city' => 'Zürich', 'district' => 'Seefeld',
                'latitude' => 47.3560, 'longitude' => 8.5500,
                'gross_area' => 210, 'net_area' => 185, 'is_featured' => true,
                'features' => [
                    'gross_area' => 210, 'net_area' => 185, 'room_count' => 4, 'bathroom_count' => 3,
                    'pool' => false, 'parking' => true, 'sea_view' => false, 'heating_type' => 'Floor Heating',
                    'balcony' => true, 'elevator' => true, 'air_conditioning' => true, 'smart_home' => true,
                    'security' => true, 'gym' => true, 'furnishing_status' => 'Semi-Furnished', 'building_age' => 5,
                    'floor_number' => 4, 'total_floors' => 6, 'energy_class' => 'A',
                    'property_view' => ['Lake', 'City'], 'deed_status' => 'Freehold',
                ],
            ],

            // ---------------- ARSALAR ----------------
            [
                'category' => 'land',
                'slug' => 'sea-view-land-bodrum',
                'title' => 'Sea-View Building Plot in Bodrum',
                'short_description' => 'Tourism-zoned plot with sea view, ready for villa development.',
                'description' => 'A prime tourism-zoned plot on the Bodrum peninsula with unobstructed sea views and approved development rights for a luxury villa project.',
                'price' => 980000, 'currency' => 'EUR',
                'country' => 'Türkiye', 'city' => 'Bodrum', 'district' => 'Gümüşlük',
                'latitude' => 37.0470, 'longitude' => 27.2330,
                'gross_area' => 1200,
                'features' => [
                    'gross_area' => 1200, 'zoning_status' => 'Tourism', 'block_no' => '142',
                    'parcel_no' => '17', 'property_view' => ['Sea'], 'deed_status' => 'Freehold',
                ],
            ],
            [
                'category' => 'land',
                'slug' => 'agricultural-land-puglia',
                'title' => 'Agricultural Land in Puglia',
                'short_description' => 'Olive grove land with a ruin to restore in the Itria Valley.',
                'description' => 'An expansive olive grove in the heart of the Itria Valley, including a traditional trullo ruin with restoration potential and agricultural zoning.',
                'price' => 320000, 'currency' => 'EUR',
                'country' => 'Italy', 'city' => 'Cisternino', 'district' => 'Puglia',
                'latitude' => 40.7430, 'longitude' => 17.4230,
                'gross_area' => 8500,
                'features' => [
                    'gross_area' => 8500, 'zoning_status' => 'Agricultural', 'block_no' => '88',
                    'parcel_no' => '203', 'property_view' => ['Garden', 'Mountain'], 'deed_status' => 'Freehold',
                ],
            ],
            [
                'category' => 'land',
                'slug' => 'residential-land-antalya',
                'title' => 'Residential Plot in Antalya',
                'short_description' => 'Residential-zoned plot in a developing district near the city.',
                'description' => 'A well-located residential plot in a rapidly developing district of Antalya, suitable for an apartment or boutique residence project with strong appreciation potential.',
                'price' => 450000, 'currency' => 'EUR',
                'country' => 'Türkiye', 'city' => 'Antalya', 'district' => 'Döşemealtı',
                'latitude' => 37.0250, 'longitude' => 30.6100,
                'gross_area' => 2400,
                'features' => [
                    'gross_area' => 2400, 'zoning_status' => 'Residential', 'block_no' => '305',
                    'parcel_no' => '12', 'property_view' => ['Mountain'], 'deed_status' => 'Freehold',
                ],
            ],

            // ---------------- TİCARİ ----------------
            [
                'category' => 'commercial-property',
                'slug' => 'retail-store-istanbul-nisantasi',
                'title' => 'Retail Store in Nişantaşı',
                'short_description' => 'High-street retail unit in the prestigious Nişantaşı shopping district.',
                'description' => 'A prime ground-floor retail unit on a high-footfall street in Nişantaşı, ideal for a flagship boutique, with a long-term commercial lease in place.',
                'price' => 2300000, 'currency' => 'EUR',
                'country' => 'Türkiye', 'city' => 'Istanbul', 'district' => 'Nişantaşı',
                'latitude' => 41.0470, 'longitude' => 28.9940,
                'gross_area' => 220, 'net_area' => 200, 'is_featured' => true,
                'features' => [
                    'gross_area' => 220, 'net_area' => 200, 'parking' => false, 'heating_type' => 'Central Heating',
                    'air_conditioning' => true, 'elevator' => false, 'security' => true, 'building_age' => 25,
                    'energy_class' => 'C', 'deed_status' => 'Condominium',
                ],
            ],
            [
                'category' => 'commercial-property',
                'slug' => 'restaurant-space-marbella',
                'title' => 'Restaurant Space in Marbella',
                'short_description' => 'Turnkey beachfront restaurant space with terrace in Puerto Banús.',
                'description' => 'A turnkey beachfront restaurant venue in Puerto Banús with a large sea-facing terrace, fully equipped kitchen and an established trading licence.',
                'price' => 1750000, 'currency' => 'EUR',
                'country' => 'Spain', 'city' => 'Marbella', 'district' => 'Puerto Banús',
                'latitude' => 36.4870, 'longitude' => -4.9530,
                'gross_area' => 310, 'net_area' => 280,
                'features' => [
                    'gross_area' => 310, 'net_area' => 280, 'parking' => true, 'heating_type' => 'Central Heating',
                    'air_conditioning' => true, 'elevator' => false, 'security' => true, 'building_age' => 12,
                    'energy_class' => 'B', 'deed_status' => 'Freehold',
                ],
            ],

            // ---------------- OFİS ----------------
            [
                'category' => 'office',
                'slug' => 'business-bay-office-dubai',
                'title' => 'Business Bay Office in Dubai',
                'short_description' => 'Grade-A fitted office floor with canal views in Business Bay.',
                'description' => 'A fully fitted Grade-A office floor in Business Bay with canal views, raised flooring, meeting suites and access to a shared business lounge.',
                'price' => 1950000, 'currency' => 'EUR',
                'country' => 'UAE', 'city' => 'Dubai', 'district' => 'Business Bay',
                'latitude' => 25.1860, 'longitude' => 55.2790,
                'gross_area' => 300, 'net_area' => 270, 'is_featured' => true,
                'features' => [
                    'gross_area' => 300, 'net_area' => 270, 'parking' => true, 'heating_type' => 'None',
                    'air_conditioning' => true, 'elevator' => true, 'security' => true, 'smart_home' => true,
                    'floor_number' => 14, 'total_floors' => 30, 'building_age' => 3, 'energy_class' => 'A',
                    'furnishing_status' => 'Furnished', 'deed_status' => 'Freehold',
                ],
            ],
            [
                'category' => 'office',
                'slug' => 'creative-office-lisbon',
                'title' => 'Creative Office in Lisbon',
                'short_description' => 'Open-plan creative office in a converted warehouse in Beato.',
                'description' => 'A characterful open-plan office in a converted warehouse in the Beato innovation district, featuring exposed brick, high ceilings and abundant natural light.',
                'price' => 880000, 'currency' => 'EUR',
                'country' => 'Portugal', 'city' => 'Lisbon', 'district' => 'Beato',
                'latitude' => 38.7330, 'longitude' => -9.1060,
                'gross_area' => 260, 'net_area' => 240, 'status' => 'pending',
                'features' => [
                    'gross_area' => 260, 'net_area' => 240, 'parking' => false, 'heating_type' => 'Electric',
                    'air_conditioning' => true, 'elevator' => true, 'security' => false, 'smart_home' => false,
                    'floor_number' => 1, 'total_floors' => 3, 'building_age' => 40, 'energy_class' => 'C',
                    'furnishing_status' => 'Unfurnished', 'deed_status' => 'Condominium',
                ],
            ],
            [
                'category' => 'office',
                'slug' => 'corporate-office-istanbul-levent',
                'title' => 'Corporate Office in Levent',
                'short_description' => 'High-rise corporate office with Bosphorus views in Levent.',
                'description' => 'A premium high-rise corporate office in the Levent financial district with sweeping Bosphorus views, smart building systems and dedicated parking.',
                'price' => 2650000, 'currency' => 'EUR',
                'country' => 'Türkiye', 'city' => 'Istanbul', 'district' => 'Levent',
                'latitude' => 41.0820, 'longitude' => 29.0100,
                'gross_area' => 340, 'net_area' => 300, 'status' => 'draft',
                'features' => [
                    'gross_area' => 340, 'net_area' => 300, 'parking' => true, 'heating_type' => 'Central Heating',
                    'air_conditioning' => true, 'elevator' => true, 'security' => true, 'smart_home' => true,
                    'floor_number' => 22, 'total_floors' => 40, 'building_age' => 6, 'energy_class' => 'A',
                    'furnishing_status' => 'Semi-Furnished', 'deed_status' => 'Condominium',
                ],
            ],
        ];
    }
}
