# 14 — FAQ Management

## Overview

A read-only listing of FAQs published to the Client and Vendor apps. There is **no add/edit/delete UI** — FAQ rows must be inserted into the `faqs` table directly by ops via SQL or via OotboAPI tooling.

**Status:** Partial

---

## User Stories

| ID | As a | I want to | So that |
|----|------|-----------|---------|
| FAQ-01 | Ops | See the list of vendor FAQs the vendor app shows | Audit content |
| FAQ-02 | Ops | See the list of client FAQs the client app shows | Audit content |

---

## Screens & Flows

```
┌──────────────────────────┐                  ┌──────────────────────────┐
│ /faq/clientlist          │                  │ /faq/vendorlist          │
│ help/clientfaqs.blade.php│                  │ help/vendorfaqs.blade.php│
└──────────────────────────┘                  └──────────────────────────┘
            │                                              │
            ▼                                              ▼
   Faqs::faqs('client')                          Faqs::faqs('vendor')
   ORDER BY id DESC                              ORDER BY id DESC
```

Image URLs are loaded from `config/viso.php`:

```php
'vendorfaq' => 'https://api.viso.events/KaaryamAPI/public/faq-images/vendor/',
'clientfaq' => 'https://api.viso.events/KaaryamAPI/public/faq-images/client/'
```

### Routes & Actions

| Route | Method | Handler | Description |
|-------|--------|---------|-------------|
| `/faq/clientlist` | GET | `FaqController::clientlist()` | Render client FAQ list |
| `/faq/vendorlist` | GET | `FaqController::vendorlist()` | Render vendor FAQ list |

---

## Data Model

### `faqs`

```php
// App\Models\Faqs
protected $table = 'faqs';

{
  id:         int,
  app_type:   'client' | 'vendor',
  // expected: title, body, image_filename, ordering, status
  // ↑ specifics depend on schema in OotboAPI / DB — VisoAdmin only reads
}
```

> Schema details for `faqs` are **not declared in this codebase** — VisoAdmin's only interaction is `SELECT * FROM faqs WHERE app_type = ? ORDER BY id DESC`. The Blade templates dictate what columns are rendered. **Verify schema with the OotboAPI maintainer.**

---

## Validations & Business Rules

| Rule | Detail |
|------|--------|
| Listed by `app_type` filter | `'client'` or `'vendor'` |
| Sort | newest first (`id DESC`) |
| No mutation surface | Read-only |
| Image URLs assembled by concat | `config('viso.clientfaq') . $faq->image_filename` |

---

## API Endpoints

| Method | Path | Auth | Request | Response | Consumer |
|--------|------|------|---------|----------|----------|
| GET | `/faq/clientlist` | session + permission 1 | — | HTML | Browser |
| GET | `/faq/vendorlist` | session + permission 1 | — | HTML | Browser |

---

## Upstream Impact

- **`faqs` table** — owned by OotboAPI (no Laravel migration exists here for it).
- **`config/viso.php`** — image base URLs.

---

## Downstream Impact

- **Public Client app** — surfaces FAQs (via OotboAPI endpoint).
- **Public Vendor app** — surfaces FAQs (via OotboAPI endpoint).

VisoAdmin's view is purely diagnostic.

---

## Impact of Changes

| If you change... | Risk to... | Level | Type |
|-----------------|------------|-------|------|
| `faqs.app_type` enum | List filter breaks for invalid types | High | Data |
| `config('viso.clientfaq')` host | All client FAQ images 404 | Medium | UI |
| `config('viso.vendorfaq')` host | All vendor FAQ images 404 | Medium | UI |
| Adding required columns to `faqs` | VisoAdmin's `SELECT *` continues to work but Blade rendering may show "undefined" badges | Low | UI |
| Renaming `faqs.app_type` | Both list pages break | High | Data |

---

## Known Issues

- **No mutation UI.** Ops cannot add or edit FAQs from VisoAdmin. They must use OotboAPI tooling or direct SQL.
- **Image URLs point at api.viso.events/KaaryamAPI** — a legacy host path. May 404 if the API server has been migrated.
- **`faqs` schema is undocumented within VisoAdmin.** Anything the Blade template references must match what OotboAPI writes.
