# MongoDB Schema Analysis — سفر ليبيا (Safar Libya)

> **Phase 1 only** — read-only analysis. MongoDB was **not** modified.

## Connection & environment

| Item | Value |
|---|---|
| Database name | `safar_libya` |
| Analyzed at (UTC) | 2026-08-02T09:21:48.973Z |
| Collection count | 26 |
| Backend | Node.js / Express / Mongoose |
| Connection config | `MONGODB_URI` in `backend/.env` (credentials not printed) |
| ID style | String IDs (cuid-like), **not** BSON ObjectId — often ~25 chars |

## Collections overview

| # | Collection | Documents |
|---:|---|---:|
| 1 | `activitylogs` | 12 |
| 2 | `appsettings` | 3 |
| 3 | `bookings` | 41 |
| 4 | `cities` | 14 |
| 5 | `contactmessages` | 1 |
| 6 | `couponredemptions` | 1 |
| 7 | `coupons` | 1 |
| 8 | `emailverificationtokens` | 9 |
| 9 | `exchangerates` | 5 |
| 10 | `favorites` | 22 |
| 11 | `ledgerentries` | 47 |
| 12 | `loyaltyaccounts` | 6 |
| 13 | `loyaltytxns` | 12 |
| 14 | `notifications` | 85 |
| 15 | `otpchallenges` | 22 |
| 16 | `passwordresettokens` | 3 |
| 17 | `properties` | 69 |
| 18 | `propertyupdates` | 16 |
| 19 | `refreshtokens` | 177 |
| 20 | `refunds` | 9 |
| 21 | `reviews` | 8 |
| 22 | `users` | 140 |
| 23 | `wallets` | 10 |
| 24 | `wallettopups` | 0 |
| 25 | `wallettxns` | 14 |
| 26 | `withdrawalrequests` | 2 |
| | **Total documents** | **729** |

---

## Collection: `activitylogs`

- **Document count:** 12
- **Indexes:**
  - `_id_`: {"_id":1}
  - `actorId_1`: {"actorId":1}
  - `action_1`: {"action":1}
  - `entityType_1`: {"entityType":1}
  - `entityId_1`: {"entityId":1}
  - `createdAt_-1`: {"createdAt":-1}

### Fields & types

- `_id`: string
- `actorId`: string
- `actorEmail`: string
- `actorName`: string
- `action`: string
- `entityType`: string
- `entityId`: string
- `meta`: object
  - `amountLyd`: number
  - `amountTnd`: number
  - `refundId`: string
  - `type`: string
  - `reasonCode`: string
  - `email`: string
  - `role`: string
  - `status`: string
- `createdAt`: date
- `__v`: number

### Nested objects
- `meta`

### Arrays
_None detected in scanned documents._

### Reference-like fields (string IDs → other collections)
- `actorId` → string id (ref-like)
- `entityId` → string id (ref-like)

### Sample documents (redacted, up to 3)

<details>
<summary>Sample 1 — _id=cmrxh9koi3e27fc2db104e20a47de</summary>

```json
{
  "_id": "cmrxh9koi3e27fc2db104e20a47de",
  "actorId": "cmrnmickea06afabc371e0511252d",
  "actorEmail": "admin@safarlibya.com",
  "actorName": "Safar Libya Admin",
  "action": "withdrawal.approve",
  "entityType": "withdrawal",
  "entityId": "cmrxh9kmk836d471f23a692a3ce3f",
  "meta": {
    "amountLyd": 76,
    "amountTnd": 50
  },
  "createdAt": "2026-07-23T12:18:37.170Z",
  "__v": 0
}
```

</details>

<details>
<summary>Sample 2 — _id=cmrxh9krv764b02b09d977c35fac1</summary>

```json
{
  "_id": "cmrxh9krv764b02b09d977c35fac1",
  "actorId": "cmrnmickea06afabc371e0511252d",
  "actorEmail": "admin@safarlibya.com",
  "actorName": "Safar Libya Admin",
  "action": "refund.process",
  "entityType": "booking",
  "entityId": "cmrnmicrzb4ed00ea6e89a61ca559",
  "meta": {
    "refundId": "cmrxh9kr94ceca52d634a1cb1bd13",
    "type": "PARTIAL",
    "amountLyd": 5,
    "reasonCode": "ADMIN_ADJUSTMENT"
  },
  "createdAt": "2026-07-23T12:18:37.291Z",
  "__v": 0
}
```

</details>

<details>
<summary>Sample 3 — _id=cmrxh9kub922f78153608d30d9cbd</summary>

```json
{
  "_id": "cmrxh9kub922f78153608d30d9cbd",
  "actorId": "cmrnmickea06afabc371e0511252d",
  "actorEmail": "admin@safarlibya.com",
  "actorName": "Safar Libya Admin",
  "action": "refund.process",
  "entityType": "booking",
  "entityId": "cmrnmics3ab94fafe89ea6e38f6eb",
  "meta": {
    "refundId": "cmrxh9ku368586452ef80f6c7e651",
    "type": "FULL",
    "amountLyd": 1084.82,
    "reasonCode": "ADMIN_ADJUSTMENT"
  },
  "createdAt": "2026-07-23T12:18:37.379Z",
  "__v": 0
}
```

</details>


---

## Collection: `appsettings`

- **Document count:** 3
- **Indexes:**
  - `_id_`: {"_id":1}
  - `key_1`: {"key":1} UNIQUE

### Fields & types

- `_id`: string
- `key`: string
- `value`: object
  - `name`: string
  - `defaultLocale`: string
  - `supportEmail`: string
  - `walletEnabled`: boolean
  - `loyaltyEnabled`: boolean
  - `couponsEnabled`: boolean
  - `pointsPerLyd`: number
  - `tndPerPoint`: number
  - `minRedeemPoints`: number
  - `maxRedeemPercentOfSubtotal`: number
  - `ownerRejectRefundPercent`: number
  - `refundTiers`: array (array)
    - `[element]`: object
      - `hoursBeforeCheckIn`: number
      - `refundPercent`: number
  - `seq`: number
- `createdAt`: date
- `updatedAt`: date
- `__v`: number

### Nested objects
- `value`

### Arrays
_None detected in scanned documents._

### Reference-like fields (string IDs → other collections)
_None._

### Sample documents (redacted, up to 3)

<details>
<summary>Sample 1 — _id=cmrnmicokd03a7ac23d0626b8125f</summary>

```json
{
  "_id": "cmrnmicokd03a7ac23d0626b8125f",
  "key": "platform",
  "value": {
    "name": "Safar Libya",
    "defaultLocale": "ar",
    "supportEmail": "support@safarlibya.com"
  },
  "createdAt": "2026-07-16T14:47:43.028Z",
  "updatedAt": "2026-07-16T14:47:43.028Z",
  "__v": 0
}
```

</details>

<details>
<summary>Sample 2 — _id=cmrvtt8dkc7c8e07eb5281093fb67</summary>

```json
{
  "_id": "cmrvtt8dkc7c8e07eb5281093fb67",
  "key": "commerce",
  "__v": 0,
  "createdAt": "2026-07-22T08:34:17.383Z",
  "updatedAt": "2026-07-22T08:34:17.384Z",
  "value": {
    "walletEnabled": true,
    "loyaltyEnabled": true,
    "couponsEnabled": true,
    "pointsPerLyd": 1,
    "tndPerPoint": 0.01,
    "minRedeemPoints": 100,
    "maxRedeemPercentOfSubtotal": 20,
    "ownerRejectRefundPercent": 100,
    "refundTiers": [
      {
        "hoursBeforeCheckIn": 48,
        "refundPercent": 100
      },
      {
        "hoursBeforeCheckIn": 24,
        "refundPercent": 50
      },
      {
        "hoursBeforeCheckIn": 0,
        "refundPercent": 0
      }
    ]
  }
}
```

</details>

<details>
<summary>Sample 3 — _id=cmrvxi3cw2fd14e3a40fdbac78355</summary>

```json
{
  "_id": "cmrvxi3cw2fd14e3a40fdbac78355",
  "key": "invoice_seq_2026",
  "__v": 0,
  "createdAt": "2026-07-22T10:17:36.121Z",
  "updatedAt": "2026-07-30T23:25:17.380Z",
  "value": {
    "seq": 11
  }
}
```

</details>


---

## Collection: `bookings`

- **Document count:** 41
- **Indexes:**
  - `_id_`: {"_id":1}
  - `customerId_1_status_1`: {"customerId":1,"status":1}
  - `ownerId_1_status_1`: {"ownerId":1,"status":1}
  - `propertyId_1_checkIn_1_checkOut_1`: {"propertyId":1,"checkIn":1,"checkOut":1}
  - `deletedAt_1`: {"deletedAt":1}
  - `payment.status_1`: {"payment.status":1}
  - `invoice.invoiceNumber_1`: {"invoice.invoiceNumber":1} UNIQUE sparse

### Fields & types

- `_id`: string
- `propertyId`: string
- `customerId`: string
- `ownerId`: string
- `checkIn`: date
- `checkOut`: date
- `guests`: number
- `nights`: number
- `status`: string
- `exchangeFromCurrency`: string
- `exchangeToCurrency`: string
- `exchangeRateRate`: number
- `exchangeRateLockedAt`: date
- `exchangeRateExpiresAt`: date
- `subtotalTnd`: number
- `cleaningFeeTnd`: number
- `platformFeeTnd`: number
- `taxesTnd`: number
- `discountTnd`: number
- `totalTnd`: number
- `totalLyd`: number
- `ownerPayoutTnd`: number
- `payment`: object
  - `_id`: string
  - `provider`: string
  - `status`: string
  - `amount`: number
  - `currency`: string
  - `paidAt`: date
  - `createdAt`: date
  - `updatedAt`: date
  - `metadata`: object
    - `refundLyd`: number
    - `refundPercent`: number
    - `lastRefundId`: string
    - `lastRefundReason`: string
    - `note`: string
    - `walletPaidLyd`: number
    - `demoPaidLyd`: number
    - `refundReason`: string
  - `providerRef`: string
- `invoice`: object
  - `_id`: string
  - `invoiceNumber`: string
  - `total`: number
  - `currency`: string
  - `issuedAt`: date
  - `createdAt`: date
  - `bookingId`: string
  - `guestName`: string
  - `guestEmail`: string
  - `guestPhone`: string [nullish in scan: 3]
  - `propertyTitleAr`: string
  - `propertyTitleEn`: string
  - `propertyAddress`: string
  - `cityNameAr`: string
  - `cityNameEn`: string
  - `hostName`: string
  - `checkIn`: date
  - `checkOut`: date
  - `nights`: number
  - `guests`: number
  - `nightlyRateTnd`: number
  - `subtotalTnd`: number
  - `cleaningFeeTnd`: number
  - `platformFeeTnd`: number
  - `taxesTnd`: number
  - `discountTnd`: number
  - `totalTnd`: number
  - `totalLyd`: number
  - `exchangeRateRate`: number
  - `paymentStatus`: string
  - `paymentProvider`: string
  - `bookingStatus`: string
- `createdAt`: date
- `updatedAt`: date
- `__v`: number
- `pointsDiscountTnd`: number
- `pointsEarned`: number
- `pointsRedeemed`: number
- `refundLyd`: number
- `refundPercent`: number
- `walletPaidLyd`: number
- `cancelledAt`: date
- `cancelledBy`: string
- `deletedAt`: date
- `couponCode`: string

### Nested objects
- `payment`
- `invoice`

### Arrays
_None detected in scanned documents._

### Reference-like fields (string IDs → other collections)
- `propertyId` → string id (ref-like)
- `customerId` → string id (ref-like)
- `ownerId` → string id (ref-like)

### Sample documents (redacted, up to 3)

<details>
<summary>Sample 1 — _id=cmrnmicre22b6057babef01babada</summary>

```json
{
  "_id": "cmrnmicre22b6057babef01babada",
  "propertyId": "cmrnmicot6f4cf02b41b43f9ac58d",
  "customerId": "cmrnmiclc7ca868cffad1a455000e",
  "ownerId": "cmrnmicklb2a300334ec1dc766990",
  "checkIn": "2026-07-23T14:47:43.129Z",
  "checkOut": "2026-07-26T14:47:43.129Z",
  "guests": 2,
  "nights": 3,
  "status": "CANCELLED",
  "exchangeFromCurrency": "TND",
  "exchangeToCurrency": "LYD",
  "exchangeRateRate": 1.52,
  "exchangeRateLockedAt": "2026-07-16T14:47:43.129Z",
  "exchangeRateExpiresAt": "2026-07-16T15:02:43.129Z",
  "subtotalTnd": 420,
  "cleaningFeeTnd": 35,
  "platformFeeTnd": 54.6,
  "taxesTnd": 45.5,
  "discountTnd": 0,
  "totalTnd": 555.1,
  "totalLyd": 843.75,
  "ownerPayoutTnd": 400.4,
  "payment": {
    "_id": "cmrnmicrd3f3e3e9cbb936eb64866",
    "provider": "DEMO",
    "status": "REFUNDED",
    "amount": 843.75,
    "currency": "LYD",
    "paidAt": "2026-07-16T14:47:43.129Z",
    "createdAt": "2026-07-16T14:47:43.129Z",
    "updatedAt": "2026-07-23T11:00:02.988Z",
    "metadata": {
      "refundLyd": 843.75,
      "refundPercent": 100,
      "lastRefundId": "cmrxegj6x7450308a38d3ba00e7b3",
      "lastRefundReason": "ADMIN_ADJUSTMENT"
    }
  },
  "invoice": {
    "_id": "cmrnmicrd6871437509cd4d8b2c7a",
    "invoiceNumber": "INV-SEED-1000",
    "total": 843.75,
    "currency": "LYD",
    "issuedAt": "2026-07-16T14:47:43.130Z",
    "createdAt": "2026-07-16T14:47:43.130Z"
  },
  "createdAt": "2026-07-16T14:47:43.131Z",
  "updatedAt": "2026-07-23T11:00:02.990Z",
  "__v": 0,
  "pointsDiscountTnd": 0,
  "pointsEarned": 0,
  "pointsRedeemed": 0,
  "refundLyd": 843.75,
  "refundPercent": 100,
  "walletPaidLyd": 0
}
```

</details>

<details>
<summary>Sample 2 — _id=cmrnmicrzb4ed00ea6e89a61ca559</summary>

```json
{
  "_id": "cmrnmicrzb4ed00ea6e89a61ca559",
  "propertyId": "cmrnmicozf70ff88a37f5ae3f93a1",
  "customerId": "cmrnmicld24d7a69e2fa852ff7154",
  "ownerId": "cmrnmickv552e410c875f78134c79",
  "checkIn": "2026-07-24T14:47:43.151Z",
  "checkOut": "2026-07-27T14:47:43.151Z",
  "guests": 2,
  "nights": 3,
  "status": "CONFIRMED",
  "exchangeFromCurrency": "TND",
  "exchangeToCurrency": "LYD",
  "exchangeRateRate": 1.52,
  "exchangeRateLockedAt": "2026-07-16T14:47:43.151Z",
  "exchangeRateExpiresAt": "2026-07-16T15:02:43.151Z",
  "subtotalTnd": 480,
  "cleaningFeeTnd": 40,
  "platformFeeTnd": 62.4,
  "taxesTnd": 52,
  "discountTnd": 0,
  "totalTnd": 634.4,
  "totalLyd": 964.29,
  "ownerPayoutTnd": 457.6,
  "payment": {
    "_id": "cmrnmicrz82643e9221f973545e1a",
    "provider": "DEMO",
    "status": "PARTIALLY_REFUNDED",
    "amount": 964.29,
    "currency": "LYD",
    "paidAt": "2026-07-16T14:47:43.151Z",
    "createdAt": "2026-07-16T14:47:43.151Z",
    "updatedAt": "2026-07-23T12:18:37.277Z",
    "metadata": {
      "refundLyd": 5,
      "refundPercent": 0.52,
      "lastRefundId": "cmrxh9kr94ceca52d634a1cb1bd13",
      "lastRefundReason": "ADMIN_ADJUSTMENT"
    }
  },
  "invoice": {
    "_id": "cmrnmicrz8897222eb40ee1d154a6",
    "invoiceNumber": "INV-SEED-1001",
    "total": 964.29,
    "currency": "LYD",
    "issuedAt": "2026-07-16T14:47:43.151Z",
    "createdAt": "2026-07-16T14:47:43.151Z"
  },
  "createdAt": "2026-07-16T14:47:43.151Z",
  "updatedAt": "2026-07-23T12:18:37.277Z",
  "__v": 0,
  "pointsDiscountTnd": 0,
  "pointsEarned": 0,
  "pointsRedeemed": 0,
  "refundLyd": 5,
  "refundPercent": 0.52,
  "walletPaidLyd": 0
}
```

</details>

<details>
<summary>Sample 3 — _id=cmrnmics3ab94fafe89ea6e38f6eb</summary>

```json
{
  "_id": "cmrnmics3ab94fafe89ea6e38f6eb",
  "propertyId": "cmrnmicp10d518cd72d9a78a450dd",
  "customerId": "cmrnmiclef6bc05c7e1ffa0d375a4",
  "ownerId": "cmrnmickx381a4084ff4149b43c17",
  "checkIn": "2026-07-25T14:47:43.155Z",
  "checkOut": "2026-07-28T14:47:43.155Z",
  "guests": 2,
  "nights": 3,
  "status": "CANCELLED",
  "exchangeFromCurrency": "TND",
  "exchangeToCurrency": "LYD",
  "exchangeRateRate": 1.52,
  "exchangeRateLockedAt": "2026-07-16T14:47:43.155Z",
  "exchangeRateExpiresAt": "2026-07-16T15:02:43.155Z",
  "subtotalTnd": 540,
  "cleaningFeeTnd": 45,
  "platformFeeTnd": 70.2,
  "taxesTnd": 58.5,
  "discountTnd": 0,
  "totalTnd": 713.7,
  "totalLyd": 1084.82,
  "ownerPayoutTnd": 514.8,
  "payment": {
    "_id": "cmrnmics3bfa761e8c8bc78ffcabc",
    "provider": "DEMO",
    "status": "REFUNDED",
    "amount": 1084.82,
    "currency": "LYD",
    "paidAt": "2026-07-16T14:47:43.155Z",
    "createdAt": "2026-07-16T14:47:43.155Z",
    "updatedAt": "2026-07-23T12:18:37.373Z",
    "metadata": {
      "refundLyd": 1084.82,
      "refundPercent": 100,
      "lastRefundId": "cmrxh9ku368586452ef80f6c7e651",
      "lastRefundReason": "ADMIN_ADJUSTMENT"
    }
  },
  "invoice": {
    "_id": "cmrnmics3ec45b9342074b20747bb",
    "invoiceNumber": "INV-SEED-1002",
    "total": 1084.82,
    "currency": "LYD",
    "issuedAt": "2026-07-16T14:47:43.155Z",
    "createdAt": "2026-07-16T14:47:43.155Z"
  },
  "createdAt": "2026-07-16T14:47:43.155Z",
  "updatedAt": "2026-07-23T12:18:37.374Z",
  "__v": 0,
  "pointsDiscountTnd": 0,
  "pointsEarned": 0,
  "pointsRedeemed": 0,
  "refundLyd": 1084.82,
  "refundPercent": 100,
  "walletPaidLyd": 0
}
```

</details>


---

## Collection: `cities`

- **Document count:** 14
- **Indexes:**
  - `_id_`: {"_id":1}
  - `nameEn_1`: {"nameEn":1} UNIQUE
  - `slug_1`: {"slug":1} UNIQUE
  - `deletedAt_1`: {"deletedAt":1}
  - `aliases_1`: {"aliases":1}
  - `isTourist_1`: {"isTourist":1}

### Fields & types

- `_id`: string
- `nameAr`: string
- `nameEn`: string
- `slug`: string
- `country`: string
- `imageUrl`: string
- `createdAt`: date
- `updatedAt`: date
- `__v`: number
- `aliases`: array (array)
  - `[element]`: string
- `blurbAr`: string
- `blurbEn`: string
- `deletedAt`: unknown [nullish in scan: 14]
- `isTourist`: boolean
- `region`: string

### Nested objects
_None detected in scanned documents._

### Arrays
- `aliases` — array (string)

### Reference-like fields (string IDs → other collections)
_None._

### Sample documents (redacted, up to 3)

<details>
<summary>Sample 1 — _id=cmrnmico07d2beee5b259d25f983a</summary>

```json
{
  "_id": "cmrnmico07d2beee5b259d25f983a",
  "nameAr": "تونس",
  "nameEn": "Tunis",
  "slug": "tunis",
  "country": "Tunisia",
  "imageUrl": "/images/city-tunis.jpg",
  "createdAt": "2026-07-16T14:47:43.009Z",
  "updatedAt": "2026-07-22T07:02:06.831Z",
  "__v": 0,
  "aliases": [
    "Tunis City",
    "Tunisia capital",
    "العاصمة",
    "تونس العاصمة"
  ],
  "blurbAr": "عاصمة تونس بمدينتها العتيقة ومتاحفها وقربها من المطار للرحلات العلاجية والعمل.",
  "blurbEn": "Capital medina, museums, and easy airport access for medical and business trips.",
  "deletedAt": null,
  "isTourist": true,
  "region": "Greater Tunis"
}
```

</details>

<details>
<summary>Sample 2 — _id=cmrnmico76752ba0fb65a769ced7f</summary>

```json
{
  "_id": "cmrnmico76752ba0fb65a769ced7f",
  "nameAr": "سوسة",
  "nameEn": "Sousse",
  "slug": "sousse",
  "country": "Tunisia",
  "imageUrl": "/images/city-sousse.jpg",
  "createdAt": "2026-07-16T14:47:43.015Z",
  "updatedAt": "2026-07-22T07:02:06.895Z",
  "__v": 0,
  "aliases": [
    "Sousse Medina",
    "Susa",
    "Port El Kantaoui"
  ],
  "blurbAr": "مدينة عتيقة مدرجة في اليونسكو وشواطئ وميناء القنطاوي.",
  "blurbEn": "UNESCO medina, beaches, and Port El Kantaoui marina stays.",
  "deletedAt": null,
  "isTourist": true,
  "region": "Sahel"
}
```

</details>

<details>
<summary>Sample 3 — _id=cmrnmico86227a73653d44b515823</summary>

```json
{
  "_id": "cmrnmico86227a73653d44b515823",
  "nameAr": "صفاقس",
  "nameEn": "Sfax",
  "slug": "sfax",
  "country": "Tunisia",
  "imageUrl": "/images/city-sfax.jpg",
  "createdAt": "2026-07-16T14:47:43.016Z",
  "updatedAt": "2026-07-22T07:02:06.902Z",
  "__v": 0,
  "aliases": [
    "Safaqis"
  ],
  "blurbAr": "مركز أعمال مع شقق عملية للإقامات الطويلة.",
  "blurbEn": "Business hub with practical apartments for longer Libyan stays.",
  "deletedAt": null,
  "isTourist": false,
  "region": "Center-East"
}
```

</details>


---

## Collection: `contactmessages`

- **Document count:** 1
- **Indexes:**
  - `_id_`: {"_id":1}
  - `createdAt_-1`: {"createdAt":-1}

### Fields & types

- `_id`: string
- `userId`: string
- `name`: string
- `email`: string
- `subject`: string
- `message`: string
- `createdAt`: date
- `__v`: number

### Nested objects
_None detected in scanned documents._

### Arrays
_None detected in scanned documents._

### Reference-like fields (string IDs → other collections)
- `userId` → string id (ref-like)

### Sample documents (redacted, up to 3)

<details>
<summary>Sample 1 — _id=cmrxb1ih5986cc2d55557166576bf</summary>

```json
{
  "_id": "cmrxb1ih5986cc2d55557166576bf",
  "userId": "cmrvyzc02f23144198d583d3c82dd",
  "name": "برةنثقةرنم",
  "email": "salehtarek46@gmail.com",
  "subject": "mmlcwvml`",
  "message": "dlwvjmlevn",
  "createdAt": "2026-07-23T09:24:23.371Z",
  "__v": 0
}
```

</details>


---

## Collection: `couponredemptions`

- **Document count:** 1
- **Indexes:**
  - `_id_`: {"_id":1}
  - `couponId_1`: {"couponId":1}
  - `userId_1`: {"userId":1}
  - `bookingId_1`: {"bookingId":1} UNIQUE
  - `couponId_1_userId_1`: {"couponId":1,"userId":1}

### Fields & types

- `_id`: string
- `couponId`: string
- `userId`: string
- `bookingId`: string
- `discountTnd`: number
- `code`: string
- `createdAt`: date
- `__v`: number

### Nested objects
_None detected in scanned documents._

### Arrays
_None detected in scanned documents._

### Reference-like fields (string IDs → other collections)
- `couponId` → string id (ref-like)
- `userId` → string id (ref-like)
- `bookingId` → string id (ref-like)

### Sample documents (redacted, up to 3)

<details>
<summary>Sample 1 — _id=cms1yc1vcedc338f6b3118d979549</summary>

```json
{
  "_id": "cms1yc1vcedc338f6b3118d979549",
  "couponId": "cms1yapxzd8f7e2f4c30e4f9a3b40",
  "userId": "cmrt672jtcf383ba2d29f121c8fd2",
  "bookingId": "cms1ybxp508705d86da8f564dd997",
  "discountTnd": 234,
  "code": "S2022",
  "createdAt": "2026-07-26T15:27:30.936Z",
  "__v": 0
}
```

</details>


---

## Collection: `coupons`

- **Document count:** 1
- **Indexes:**
  - `_id_`: {"_id":1}
  - `code_1`: {"code":1} UNIQUE
  - `active_1`: {"active":1}

### Fields & types

- `_id`: string
- `code`: string
- `type`: string
- `value`: number
- `maxUses`: number
- `usedCount`: number
- `active`: boolean
- `createdAt`: date
- `updatedAt`: date
- `__v`: number

### Nested objects
_None detected in scanned documents._

### Arrays
_None detected in scanned documents._

### Reference-like fields (string IDs → other collections)
_None._

### Sample documents (redacted, up to 3)

<details>
<summary>Sample 1 — _id=cms1yapxzd8f7e2f4c30e4f9a3b40</summary>

```json
{
  "_id": "cms1yapxzd8f7e2f4c30e4f9a3b40",
  "code": "S2022",
  "type": "PERCENT",
  "value": 20,
  "maxUses": 10,
  "usedCount": 1,
  "active": false,
  "createdAt": "2026-07-26T15:26:28.824Z",
  "updatedAt": "2026-07-30T23:30:23.543Z",
  "__v": 0
}
```

</details>


---

## Collection: `emailverificationtokens`

- **Document count:** 9
- **Indexes:**
  - `_id_`: {"_id":1}
  - `userId_1`: {"userId":1}
  - `tokenHash_1`: {"tokenHash":1} UNIQUE

### Fields & types

- `_id`: string
- `userId`: string
- `tokenHash`: string
- `expiresAt`: date
- `createdAt`: date
- `__v`: number

### Nested objects
_None detected in scanned documents._

### Arrays
_None detected in scanned documents._

### Reference-like fields (string IDs → other collections)
- `userId` → string id (ref-like)

### Sample documents (redacted, up to 3)

<details>
<summary>Sample 1 — _id=cmrnmn09q9a86c5c63ec05510f7ed</summary>

```json
{
  "_id": "cmrnmn09q9a86c5c63ec05510f7ed",
  "userId": "cmrnmn097e81f267cce42a2f172dc",
  "tokenHash": "[REDACTED]",
  "expiresAt": "2026-07-17T14:51:20.222Z",
  "createdAt": "2026-07-16T14:51:20.223Z",
  "__v": 0
}
```

</details>

<details>
<summary>Sample 2 — _id=cmrnmnxnd5b01e9788c66c64a8c05</summary>

```json
{
  "_id": "cmrnmnxnd5b01e9788c66c64a8c05",
  "userId": "cmrnmnxna50c983089d235de2e63c",
  "tokenHash": "[REDACTED]",
  "expiresAt": "2026-07-17T14:52:03.481Z",
  "createdAt": "2026-07-16T14:52:03.481Z",
  "__v": 0
}
```

</details>

<details>
<summary>Sample 3 — _id=cmrnmptzs94b9c940a368f8d97c14</summary>

```json
{
  "_id": "cmrnmptzs94b9c940a368f8d97c14",
  "userId": "cmrnmptzp90e5647c15f2b1ce660a",
  "tokenHash": "[REDACTED]",
  "expiresAt": "2026-07-17T14:53:32.056Z",
  "createdAt": "2026-07-16T14:53:32.057Z",
  "__v": 0
}
```

</details>


---

## Collection: `exchangerates`

- **Document count:** 5
- **Indexes:**
  - `_id_`: {"_id":1}
  - `fromCurrency_1_toCurrency_1_validFrom_-1`: {"fromCurrency":1,"toCurrency":1,"validFrom":-1}

### Fields & types

- `_id`: string
- `fromCurrency`: string
- `toCurrency`: string
- `rate`: number
- `updatedById`: string
- `validFrom`: date
- `createdAt`: date
- `__v`: number
- `validTo`: date

### Nested objects
_None detected in scanned documents._

### Arrays
_None detected in scanned documents._

### Reference-like fields (string IDs → other collections)
- `updatedById` → string id (ref-like)

### Sample documents (redacted, up to 3)

<details>
<summary>Sample 1 — _id=cmrnmicob20e46963d5d672239581</summary>

```json
{
  "_id": "cmrnmicob20e46963d5d672239581",
  "fromCurrency": "TND",
  "toCurrency": "LYD",
  "rate": 1.52,
  "updatedById": "cmrnmickea06afabc371e0511252d",
  "validFrom": "2026-07-16T14:47:43.019Z",
  "createdAt": "2026-07-16T14:47:43.020Z",
  "__v": 0,
  "validTo": "2026-07-19T12:20:53.163Z"
}
```

</details>

<details>
<summary>Sample 2 — _id=cmrrrl2ya7d23c02eb0e6746f4e3b</summary>

```json
{
  "_id": "cmrrrl2ya7d23c02eb0e6746f4e3b",
  "fromCurrency": "TND",
  "toCurrency": "LYD",
  "rate": 1.52,
  "updatedById": "cmrnmickea06afabc371e0511252d",
  "validFrom": "2026-07-19T12:20:53.170Z",
  "createdAt": "2026-07-19T12:20:53.172Z",
  "__v": 0,
  "validTo": "2026-07-21T11:08:37.832Z"
}
```

</details>

<details>
<summary>Sample 3 — _id=cmrujvv4d7ad80685b5b1fd488963</summary>

```json
{
  "_id": "cmrujvv4d7ad80685b5b1fd488963",
  "fromCurrency": "TND",
  "toCurrency": "LYD",
  "rate": 1.52,
  "updatedById": "cmrnmickea06afabc371e0511252d",
  "validFrom": "2026-07-21T11:08:37.838Z",
  "createdAt": "2026-07-21T11:08:37.839Z",
  "__v": 0,
  "validTo": "2026-07-26T15:25:50.195Z"
}
```

</details>


---

## Collection: `favorites`

- **Document count:** 22
- **Indexes:**
  - `_id_`: {"_id":1}
  - `userId_1`: {"userId":1}
  - `userId_1_propertyId_1`: {"userId":1,"propertyId":1} UNIQUE

### Fields & types

- `_id`: string
- `userId`: string
- `propertyId`: string
- `createdAt`: date
- `__v`: number

### Nested objects
_None detected in scanned documents._

### Arrays
_None detected in scanned documents._

### Reference-like fields (string IDs → other collections)
- `userId` → string id (ref-like)
- `propertyId` → string id (ref-like)

### Sample documents (redacted, up to 3)

<details>
<summary>Sample 1 — _id=cmrnmicrn81a781d85dc8eaa9b5d9</summary>

```json
{
  "_id": "cmrnmicrn81a781d85dc8eaa9b5d9",
  "userId": "cmrnmiclc7ca868cffad1a455000e",
  "propertyId": "cmrnmicp3b55cdf323033ab9e9e8d",
  "createdAt": "2026-07-16T14:47:43.139Z",
  "__v": 0
}
```

</details>

<details>
<summary>Sample 2 — _id=cmrnmics07a690b6196159c03772f</summary>

```json
{
  "_id": "cmrnmics07a690b6196159c03772f",
  "userId": "cmrnmicld24d7a69e2fa852ff7154",
  "propertyId": "cmrnmicp50056d501c9892b76eed9",
  "createdAt": "2026-07-16T14:47:43.152Z",
  "__v": 0
}
```

</details>

<details>
<summary>Sample 3 — _id=cmrnmicsac93e55650aba0ba11823</summary>

```json
{
  "_id": "cmrnmicsac93e55650aba0ba11823",
  "userId": "cmrnmiclef6bc05c7e1ffa0d375a4",
  "propertyId": "cmrnmicp7ef86164bbff49749166e",
  "createdAt": "2026-07-16T14:47:43.163Z",
  "__v": 0
}
```

</details>


---

## Collection: `ledgerentries`

- **Document count:** 47
- **Indexes:**
  - `_id_`: {"_id":1}
  - `type_1`: {"type":1}
  - `bookingId_1`: {"bookingId":1}
  - `partyUserId_1`: {"partyUserId":1}
  - `createdAt_-1`: {"createdAt":-1}
  - `type_1_createdAt_-1`: {"type":1,"createdAt":-1}
  - `bookingId_1_type_1`: {"bookingId":1,"type":1} UNIQUE
  - `withdrawalId_1_type_1`: {"withdrawalId":1,"type":1} UNIQUE

### Fields & types

- `_id`: string
- `type`: string
- `direction`: string
- `bookingId`: string
- `amountLyd`: number
- `amountTnd`: number
- `partyUserId`: string
- `partyRole`: string
- `status`: string
- `meta`: object
  - `platformFeeTnd`: number
  - `ownerPayoutTnd`: number
  - `platformFeeLyd`: number
  - `platformFeeClawbackTnd`: number
  - `ownerPayoutClawbackTnd`: number
  - `reasonCode`: string
  - `source`: string
- `createdAt`: date
- `updatedAt`: date
- `__v`: number
- `refundId`: string
- `withdrawalId`: string

### Nested objects
- `meta`

### Arrays
_None detected in scanned documents._

### Reference-like fields (string IDs → other collections)
- `bookingId` → string id (ref-like)
- `partyUserId` → string id (ref-like)
- `refundId` → string id (ref-like)
- `withdrawalId` → string id (ref-like)

### Sample documents (redacted, up to 3)

<details>
<summary>Sample 1 — _id=cmrxefsz92cc9cae9255bcfee8912</summary>

```json
{
  "_id": "cmrxefsz92cc9cae9255bcfee8912",
  "type": "BOOKING_PAYMENT",
  "direction": "IN",
  "bookingId": "cmrnmicre22b6057babef01babada",
  "amountLyd": 843.75,
  "amountTnd": 555.1,
  "partyUserId": "cmrnmiclc7ca868cffad1a455000e",
  "partyRole": "CUSTOMER",
  "status": "POSTED",
  "meta": {
    "platformFeeTnd": 54.6,
    "ownerPayoutTnd": 400.4,
    "platformFeeLyd": 82.99
  },
  "createdAt": "2026-07-23T10:59:29.017Z",
  "updatedAt": "2026-07-23T10:59:29.017Z",
  "__v": 0
}
```

</details>

<details>
<summary>Sample 2 — _id=cmrxefszw59f7ff7afe0c902dc0b5</summary>

```json
{
  "_id": "cmrxefszw59f7ff7afe0c902dc0b5",
  "type": "BOOKING_PAYMENT",
  "direction": "IN",
  "bookingId": "cmrnmicrzb4ed00ea6e89a61ca559",
  "amountLyd": 964.29,
  "amountTnd": 634.4,
  "partyUserId": "cmrnmicld24d7a69e2fa852ff7154",
  "partyRole": "CUSTOMER",
  "status": "POSTED",
  "meta": {
    "platformFeeTnd": 62.4,
    "ownerPayoutTnd": 457.6,
    "platformFeeLyd": 94.85
  },
  "createdAt": "2026-07-23T10:59:29.036Z",
  "updatedAt": "2026-07-23T10:59:29.036Z",
  "__v": 0
}
```

</details>

<details>
<summary>Sample 3 — _id=cmrxeft01950d6a7c78ebd2a3db60</summary>

```json
{
  "_id": "cmrxeft01950d6a7c78ebd2a3db60",
  "type": "BOOKING_PAYMENT",
  "direction": "IN",
  "bookingId": "cmrnmics3ab94fafe89ea6e38f6eb",
  "amountLyd": 1084.82,
  "amountTnd": 713.7,
  "partyUserId": "cmrnmiclef6bc05c7e1ffa0d375a4",
  "partyRole": "CUSTOMER",
  "status": "POSTED",
  "meta": {
    "platformFeeTnd": 70.2,
    "ownerPayoutTnd": 514.8,
    "platformFeeLyd": 106.7
  },
  "createdAt": "2026-07-23T10:59:29.041Z",
  "updatedAt": "2026-07-23T10:59:29.041Z",
  "__v": 0
}
```

</details>


---

## Collection: `loyaltyaccounts`

- **Document count:** 6
- **Indexes:**
  - `_id_`: {"_id":1}
  - `userId_1`: {"userId":1} UNIQUE

### Fields & types

- `_id`: string
- `userId`: string
- `points`: number
- `createdAt`: date
- `updatedAt`: date
- `__v`: number

### Nested objects
_None detected in scanned documents._

### Arrays
_None detected in scanned documents._

### Reference-like fields (string IDs → other collections)
- `userId` → string id (ref-like)

### Sample documents (redacted, up to 3)

<details>
<summary>Sample 1 — _id=cmrvtt8decac75ecc762399d498ca</summary>

```json
{
  "_id": "cmrvtt8decac75ecc762399d498ca",
  "userId": "cmrvtsuic736ad5151c3827da3051",
  "points": 3948,
  "createdAt": "2026-07-22T08:34:17.378Z",
  "updatedAt": "2026-07-22T11:39:46.130Z",
  "__v": 0
}
```

</details>

<details>
<summary>Sample 2 — _id=cmrvywcmfae7a339a34be6c6d299b</summary>

```json
{
  "_id": "cmrvywcmfae7a339a34be6c6d299b",
  "userId": "cmrt672jtcf383ba2d29f121c8fd2",
  "points": 14444,
  "createdAt": "2026-07-22T10:56:40.935Z",
  "updatedAt": "2026-07-26T15:30:04.483Z",
  "__v": 0
}
```

</details>

<details>
<summary>Sample 3 — _id=cmrw0hm6pacb7c96715105583a490</summary>

```json
{
  "_id": "cmrw0hm6pacb7c96715105583a490",
  "userId": "cmrnmickea06afabc371e0511252d",
  "points": 0,
  "createdAt": "2026-07-22T11:41:12.722Z",
  "updatedAt": "2026-07-22T11:41:12.722Z",
  "__v": 0
}
```

</details>


---

## Collection: `loyaltytxns`

- **Document count:** 12
- **Indexes:**
  - `_id_`: {"_id":1}
  - `userId_1`: {"userId":1}
  - `userId_1_createdAt_-1`: {"userId":1,"createdAt":-1}

### Fields & types

- `_id`: string
- `userId`: string
- `type`: string
- `delta`: number
- `pointsAfter`: number
- `bookingId`: string
- `note`: string
- `createdAt`: date
- `__v`: number

### Nested objects
_None detected in scanned documents._

### Arrays
_None detected in scanned documents._

### Reference-like fields (string IDs → other collections)
- `userId` → string id (ref-like)
- `bookingId` → string id (ref-like)

### Sample documents (redacted, up to 3)

<details>
<summary>Sample 1 — _id=cmrvx59qfe11e3d6fcf7d7cd8d65c</summary>

```json
{
  "_id": "cmrvx59qfe11e3d6fcf7d7cd8d65c",
  "userId": "cmrvtsuic736ad5151c3827da3051",
  "type": "EARN",
  "delta": 1121,
  "pointsAfter": 1121,
  "bookingId": "cmrvx55owf6b45374759b8be3a02d",
  "note": "Points earned from booking payment",
  "createdAt": "2026-07-22T10:07:37.864Z",
  "__v": 0
}
```

</details>

<details>
<summary>Sample 2 — _id=cmrvxi3c2235c14f0dacf6ee6e6f0</summary>

```json
{
  "_id": "cmrvxi3c2235c14f0dacf6ee6e6f0",
  "userId": "cmrvtsuic736ad5151c3827da3051",
  "type": "EARN",
  "delta": 751,
  "pointsAfter": 1872,
  "bookingId": "cmrvxfmdwad296aedcba550d6369e",
  "note": "Points earned from booking payment",
  "createdAt": "2026-07-22T10:17:36.100Z",
  "__v": 0
}
```

</details>

<details>
<summary>Sample 3 — _id=cmrw0frdh73e4abe59e8ff9c72acf</summary>

```json
{
  "_id": "cmrw0frdh73e4abe59e8ff9c72acf",
  "userId": "cmrvtsuic736ad5151c3827da3051",
  "type": "EARN",
  "delta": 2076,
  "pointsAfter": 3948,
  "bookingId": "cmrw0fmhj9c36875075be9593a2a5",
  "note": "Points earned from booking payment",
  "createdAt": "2026-07-22T11:39:46.133Z",
  "__v": 0
}
```

</details>


---

## Collection: `notifications`

- **Document count:** 85
- **Indexes:**
  - `_id_`: {"_id":1}
  - `userId_1_createdAt_-1`: {"userId":1,"createdAt":-1}
  - `userId_1_readAt_1`: {"userId":1,"readAt":1}

### Fields & types

- `_id`: string
- `userId`: string
- `titleAr`: string
- `titleEn`: string
- `messageAr`: string
- `messageEn`: string
- `link`: string
- `createdAt`: date
- `__v`: number

### Nested objects
_None detected in scanned documents._

### Arrays
_None detected in scanned documents._

### Reference-like fields (string IDs → other collections)
- `userId` → string id (ref-like)

### Sample documents (redacted, up to 3)

<details>
<summary>Sample 1 — _id=cmrnmicrt13d03d8274a6b4a1cc3c</summary>

```json
{
  "_id": "cmrnmicrt13d03d8274a6b4a1cc3c",
  "userId": "cmrnmiclc7ca868cffad1a455000e",
  "titleAr": "مرحباً بك في سفر ليبيا",
  "titleEn": "Welcome to Safar Libya",
  "messageAr": "حسابك جاهز للحجز والدفع بالدينار الليبي.",
  "messageEn": "Your account is ready to book and pay in LYD.",
  "link": "/dashboard/customer",
  "createdAt": "2026-07-16T14:47:43.145Z",
  "__v": 0
}
```

</details>

<details>
<summary>Sample 2 — _id=cmrnmics146af5abf7a5f9ac8a61b</summary>

```json
{
  "_id": "cmrnmics146af5abf7a5f9ac8a61b",
  "userId": "cmrnmicld24d7a69e2fa852ff7154",
  "titleAr": "مرحباً بك في سفر ليبيا",
  "titleEn": "Welcome to Safar Libya",
  "messageAr": "حسابك جاهز للحجز والدفع بالدينار الليبي.",
  "messageEn": "Your account is ready to book and pay in LYD.",
  "link": "/dashboard/customer",
  "createdAt": "2026-07-16T14:47:43.154Z",
  "__v": 0
}
```

</details>

<details>
<summary>Sample 3 — _id=cmrnmicsb51e9fa024558d25689ab</summary>

```json
{
  "_id": "cmrnmicsb51e9fa024558d25689ab",
  "userId": "cmrnmiclef6bc05c7e1ffa0d375a4",
  "titleAr": "مرحباً بك في سفر ليبيا",
  "titleEn": "Welcome to Safar Libya",
  "messageAr": "حسابك جاهز للحجز والدفع بالدينار الليبي.",
  "messageEn": "Your account is ready to book and pay in LYD.",
  "link": "/dashboard/customer",
  "createdAt": "2026-07-16T14:47:43.164Z",
  "__v": 0
}
```

</details>


---

## Collection: `otpchallenges`

- **Document count:** 22
- **Indexes:**
  - `_id_`: {"_id":1}
  - `userId_1`: {"userId":1}
  - `expiresAt_1`: {"expiresAt":1}
  - `userId_1_channel_1_consumedAt_1`: {"userId":1,"channel":1,"consumedAt":1}

### Fields & types

- `_id`: string
- `userId`: string
- `channel`: string
- `codeHash`: string
- `expiresAt`: date
- `attempts`: number
- `createdAt`: date
- `updatedAt`: date
- `__v`: number
- `consumedAt`: date

### Nested objects
_None detected in scanned documents._

### Arrays
_None detected in scanned documents._

### Reference-like fields (string IDs → other collections)
- `userId` → string id (ref-like)

### Sample documents (redacted, up to 3)

<details>
<summary>Sample 1 — _id=cmrt5uwsz9e60722b874a664e6056</summary>

```json
{
  "_id": "cmrt5uwsz9e60722b874a664e6056",
  "userId": "cmrt5uwsoac6df8a6c6855c8b3552",
  "channel": "EMAIL",
  "codeHash": "[REDACTED]",
  "expiresAt": "2026-07-20T11:58:12.559Z",
  "attempts": 1,
  "createdAt": "2026-07-20T11:48:12.563Z",
  "updatedAt": "2026-07-20T11:48:38.198Z",
  "__v": 0,
  "consumedAt": "2026-07-20T11:48:38.198Z"
}
```

</details>

<details>
<summary>Sample 2 — _id=cmrt5uwt42f6d91ba592974a5670a</summary>

```json
{
  "_id": "cmrt5uwt42f6d91ba592974a5670a",
  "userId": "cmrt5uwsoac6df8a6c6855c8b3552",
  "channel": "SMS",
  "codeHash": "[REDACTED]",
  "expiresAt": "2026-07-20T11:58:12.566Z",
  "attempts": 1,
  "createdAt": "2026-07-20T11:48:12.568Z",
  "updatedAt": "2026-07-20T11:48:38.209Z",
  "__v": 0,
  "consumedAt": "2026-07-20T11:48:38.208Z"
}
```

</details>

<details>
<summary>Sample 3 — _id=cmrt6076z1f899f82433ba27e65c1</summary>

```json
{
  "_id": "cmrt6076z1f899f82433ba27e65c1",
  "userId": "cmrt6076vf3d7719ff38b6e591068",
  "channel": "EMAIL",
  "codeHash": "[REDACTED]",
  "expiresAt": "2026-07-20T12:02:19.305Z",
  "attempts": 0,
  "createdAt": "2026-07-20T11:52:19.307Z",
  "updatedAt": "2026-07-20T11:52:19.307Z",
  "__v": 0
}
```

</details>


---

## Collection: `passwordresettokens`

- **Document count:** 3
- **Indexes:**
  - `_id_`: {"_id":1}
  - `userId_1`: {"userId":1}
  - `tokenHash_1`: {"tokenHash":1} UNIQUE

### Fields & types

- `_id`: string
- `userId`: string
- `tokenHash`: string
- `expiresAt`: date
- `createdAt`: date
- `__v`: number

### Nested objects
_None detected in scanned documents._

### Arrays
_None detected in scanned documents._

### Reference-like fields (string IDs → other collections)
- `userId` → string id (ref-like)

### Sample documents (redacted, up to 3)

<details>
<summary>Sample 1 — _id=cmrvs7pzf7b6c6c6e2cd7b9f99d72</summary>

```json
{
  "_id": "cmrvs7pzf7b6c6c6e2cd7b9f99d72",
  "userId": "cmrt672jtcf383ba2d29f121c8fd2",
  "tokenHash": "[REDACTED]",
  "expiresAt": "2026-07-22T08:49:34.155Z",
  "createdAt": "2026-07-22T07:49:34.156Z",
  "__v": 0
}
```

</details>

<details>
<summary>Sample 2 — _id=cmrxh9kvhf2c1b19f6ee3a0da303e</summary>

```json
{
  "_id": "cmrxh9kvhf2c1b19f6ee3a0da303e",
  "userId": "cmrxh9kvf37c7be17eacb797daf30",
  "tokenHash": "[REDACTED]",
  "expiresAt": "2026-07-30T12:18:37.421Z",
  "createdAt": "2026-07-23T12:18:37.421Z",
  "__v": 0
}
```

</details>

<details>
<summary>Sample 3 — _id=cmrxhbrz272cc2ebe9d977e3d0c80</summary>

```json
{
  "_id": "cmrxhbrz272cc2ebe9d977e3d0c80",
  "userId": "cmrxhbrz1e2a0b71905f4b98f0b65",
  "tokenHash": "[REDACTED]",
  "expiresAt": "2026-07-30T12:20:19.934Z",
  "createdAt": "2026-07-23T12:20:19.934Z",
  "__v": 0
}
```

</details>


---

## Collection: `properties`

- **Document count:** 69
- **Indexes:**
  - `_id_`: {"_id":1}
  - `maxGuests_1`: {"maxGuests":1}
  - `status_1_featured_1`: {"status":1,"featured":1}
  - `deletedAt_1`: {"deletedAt":1}
  - `ownerId_1`: {"ownerId":1}
  - `cityId_1`: {"cityId":1}
  - `slug_1`: {"slug":1} UNIQUE

### Fields & types

- `_id`: string
- `ownerId`: string
- `cityId`: string
- `titleAr`: string
- `titleEn`: string
- `slug`: string
- `descriptionAr`: string
- `descriptionEn`: string
- `address`: string
- `latitude`: number
- `longitude`: number
- `status`: string
- `bedrooms`: number
- `bathrooms`: number
- `maxGuests`: number
- `wifi`: boolean
- `parking`: boolean
- `airConditioning`: boolean
- `kitchen`: boolean
- `hospitalNearby`: boolean
- `universityNearby`: boolean
- `petFriendly`: boolean
- `instantBooking`: boolean
- `basePriceTnd`: number
- `cleaningFeeTnd`: number
- `cancellationPolicy`: string
- `houseRules`: string
- `featured`: boolean
- `images`: array (array)
  - `[element]`: object
    - `_id`: string
    - `url`: string
    - `sortOrder`: number
    - `createdAt`: date
- `videos`: array (array)
  - `[element]`: object
    - `_id`: string
    - `url`: string
    - `sortOrder`: number
    - `createdAt`: date
- `createdAt`: date
- `updatedAt`: date
- `__v`: number
- `blockedDates`: array (array)
  - `[element]`: string
- `checkInTime`: string
- `checkOutTime`: string
- `deletedAt`: date

### Nested objects
_None detected in scanned documents._

### Arrays
- `images` — array of objects
- `videos` — array of objects
- `blockedDates` — array (string)

### Reference-like fields (string IDs → other collections)
- `ownerId` → string id (ref-like)
- `cityId` → string id (ref-like)

### Sample documents (redacted, up to 3)

<details>
<summary>Sample 1 — _id=cmrnmicot6f4cf02b41b43f9ac58d</summary>

```json
{
  "_id": "cmrnmicot6f4cf02b41b43f9ac58d",
  "ownerId": "cmrnmicklb2a300334ec1dc766990",
  "cityId": "cmrnmico07d2beee5b259d25f983a",
  "titleAr": "إقامة مميزة رقم 1 في تونس",
  "titleEn": "Premium stay #1 in Tunis",
  "slug": "premium-stay-1-tunis",
  "descriptionAr": "شقة مضيئة من 2 غرف نوم في تونس بمرافق حديثة، مثالية للمسافرين الليبيين إلى تونس للعلاج أو الدراسة أو السياحة.",
  "descriptionEn": "Bright 2-bedroom apartment in Tunis with modern amenities, ideal for Libyan travelers visiting Tunisia for medical, study, or leisure trips.",
  "address": "11 Avenue Habib Bourguiba, Tunis, Tunisia",
  "latitude": 36.809999999999995,
  "longitude": 10.11,
  "status": "PUBLISHED",
  "bedrooms": 2,
  "bathrooms": 1,
  "maxGuests": 4,
  "wifi": true,
  "parking": false,
  "airConditioning": true,
  "kitchen": true,
  "hospitalNearby": false,
  "universityNearby": false,
  "petFriendly": false,
  "instantBooking": false,
  "basePriceTnd": 140,
  "cleaningFeeTnd": 35,
  "cancellationPolicy": "Free cancellation within 48 hours of booking.",
  "houseRules": "No smoking. No parties. Respect neighbors.",
  "featured": true,
  "images": [
    {
      "_id": "cmrnmicoq785c96f2a66bf80e8e66",
      "url": "/images/stay-1.jpg",
      "sortOrder": 0,
      "createdAt": "2026-07-16T14:47:43.034Z"
    },
    {
      "_id": "cmrnmicoq04eea510c69fa48a95e3",
      "url": "/images/stay-2.jpg",
      "sortOrder": 1,
      "createdAt": "2026-07-16T14:47:43.034Z"
    },
    {
      "_id": "cmrnmicoq4aa6f5d13ba7423acb85",
      "url": "/images/stay-3.jpg",
      "sortOrder": 2,
      "createdAt": "2026-07-16T14:47:43.034Z"
    }
  ],
  "videos": [],
  "createdAt": "2026-07-16T14:47:43.039Z",
  "updatedAt": "2026-07-19T09:35:59.817Z",
  "__v": 0
}
```

</details>

<details>
<summary>Sample 2 — _id=cmrnmicozf70ff88a37f5ae3f93a1</summary>

```json
{
  "_id": "cmrnmicozf70ff88a37f5ae3f93a1",
  "ownerId": "cmrnmickv552e410c875f78134c79",
  "cityId": "cmrnmico76752ba0fb65a769ced7f",
  "titleAr": "إقامة مميزة رقم 2 في سوسة",
  "titleEn": "Premium stay #2 in Sousse",
  "slug": "premium-stay-2-sousse",
  "descriptionAr": "شقة مضيئة من 3 غرف نوم في سوسة بمرافق حديثة، مثالية للمسافرين الليبيين إلى تونس للعلاج أو الدراسة أو السياحة.",
  "descriptionEn": "Bright 3-bedroom apartment in Sousse with modern amenities, ideal for Libyan travelers visiting Tunisia for medical, study, or leisure trips.",
  "address": "12 Avenue Habib Bourguiba, Sousse, Tunisia",
  "latitude": 36.82,
  "longitude": 10.12,
  "status": "PUBLISHED",
  "bedrooms": 3,
  "bathrooms": 2,
  "maxGuests": 6,
  "wifi": true,
  "parking": true,
  "airConditioning": true,
  "kitchen": true,
  "hospitalNearby": false,
  "universityNearby": false,
  "petFriendly": false,
  "instantBooking": true,
  "basePriceTnd": 160,
  "cleaningFeeTnd": 40,
  "cancellationPolicy": "Free cancellation within 48 hours of booking.",
  "houseRules": "No smoking. No parties. Respect neighbors.",
  "featured": true,
  "images": [
    {
      "_id": "cmrnmicoy33ad7234bfd0d7edd6a7",
      "url": "/images/stay-2.jpg",
      "sortOrder": 0,
      "createdAt": "2026-07-16T14:47:43.042Z"
    },
    {
      "_id": "cmrnmicoy974a8233a45509315e45",
      "url": "/images/stay-3.jpg",
      "sortOrder": 1,
      "createdAt": "2026-07-16T14:47:43.042Z"
    },
    {
      "_id": "cmrnmicoy8fbea2cc1bbcc90ad9bc",
      "url": "/images/stay-4.jpg",
      "sortOrder": 2,
      "createdAt": "2026-07-16T14:47:43.042Z"
    }
  ],
  "videos": [],
  "createdAt": "2026-07-16T14:47:43.044Z",
  "updatedAt": "2026-07-19T09:35:59.829Z",
  "__v": 0
}
```

</details>

<details>
<summary>Sample 3 — _id=cmrnmicp10d518cd72d9a78a450dd</summary>

```json
{
  "_id": "cmrnmicp10d518cd72d9a78a450dd",
  "ownerId": "cmrnmickx381a4084ff4149b43c17",
  "cityId": "cmrnmico86227a73653d44b515823",
  "titleAr": "إقامة مميزة رقم 3 في صفاقس",
  "titleEn": "Premium stay #3 in Sfax",
  "slug": "premium-stay-3-sfax",
  "descriptionAr": "شقة مضيئة من 1 غرف نوم في صفاقس بمرافق حديثة، مثالية للمسافرين الليبيين إلى تونس للعلاج أو الدراسة أو السياحة.",
  "descriptionEn": "Bright 1-bedroom apartment in Sfax with modern amenities, ideal for Libyan travelers visiting Tunisia for medical, study, or leisure trips.",
  "address": "13 Avenue Habib Bourguiba, Sfax, Tunisia",
  "latitude": 36.83,
  "longitude": 10.129999999999999,
  "status": "PUBLISHED",
  "bedrooms": 1,
  "bathrooms": 1,
  "maxGuests": 2,
  "wifi": true,
  "parking": false,
  "airConditioning": true,
  "kitchen": true,
  "hospitalNearby": true,
  "universityNearby": false,
  "petFriendly": false,
  "instantBooking": false,
  "basePriceTnd": 180,
  "cleaningFeeTnd": 45,
  "cancellationPolicy": "Free cancellation within 48 hours of booking.",
  "houseRules": "No smoking. No parties. Respect neighbors.",
  "featured": true,
  "images": [
    {
      "_id": "cmrnmicp156a5b70d67ca8cf62302",
      "url": "/images/stay-3.jpg",
      "sortOrder": 0,
      "createdAt": "2026-07-16T14:47:43.045Z"
    },
    {
      "_id": "cmrnmicp1877c52eaf6fa88e784fd",
      "url": "/images/stay-4.jpg",
      "sortOrder": 1,
      "createdAt": "2026-07-16T14:47:43.045Z"
    },
    {
      "_id": "cmrnmicp14b5abca6ec089a085f0a",
      "url": "/images/stay-5.jpg",
      "sortOrder": 2,
      "createdAt": "2026-07-16T14:47:43.045Z"
    }
  ],
  "videos": [],
  "createdAt": "2026-07-16T14:47:43.046Z",
  "updatedAt": "2026-07-19T09:35:59.831Z",
  "__v": 0
}
```

</details>


---

## Collection: `propertyupdates`

- **Document count:** 16
- **Indexes:**
  - `_id_`: {"_id":1}
  - `propertyId_1`: {"propertyId":1}
  - `ownerId_1`: {"ownerId":1}
  - `propertyId_1_createdAt_-1`: {"propertyId":1,"createdAt":-1}
  - `deletedAt_1`: {"deletedAt":1}

### Fields & types

- `_id`: string
- `propertyId`: string
- `ownerId`: string
- `titleAr`: string
- `titleEn`: string
- `bodyAr`: string
- `bodyEn`: string
- `createdAt`: date
- `updatedAt`: date
- `__v`: number

### Nested objects
_None detected in scanned documents._

### Arrays
_None detected in scanned documents._

### Reference-like fields (string IDs → other collections)
- `propertyId` → string id (ref-like)
- `ownerId` → string id (ref-like)

### Sample documents (redacted, up to 3)

<details>
<summary>Sample 1 — _id=cmrnnar40465c4cf525987c2be795</summary>

```json
{
  "_id": "cmrnnar40465c4cf525987c2be795",
  "propertyId": "cmrnnar3s2a08b22f707b24d408e5",
  "ownerId": "cmrnmicklb2a300334ec1dc766990",
  "titleAr": "مرحباً — نصائح عند الوصول",
  "titleEn": "Welcome — check-in tips",
  "bodyAr": "تسجيل الوصول الذاتي من الساعة 15:00. تفاصيل الموقف والواي فاي في تأكيد الحجز. راسلونا لأي استفسار عن الوصول من المطار في المرسى.",
  "bodyEn": "Self check-in from 15:00. Parking tips and Wi‑Fi details are in your booking confirmation. Message us anytime for airport pickup advice in La Marsa.",
  "createdAt": "2026-07-16T15:09:48.096Z",
  "updatedAt": "2026-07-16T15:09:48.096Z",
  "__v": 0
}
```

</details>

<details>
<summary>Sample 2 — _id=cmrnnar449cfa94417326f79aee35</summary>

```json
{
  "_id": "cmrnnar449cfa94417326f79aee35",
  "propertyId": "cmrnnar4291e91fd251bb84edeba0",
  "ownerId": "cmrnmickx381a4084ff4149b43c17",
  "titleAr": "مرحباً — نصائح عند الوصول",
  "titleEn": "Welcome — check-in tips",
  "bodyAr": "تسجيل الوصول الذاتي من الساعة 15:00. تفاصيل الموقف والواي فاي في تأكيد الحجز. راسلونا لأي استفسار عن الوصول من المطار في المرسى.",
  "bodyEn": "Self check-in from 15:00. Parking tips and Wi‑Fi details are in your booking confirmation. Message us anytime for airport pickup advice in La Marsa.",
  "createdAt": "2026-07-16T15:09:48.100Z",
  "updatedAt": "2026-07-16T15:09:48.100Z",
  "__v": 0
}
```

</details>

<details>
<summary>Sample 3 — _id=cmrnnar4a6c35023dc1f232c21718</summary>

```json
{
  "_id": "cmrnnar4a6c35023dc1f232c21718",
  "propertyId": "cmrnnar49a55929189bb82c775744",
  "ownerId": "cmrnmickx381a4084ff4149b43c17",
  "titleAr": "مرحباً — نصائح عند الوصول",
  "titleEn": "Welcome — check-in tips",
  "bodyAr": "تسجيل الوصول الذاتي من الساعة 15:00. تفاصيل الموقف والواي فاي في تأكيد الحجز. راسلونا لأي استفسار عن الوصول من المطار في قمرت.",
  "bodyEn": "Self check-in from 15:00. Parking tips and Wi‑Fi details are in your booking confirmation. Message us anytime for airport pickup advice in Gammarth.",
  "createdAt": "2026-07-16T15:09:48.107Z",
  "updatedAt": "2026-07-16T15:09:48.107Z",
  "__v": 0
}
```

</details>


---

## Collection: `refreshtokens`

- **Document count:** 177
- **Indexes:**
  - `_id_`: {"_id":1}
  - `userId_1`: {"userId":1}
  - `tokenHash_1`: {"tokenHash":1} UNIQUE
  - `expiresAt_1`: {"expiresAt":1}

### Fields & types

- `_id`: string
- `userId`: string
- `tokenHash`: string
- `expiresAt`: date
- `createdAt`: date
- `__v`: number
- `revokedAt`: date

### Nested objects
_None detected in scanned documents._

### Arrays
_None detected in scanned documents._

### Reference-like fields (string IDs → other collections)
- `userId` → string id (ref-like)

### Sample documents (redacted, up to 3)

<details>
<summary>Sample 1 — _id=cmrnmn0a31e03c6f517897a8c9b42</summary>

```json
{
  "_id": "cmrnmn0a31e03c6f517897a8c9b42",
  "userId": "cmrnmn097e81f267cce42a2f172dc",
  "tokenHash": "[REDACTED]",
  "expiresAt": "2026-08-15T14:51:20.235Z",
  "createdAt": "2026-07-16T14:51:20.236Z",
  "__v": 0,
  "revokedAt": "2026-07-16T14:51:28.531Z"
}
```

</details>

<details>
<summary>Sample 2 — _id=cmrnmnxng9e0ecdb3b5bd7ee6b13e</summary>

```json
{
  "_id": "cmrnmnxng9e0ecdb3b5bd7ee6b13e",
  "userId": "cmrnmnxna50c983089d235de2e63c",
  "tokenHash": "[REDACTED]",
  "expiresAt": "2026-08-15T14:52:03.484Z",
  "createdAt": "2026-07-16T14:52:03.485Z",
  "__v": 0,
  "revokedAt": "2026-07-16T14:52:46.666Z"
}
```

</details>

<details>
<summary>Sample 3 — _id=cmrnmptzw4f42a5b08cf8ed857ec6</summary>

```json
{
  "_id": "cmrnmptzw4f42a5b08cf8ed857ec6",
  "userId": "cmrnmptzp90e5647c15f2b1ce660a",
  "tokenHash": "[REDACTED]",
  "expiresAt": "2026-08-15T14:53:32.060Z",
  "createdAt": "2026-07-16T14:53:32.060Z",
  "__v": 0,
  "revokedAt": "2026-07-16T15:01:02.918Z"
}
```

</details>


---

## Collection: `refunds`

- **Document count:** 9
- **Indexes:**
  - `_id_`: {"_id":1}
  - `bookingId_1`: {"bookingId":1}
  - `customerId_1`: {"customerId":1}
  - `ownerId_1`: {"ownerId":1}
  - `createdAt_-1`: {"createdAt":-1}

### Fields & types

- `_id`: string
- `bookingId`: string
- `customerId`: string
- `ownerId`: string
- `type`: string
- `amountLyd`: number
- `amountTnd`: number
- `reasonCode`: string
- `reasonNote`: string
- `platformFeeClawbackTnd`: number
- `ownerPayoutClawbackTnd`: number
- `walletCreditedLyd`: number
- `source`: string
- `createdAt`: date
- `updatedAt`: date
- `__v`: number
- `createdBy`: string

### Nested objects
_None detected in scanned documents._

### Arrays
_None detected in scanned documents._

### Reference-like fields (string IDs → other collections)
- `bookingId` → string id (ref-like)
- `customerId` → string id (ref-like)
- `ownerId` → string id (ref-like)
- `createdBy` → string id (ref-like)

### Sample documents (redacted, up to 3)

<details>
<summary>Sample 1 — _id=cmrxegj4w800eebf2240ec3eeaa6d</summary>

```json
{
  "_id": "cmrxegj4w800eebf2240ec3eeaa6d",
  "bookingId": "cmrnmicre22b6057babef01babada",
  "customerId": "cmrnmiclc7ca868cffad1a455000e",
  "ownerId": "cmrnmicklb2a300334ec1dc766990",
  "type": "PARTIAL",
  "amountLyd": 1,
  "amountTnd": 0.66,
  "reasonCode": "ADMIN_ADJUSTMENT",
  "reasonNote": "smoke partial",
  "platformFeeClawbackTnd": 0.06,
  "ownerPayoutClawbackTnd": 0.47,
  "walletCreditedLyd": 1,
  "source": "ADMIN",
  "createdAt": "2026-07-23T11:00:02.915Z",
  "updatedAt": "2026-07-23T11:00:02.981Z",
  "__v": 0
}
```

</details>

<details>
<summary>Sample 2 — _id=cmrxegj6x7450308a38d3ba00e7b3</summary>

```json
{
  "_id": "cmrxegj6x7450308a38d3ba00e7b3",
  "bookingId": "cmrnmicre22b6057babef01babada",
  "customerId": "cmrnmiclc7ca868cffad1a455000e",
  "ownerId": "cmrnmicklb2a300334ec1dc766990",
  "type": "FULL",
  "amountLyd": 842.75,
  "amountTnd": 554.44,
  "reasonCode": "ADMIN_ADJUSTMENT",
  "reasonNote": "smoke full",
  "platformFeeClawbackTnd": 54.54,
  "ownerPayoutClawbackTnd": 399.93,
  "walletCreditedLyd": 842.75,
  "source": "ADMIN",
  "createdAt": "2026-07-23T11:00:02.985Z",
  "updatedAt": "2026-07-23T11:00:02.998Z",
  "__v": 0
}
```

</details>

<details>
<summary>Sample 3 — _id=cmrxh9kr94ceca52d634a1cb1bd13</summary>

```json
{
  "_id": "cmrxh9kr94ceca52d634a1cb1bd13",
  "bookingId": "cmrnmicrzb4ed00ea6e89a61ca559",
  "customerId": "cmrnmicld24d7a69e2fa852ff7154",
  "ownerId": "cmrnmickv552e410c875f78134c79",
  "type": "PARTIAL",
  "amountLyd": 5,
  "amountTnd": 3.29,
  "reasonCode": "ADMIN_ADJUSTMENT",
  "reasonNote": "e2e partial",
  "platformFeeClawbackTnd": 0.32,
  "ownerPayoutClawbackTnd": 2.37,
  "createdBy": "cmrnmickea06afabc371e0511252d",
  "walletCreditedLyd": 5,
  "source": "ADMIN",
  "createdAt": "2026-07-23T12:18:37.270Z",
  "updatedAt": "2026-07-23T12:18:37.289Z",
  "__v": 0
}
```

</details>


---

## Collection: `reviews`

- **Document count:** 8
- **Indexes:**
  - `_id_`: {"_id":1}
  - `bookingId_1`: {"bookingId":1} UNIQUE
  - `propertyId_1`: {"propertyId":1}
  - `authorId_1`: {"authorId":1}

### Fields & types

- `_id`: string
- `bookingId`: string
- `propertyId`: string
- `authorId`: string
- `rating`: number
- `comment`: string
- `createdAt`: date
- `updatedAt`: date
- `__v`: number

### Nested objects
_None detected in scanned documents._

### Arrays
_None detected in scanned documents._

### Reference-like fields (string IDs → other collections)
- `bookingId` → string id (ref-like)
- `propertyId` → string id (ref-like)
- `authorId` → string id (ref-like)

### Sample documents (redacted, up to 3)

<details>
<summary>Sample 1 — _id=cmrnmics447b0982d04f9e4017f53</summary>

```json
{
  "_id": "cmrnmics447b0982d04f9e4017f53",
  "bookingId": "cmrnmics3ab94fafe89ea6e38f6eb",
  "propertyId": "cmrnmicp10d518cd72d9a78a450dd",
  "authorId": "cmrnmiclef6bc05c7e1ffa0d375a4",
  "rating": 4,
  "comment": "Clean apartment, smooth booking experience with Safar Libya.",
  "createdAt": "2026-07-16T14:47:43.157Z",
  "updatedAt": "2026-07-16T14:47:43.157Z",
  "__v": 0
}
```

</details>

<details>
<summary>Sample 2 — _id=cmrnmicsp4ad8935efcd301592220</summary>

```json
{
  "_id": "cmrnmicsp4ad8935efcd301592220",
  "bookingId": "cmrnmicsmdde4d371ff21cdc18e2e",
  "propertyId": "cmrnmicp976cdf9848e74e1a55d92",
  "authorId": "cmrnmicli8f085c8490becf11a52f",
  "rating": 4,
  "comment": "Clean apartment, smooth booking experience with Safar Libya.",
  "createdAt": "2026-07-16T14:47:43.177Z",
  "updatedAt": "2026-07-16T14:47:43.177Z",
  "__v": 0
}
```

</details>

<details>
<summary>Sample 3 — _id=cmrnmict97000d17a261377dbfb97</summary>

```json
{
  "_id": "cmrnmict97000d17a261377dbfb97",
  "bookingId": "cmrnmict73fd0eb325fa4014c3368",
  "propertyId": "cmrnmicphe7beb4495d728b228056",
  "authorId": "cmrnmicll1df6c53c3808d3aa7cc0",
  "rating": 4,
  "comment": "Clean apartment, smooth booking experience with Safar Libya.",
  "createdAt": "2026-07-16T14:47:43.197Z",
  "updatedAt": "2026-07-16T14:47:43.197Z",
  "__v": 0
}
```

</details>


---

## Collection: `users`

- **Document count:** 140
- **Indexes:**
  - `_id_`: {"_id":1}
  - `role_1_status_1`: {"role":1,"status":1}
  - `deletedAt_1`: {"deletedAt":1}
  - `email_1`: {"email":1} UNIQUE
  - `googleSub_1`: {"googleSub":1} UNIQUE
  - `phone_1`: {"phone":1} UNIQUE

### Fields & types

- `_id`: string
- `email`: string
- `passwordHash`: string
- `fullName`: string
- `role`: string
- `status`: string
- `locale`: string
- `emailVerifiedAt`: date
- `createdAt`: date
- `updatedAt`: date
- `__v`: number
- `deletedAt`: unknown [nullish in scan: 1]
- `phone`: string [nullish in scan: 1]
- `phoneVerifiedAt`: date
- `ownerVerificationStatus`: string
- `trustedOwner`: boolean

### Nested objects
_None detected in scanned documents._

### Arrays
_None detected in scanned documents._

### Reference-like fields (string IDs → other collections)
_None._

### Sample documents (redacted, up to 3)

<details>
<summary>Sample 1 — _id=cmrnmickea06afabc371e0511252d</summary>

```json
{
  "_id": "cmrnmickea06afabc371e0511252d",
  "email": "admin@safarlibya.com",
  "passwordHash": "[REDACTED]",
  "fullName": "Safar Libya Admin",
  "role": "SUPER_ADMIN",
  "status": "ACTIVE",
  "locale": "ar",
  "emailVerifiedAt": "2026-07-16T14:47:42.874Z",
  "createdAt": "2026-07-16T14:47:42.881Z",
  "updatedAt": "2026-08-02T08:12:50.330Z",
  "__v": 0,
  "deletedAt": null
}
```

</details>

<details>
<summary>Sample 2 — _id=cmrnmicklb2a300334ec1dc766990</summary>

```json
{
  "_id": "cmrnmicklb2a300334ec1dc766990",
  "email": "owner@safarlibya.com",
  "passwordHash": "[REDACTED]",
  "fullName": "Tunisia Host",
  "phone": "+21620100001",
  "role": "OWNER",
  "status": "ACTIVE",
  "locale": "ar",
  "emailVerifiedAt": "2026-07-16T14:47:42.885Z",
  "createdAt": "2026-07-16T14:47:42.886Z",
  "updatedAt": "2026-07-16T14:47:42.908Z",
  "__v": 0
}
```

</details>

<details>
<summary>Sample 3 — _id=cmrnmickv552e410c875f78134c79</summary>

```json
{
  "_id": "cmrnmickv552e410c875f78134c79",
  "email": "owner2@safarlibya.com",
  "passwordHash": "[REDACTED]",
  "fullName": "Tunisia Host 2",
  "phone": "+21620100002",
  "role": "OWNER",
  "status": "ACTIVE",
  "locale": "en",
  "emailVerifiedAt": "2026-07-16T14:47:42.895Z",
  "createdAt": "2026-07-16T14:47:42.895Z",
  "updatedAt": "2026-07-16T14:47:42.895Z",
  "__v": 0
}
```

</details>


---

## Collection: `wallets`

- **Document count:** 10
- **Indexes:**
  - `_id_`: {"_id":1}
  - `userId_1`: {"userId":1} UNIQUE

### Fields & types

- `_id`: string
- `userId`: string
- `balanceLyd`: number
- `createdAt`: date
- `updatedAt`: date
- `__v`: number

### Nested objects
_None detected in scanned documents._

### Arrays
_None detected in scanned documents._

### Reference-like fields (string IDs → other collections)
- `userId` → string id (ref-like)

### Sample documents (redacted, up to 3)

<details>
<summary>Sample 1 — _id=cmrvtt8dd01abb0f285b867609f87</summary>

```json
{
  "_id": "cmrvtt8dd01abb0f285b867609f87",
  "userId": "cmrvtsuic736ad5151c3827da3051",
  "balanceLyd": 7923.07,
  "createdAt": "2026-07-22T08:34:17.377Z",
  "updatedAt": "2026-07-22T11:39:46.115Z",
  "__v": 0
}
```

</details>

<details>
<summary>Sample 2 — _id=cmrvywcmc0a5295413821a45f5794</summary>

```json
{
  "_id": "cmrvywcmc0a5295413821a45f5794",
  "userId": "cmrt672jtcf383ba2d29f121c8fd2",
  "balanceLyd": 416.23,
  "createdAt": "2026-07-22T10:56:40.932Z",
  "updatedAt": "2026-07-26T15:30:04.475Z",
  "__v": 0
}
```

</details>

<details>
<summary>Sample 3 — _id=cmrw0hm6nc22b9c2e4e513b90ecc7</summary>

```json
{
  "_id": "cmrw0hm6nc22b9c2e4e513b90ecc7",
  "userId": "cmrnmickea06afabc371e0511252d",
  "balanceLyd": 0,
  "createdAt": "2026-07-22T11:41:12.720Z",
  "updatedAt": "2026-07-22T11:41:12.720Z",
  "__v": 0
}
```

</details>


---

## Collection: `wallettopups`

- **Document count:** 0
- **Indexes:**
  - `_id_`: {"_id":1}
  - `userId_1`: {"userId":1}
  - `status_1`: {"status":1}
  - `status_1_createdAt_-1`: {"status":1,"createdAt":-1}

### Fields & types

_Empty collection (0 docs). Expected Mongoose shape (`WalletTopUp`):_

- `_id`: string
- `userId`: string (ref User)
- `amountLyd`: number
- `bankName`: string
- `reference`: string
- `status`: string enum TOPUP_STATUSES (default PENDING)
- `reviewedBy`: string? (ref User)
- `reviewedAt`: date?
- `reviewNote`: string?
- `createdAt` / `updatedAt`: date (timestamps)

### Nested objects
_None detected in scanned documents._

### Arrays
_None detected in scanned documents._

### Reference-like fields (string IDs → other collections)
_None._

### Sample documents (redacted, up to 3)

_No samples (empty collection)._

---

## Collection: `wallettxns`

- **Document count:** 14
- **Indexes:**
  - `_id_`: {"_id":1}
  - `walletId_1`: {"walletId":1}
  - `userId_1`: {"userId":1}
  - `userId_1_createdAt_-1`: {"userId":1,"createdAt":-1}

### Fields & types

- `_id`: string
- `walletId`: string
- `userId`: string
- `type`: string
- `amountLyd`: number
- `balanceAfter`: number
- `note`: string
- `createdAt`: date
- `__v`: number
- `bookingId`: string
- `meta`: object
  - `source`: string
  - `reasonCode`: string
  - `refundId`: string

### Nested objects
- `meta`

### Arrays
_None detected in scanned documents._

### Reference-like fields (string IDs → other collections)
- `walletId` → string id (ref-like)
- `userId` → string id (ref-like)
- `bookingId` → string id (ref-like)

### Sample documents (redacted, up to 3)

<details>
<summary>Sample 1 — _id=cmrvzbt8lef6e05474eed13e850af</summary>

```json
{
  "_id": "cmrvzbt8lef6e05474eed13e850af",
  "walletId": "cmrvtt8dd01abb0f285b867609f87",
  "userId": "cmrvtsuic736ad5151c3827da3051",
  "type": "ADMIN_ADJUST",
  "amountLyd": 10000,
  "balanceAfter": 10000,
  "note": "111",
  "createdAt": "2026-07-22T11:08:42.310Z",
  "__v": 0
}
```

</details>

<details>
<summary>Sample 2 — _id=cmrw0frd8d5a0e7c40edd5515df2f</summary>

```json
{
  "_id": "cmrw0frd8d5a0e7c40edd5515df2f",
  "walletId": "cmrvtt8dd01abb0f285b867609f87",
  "userId": "cmrvtsuic736ad5151c3827da3051",
  "type": "BOOKING_PAY",
  "amountLyd": -2076.93,
  "balanceAfter": 7923.07,
  "bookingId": "cmrw0fmhj9c36875075be9593a2a5",
  "note": "Booking payment from wallet",
  "createdAt": "2026-07-22T11:39:46.125Z",
  "__v": 0
}
```

</details>

<details>
<summary>Sample 3 — _id=cmrxegj6s78e6a2958711ba9435c0</summary>

```json
{
  "_id": "cmrxegj6s78e6a2958711ba9435c0",
  "walletId": "cmrxegj6od6e5079aeb70d1ba2f7c",
  "userId": "cmrnmiclc7ca868cffad1a455000e",
  "type": "REFUND",
  "amountLyd": 1,
  "balanceAfter": 1,
  "bookingId": "cmrnmicre22b6057babef01babada",
  "note": "Refund PARTIAL (ADMIN_ADJUSTMENT)",
  "meta": {
    "source": "ADMIN",
    "reasonCode": "ADMIN_ADJUSTMENT",
    "refundId": "cmrxegj4w800eebf2240ec3eeaa6d"
  },
  "createdAt": "2026-07-23T11:00:02.980Z",
  "__v": 0
}
```

</details>


---

## Collection: `withdrawalrequests`

- **Document count:** 2
- **Indexes:**
  - `_id_`: {"_id":1}
  - `ownerId_1`: {"ownerId":1}
  - `status_1`: {"status":1}
  - `status_1_createdAt_-1`: {"status":1,"createdAt":-1}

### Fields & types

- `_id`: string
- `ownerId`: string
- `amountTnd`: number
- `amountLyd`: number
- `exchangeRateRate`: number
- `method`: string
- `status`: string
- `createdAt`: date
- `updatedAt`: date
- `__v`: number
- `reviewedAt`: date
- `reviewedBy`: string

### Nested objects
_None detected in scanned documents._

### Arrays
_None detected in scanned documents._

### Reference-like fields (string IDs → other collections)
- `ownerId` → string id (ref-like)
- `reviewedBy` → string id (ref-like)

### Sample documents (redacted, up to 3)

<details>
<summary>Sample 1 — _id=cmrxh9kmk836d471f23a692a3ce3f</summary>

```json
{
  "_id": "cmrxh9kmk836d471f23a692a3ce3f",
  "ownerId": "cmrnmicklb2a300334ec1dc766990",
  "amountTnd": 50,
  "amountLyd": 76,
  "exchangeRateRate": 1.52,
  "method": "BANK_LYD",
  "status": "APPROVED",
  "createdAt": "2026-07-23T12:18:37.100Z",
  "updatedAt": "2026-07-23T12:18:37.169Z",
  "__v": 0,
  "reviewedAt": "2026-07-23T12:18:37.169Z",
  "reviewedBy": "cmrnmickea06afabc371e0511252d"
}
```

</details>

<details>
<summary>Sample 2 — _id=cmrxhbrpfbca5143c9afb50f810cc</summary>

```json
{
  "_id": "cmrxhbrpfbca5143c9afb50f810cc",
  "ownerId": "cmrnmicklb2a300334ec1dc766990",
  "amountTnd": 50,
  "amountLyd": 76,
  "exchangeRateRate": 1.52,
  "method": "BANK_LYD",
  "status": "APPROVED",
  "createdAt": "2026-07-23T12:20:19.587Z",
  "updatedAt": "2026-07-23T12:20:19.664Z",
  "__v": 0,
  "reviewedAt": "2026-07-23T12:20:19.663Z",
  "reviewedBy": "cmrnmickea06afabc371e0511252d"
}
```

</details>


---

## Notes for Phase 2 (design only — awaiting your approval)

1. **IDs:** Values are string cuid-like IDs (often longer than 24 chars). `CHAR(24)` will truncate — recommend `VARCHAR(32)` PK storing the original `_id`, plus optional `mongo_id` mirror for traceability.
2. **Heavy nesting:** `bookings.payment`, `bookings.invoice`; `properties.images[]`, `videos[]`, `blockedDates[]`; free-form `meta` / `appsettings.value`.
3. **`cities.aliases`:** array of strings.
4. **Empty:** `wallettopups` (0 docs) — still map from Mongoose model in Phase 2.
5. MongoDB stays untouched as backup until you explicitly approve cutover.

## Approval gate

**Stop here.** Please review and approve before Phase 2 (`schema.sql`).
