# Tenant Branding and Support v1 Migration Specification

**Status:** Proposed
**Observed API environment:** `https://dev.api.tiar.ai`
**Tenant routing:** `X-Forwarded-Host: parking-plus.dev.tiar.ai`, `X-App-Name: mobile_app`

## Goal

Move tenant branding and support presentation data in `tiar-webapp` off the
legacy organization endpoint. These two data categories must come from the new
v1 endpoints or a local source-code fallback; they must never be read from
`/v1.1`.

## Contracts

### Branding

`GET /v1/tenant/branding` is public and returns a wrapper whose `result` is a
single branding object:

```json
{
  "ok": true,
  "message": "Tenant branding retrieved successfully",
  "result": {
    "display_name": "Parking+ Mobile",
    "logo_url": "https://example.test/logo.svg",
    "primary_color": "#006F3C",
    "secondary_color": "#00A859",
    "accent_color": "#F5C400",
    "background_color": "#FFFFFF",
    "text_color": "#1F2937",
    "success_color": "#16A34A",
    "warning_color": "#F59E0B",
    "danger_color": "#DC2626",
    "font_family": "Inter",
    "theme_tokens": { "mode": "light" }
  },
  "pagination": null
}
```

The adapter must normalize snake_case fields into the app's presentation type
and tolerate nullable or omitted optional values.

### Support

`GET /v1/tenant/support` requires the server-held access token and returns a
wrapper whose `result` contains:

```json
{
  "name": "Parking+",
  "phone": "+6285659240195",
  "email": "parkingplus.xyz@gmail.com",
  "request_charger_phone_number": "+6281188072885",
  "request_charger_whatsapp_url": "https://wa.me/6281188072885",
  "website_url": "parkingplus.xyz",
  "address": {
    "street_and_number": "Jl. Poncol II No. 17",
    "city": "Jakarta Selatan",
    "state": "DKI Jakarta",
    "postal_code": "12420",
    "country": "Indonesia"
  },
  "social_media": {
    "whatsapp_url": "https://example.test/whatsapp",
    "instagram_url": "https://www.instagram.com/parkingplus.xyz/",
    "linkedin_url": "https://www.linkedin.com/company/parkingplus/",
    "youtube_url": "https://www.youtube.com/@Parkingplus"
  }
}
```

`website_url` may omit the scheme. The adapter must normalize it to an
`https://` URL before handing it to an anchor or URL validator.

## Data-source rules

1. Branding reads `/v1/tenant/branding` first and falls back only to local
   source-code defaults.
2. Support reads `/v1/tenant/support` with the server-side cookie token and
   falls back only to local source-code defaults when unauthenticated or when
   the request fails.
3. No branding or support field may be read from `/v1.1/organizations`.
4. Access tokens stay server-side and are never passed to client components,
   serialized into props, or logged.
5. Existing organization identity fields needed by unrelated features may be
   migrated separately; this specification does not silently claim that all
   organization data is already v1.

## UI mapping

- Branding drives document title/display name, logo, favicon, theme colors,
  dynamic CSS variables, manifest, and PWA icon selection.
- Support drives the support page's contact information, request-charger
  contact, website, and social links.
- The support page continues rendering with local fallback content if no token
  is available.
