# Help Center

Integrated documentation area for Secure File Transfer (no WordPress / external CMS).

## Public URLs (path mode)

| Locale | Index |
|--------|--------|
| de | `/de/hilfe` |
| en | `/en/help` |
| es | `/es/ayuda` |
| ru | `/ru/помощь` |

Further routes (DE examples):

- `/de/hilfe/suche`
- `/de/hilfe/kategorie/{slug}`
- `/de/hilfe/artikel/{slug}`
- `/de/hilfe/faq`
- `/de/hilfe/kontakt`
- `/de/hilfe/vorschlag` (JSON suggestions)
- `/de/hilfe/artikel/{slug}/feedback` (POST)
- `/de/hilfe/assistent` (POST)
- `/de/hilfe/sitemap.xml`

## Configuration (`.env`)

```env
HELP_MODE=path
HELP_CANONICAL_BASE_URL=https://secure-file-transfer.io
HELP_SUBDOMAIN_HOST=help.secure-file-transfer.io
HELP_AI_ENABLED=0
HELP_SEARCH_LOG_ENABLED=1
# Reserved for a future provider implementation (not wired to a live API yet):
# HELP_AI_PROVIDER=null
# HELP_AI_API_KEY=
# HELP_AI_MODEL=
# HELP_AI_BASE_URL=
```

- `HELP_MODE=path` – links under `/hilfe` (current default).
- Subdomain delivery (`help.secure-file-transfer.io`) is prepared via `HelpUrlGenerator` / config; host-based routes can be added without rewriting controllers.
- Prefer one canonical base URL (`HELP_CANONICAL_BASE_URL`) to avoid duplicate content.

### Help subdomain (later)

1. Point DNS `help.secure-file-transfer.io` to the app.
2. Configure the webserver vhost to the same Symfony front controller.
3. Add host-based routes (or a request listener) that maps short paths to the existing `app_help_*` controllers.
4. Keep `HELP_CANONICAL_BASE_URL` on the preferred domain.

## Content import

```bash
php bin/console app:help:import-content --dry-run
php bin/console app:help:import-content --update-existing
php bin/console app:help:import-content --update-existing --unpublish-missing
php bin/console app:help:validate
```

Content packs live in `src/HelpContent/`. Import updates by slug and never deletes rows.


## Admin

Requires `ROLE_GLOBAL_ADMIN` under `/adm`:

- Help Categories: `/adm/{_locale}/help-category`
- Help Articles: `/adm/{_locale}/help-article`
- Insights (feedback + failed searches): `/adm/{_locale}/help-article/insights`

## Twig helpers

```twig
{{ help_url('dateien-sicher-versenden') }}
{{ help_link('dateien-sicher-versenden', 'Mehr erfahren')|raw }}
{{ help_highlight(text, q)|raw }}
```

## Assets

Webpack Encore entry: `help` (`assets/help.ts`, `assets/styles/help.scss`).

```bash
npm run build
```

## AI assistant

- UI: floating “Hilfe-Assistent” on help pages.
- Backend: `HelpAssistantInterface` → default `DisabledHelpAssistant` (search fallback).
- Provider stub: `HelpAiProviderInterface` / `NullHelpAiProvider`.
- When `HELP_AI_ENABLED=0`, answers fall back to published-article search with sources.
- No chat history is stored by default. No customer files are accessed.

## Rate limiting

`App\Service\Help\HelpRateLimiter` (cache-based fixed window; no `symfony/lock` required) for search, suggest, feedback, and assistant.

## Privacy notes

- Search logs store term + result count only (no user PII by default).
- Feedback stores an anonymized session hash, never raw IP.
- AI (when enabled later) must only use published articles; no customer files.

## Status

- Phase 1: data model, public pages, Doctrine search, seed, URL generator
- Phase 2: admin CRUD, feedback, SEO sitemap, highlight, rate limits, contact via existing form
- Phase 3: assistant UI + disabled/search fallback + provider interface
- Phase 4: unit tests under `tests/Service/Help/` (PHPUnit not currently in `require-dev`; add `symfony/phpunit-bridge` to run)
