# ExtraNetWork API — Teknik Özet

## Genel Bilgiler

| Özellik       | Değer                                     |
| ------------- | ----------------------------------------- |
| Framework     | Laravel Lumen 5.8                         |
| PHP           | >= 7.1.3                                  |
| App Versiyonu | 1.5.22                                    |
| Veritabanı    | MySQL (`utf8mb4`, host: `mysql-master`)   |
| Queue Driver  | Database (jobs tablosu)                   |
| Mail Driver   | SMTP — Gmail (`noreply@extranetwork.com`) |

---

## Mimari

```
app/
├── Http/Controllers/     → 86 Controller
├── Core/
│   ├── Service/          → 142 Service
│   ├── Repository/       → 176 Repository
│   └── Validator/        → 132 Validator
├── Models/               → 196 Model
├── Jobs/                 → 6 Job
├── Events/               → 2 Event
├── Listeners/            → 1 Listener
├── Channels/             → OneSignal push
└── Http/Middleware/      → 11 Middleware
```

**Katmanlı mimari:** Controller → Service → Repository → Model

---

## Servisler & URL'ler

| Servis         | URL                            |
| -------------- | ------------------------------ |
| API            | `https://api.extranetwork.com` |
| Web            | `https://www.extranetwork.com` |
| Client App     | `https://app.extranetwork.com` |
| Booking Engine | `https://be.extranetwork.com`  |
| Image CDN      | `https://cdn.extranetwork.com` |

---

## Veritabanı (100+ tablo)

### Ana Tablolar

| Grup            | Tablolar                                                                                                  |
| --------------- | --------------------------------------------------------------------------------------------------------- |
| Kullanıcı       | `user`, `permission`, `permission_group`, `user_property_mapping`                                         |
| Mülk (Property) | `property`, `property_type`, `property_chain`, `property_brand`, `property_contact`, `property_executive` |
| Oda             | `property_room`, `property_room_type`, `property_room_bed`, `property_room_view_type`                     |
| Fotoğraf        | `property_photo`, `property_photo_category`, `property_room_photo_mapping`                                |
| İçerik          | `property_content`, `property_content_category`, `property_fact`, `property_fact_mapping`                 |
| Fiyat & Oran    | `property_room_rate`, `property_room_rate_mapping`, `property_room_rate_channel_mapping`                  |
| Kanal           | `property_channel`, `property_channel_mapping`, `property_channel_category`                               |
| Rezervasyon     | `booking`, `booking_contact`, `booking_room_pax`, `booking_addon`, `booking_payment`                      |
| Politika        | `property_cancellation_policy`, `property_pricing_policy_adult`, `property_pricing_policy_child`          |
| Web             | `property_web`, `property_web_content`, `property_web_menu`, `property_web_meta_tag`                      |
| Diğer           | `property_promotion`, `property_coupon`, `property_addon`, `property_award_certificate`, `site_config`    |

---

## Modeller & İlişkiler

### Property (Ana Model)

```
Property
 ├── hasMany  → PropertyPhoto, PropertyRoom, PropertyExecutive, PropertyUser
 ├── hasOne   → PropertyContact, PropertyWeb, PropertyBrand, PropertyChain
 └── belongsTo → PropertyType, Destination
```

### Booking

```
Booking
 ├── hasMany  → BookingRoomPax, BookingAddon, BookingPayment
 └── hasOne   → BookingContact
```

### Offer

```
Offer
 ├── hasMany  → OfferContactMapping, OfferFactMapping
 └── hasOne   → OfferPaymentType
```

---

## Controller Grupları

### Auth & Kullanıcı

- `AuthController` — login, refresh-token, logout
- `UserController` — CRUD, şifre sıfırlama, rol yönetimi

### Property Yönetimi

- `PropertyController` — CRUD, dashboard, raporlar
- `PropertyPhotoController` — yükleme, sıralama, yayınlama
- `PropertyContactController`, `PropertyExecutiveController`, `PropertyBrandController`
- `PropertyRoomController`, `PropertyRoomBedController`, `PropertyRoomTypeController`

### Fiyat & Oran

- `PropertyRoomRateController`, `PropertyRoomRateMappingController`
- `PropertyRoomRateChannelMappingController`
- `PropertyQuickPricingController`, `PropertyPersonPricingPolicyController`
- `PropertyOfferController`, `PropertyNonrefundableController`
- `PropertyCancellationPolicyController`

### Kanal Yönetimi

- `PropertyChannelController`, `PropertyChannelMappingController`
- `PropertyChannelGroupController`, `PropertyChannelCategoryController`
- `CompetitorPriceAnalysisController`

### İçerik & Web

- `PropertyContentController`, `PropertyFactController`
- `PropertyWebController`, `PropertyWebContentController`, `PropertyWebMenuController`
- `PropertyPlaceController`, `PropertyAdditionalInfoController`

### Rezervasyon & Ödeme

- `PropertyBookingController`
- `PaymentController`, `PaymentLinkController`
- `PropertyBookingTicketController`

### Özel

- `AIController` — OpenAI entegrasyonu
- `ReputationManagementController` — Review/yorum yönetimi
- `PropertyAwardCertificatesController`
- `ExportPdfController`, `DashboardPlusService` controllers

---

## Middleware

| Middleware                                 | Görev                    |
| ------------------------------------------ | ------------------------ |
| `JwtMiddleware`                            | JWT token doğrulama      |
| `CorsMiddleware`                           | CORS başlıkları          |
| `LanguageSettingMiddleware`                | Dil seçimi               |
| `PropertyMiddleware`                       | Property context         |
| `UserRoutePermissionAuthorize`             | RBAC yetki kontrolü      |
| `BookingEngineTokenMiddleware`             | Booking engine auth      |
| `MyWebTokenMiddleware`                     | MyWeb auth               |
| `CheckPropertyChannelConnectionMiddleware` | Kanal bağlantı doğrulama |
| `ContentWizardMiddleware`                  | İçerik sihirbazı akışı   |

---

## Jobs (Queue)

| Job                               | Görev                  |
| --------------------------------- | ---------------------- |
| `PropertyReviewServiceJob`        | Review senkronizasyonu |
| `PropertyReviewAnalyzeServiceJob` | Review analizi         |
| `PropertyCatalogServiceJob`       | Katalog güncellemeleri |
| `SlackLogJob`                     | Slack bildirim logları |

---

## Route Yapısı

```
POST   /app/v1/auth/login
POST   /app/v1/auth/refresh-token
POST   /app/v1/user/register
POST   /app/v1/logout

GET    /property-comparison/{weekKey}
POST   /web/check-domain

[Protected - /app/v1]
 ├── /property/**           → Property CRUD & yönetim
 ├── /property-room/**      → Oda yönetimi
 ├── /property-rate/**      → Fiyat & oran
 ├── /property-channel/**   → Kanal yönetimi
 ├── /booking/**            → Rezervasyon
 ├── /payment/**            → Ödeme
 ├── /property-web/**       → Web içerik
 └── /user/**               → Kullanıcı yönetimi
```

---

## Temel Paketler

| Paket                     | Sürüm  | Kullanım       |
| ------------------------- | ------ | -------------- |
| `laravel/lumen-framework` | 5.8    | Framework      |
| `firebase/php-jwt`        | ^5.0   | JWT auth       |
| `stripe/stripe-php`       | ^7.66  | Ödeme          |
| `google/cloud-vision`     | ^0.24  | Görsel analiz  |
| `maatwebsite/excel`       | ^3.1   | Excel export   |
| `barryvdh/laravel-dompdf` | ^0.8.7 | PDF üretimi    |
| `intervention/image`      | ^2.5   | Görsel işleme  |
| `predis/predis`           | ^1.1   | Redis          |
| `ramsey/uuid`             | ^4.1   | UUID üretimi   |
| `symfony/translation`     | 4.4.1  | Çeviri desteği |

---

## Dil Desteği

`config/` altında hazır dil paketi dosyaları:

- `language-pack-en.php` — İngilizce
- `language-pack-de.php` — Almanca
- `language-pack-tr.php` — Türkçe

---

## Entegrasyonlar

- **Stripe** — Ödeme işlemleri
- **OpenAI** — AI özellikler (`AIController`)
- **Google Cloud Vision** — Görsel analiz
- **OneSignal** — Push bildirim (`OneSignalChannel`)
- **Slack** — Log bildirimleri (`SlackLogJob`)
- **Redis** — Cache & queue
- **Gmail SMTP** — Mail gönderimi
