# Mobile Client API

Base URL: `/api/mobile`

## Authentication

- `POST /auth/login`
  - body: `email`, `password`, optional `device_name`
  - returns bearer token
- `POST /auth/logout` (Bearer token required)

> This API is restricted to users with client role.

## App Configuration

- `GET /config`
- `GET /contacts`
- `GET /faq`
- `GET /services`

`GET /config` returns branding + UI params pulled from DB settings and content tables:

- colors: `primary_color`, `secondary_color` / `second_color`
- logos: `site_logo`, `site_frontend_logo`, `site_footer_frontend_logo`, `site_favicon`
- support links/content from `content_frontend`
- sliders (`slider_images`)
- offers (`offre`)
- contact list (`contact_lists`)

## Profile

- `GET /me` (Bearer token)
- `POST /me` (Bearer token)
  - supports `name`, `email`, `password` + `password_confirmation`, `avatar`

## Tickets

- `GET /tickets` (Bearer token)
- `GET /tickets/{id}` (Bearer token)
- `POST /tickets` (Bearer token)
  - body: `subject`, `description`, `category_id`, optional `sub_catid`, `priority_id`
  - optional `attachments[]`
  - optional `custom_fields[field_id]=value` or legacy `cf_{id}`
- `POST /tickets/{id}/reply` (Bearer token)
  - body: `message`, optional `attachments[]`
- `PATCH /tickets/{id}/status` (Bearer token)
  - body: `status_id` allowed values: `1` (open), `3` (closed)
- `GET /tickets/form-data` (Bearer token)
- `GET /tickets/subcategories/{categoryId}` (Bearer token)
- `GET /tickets/custom-fields/{categoryId}` (Bearer token)

## Notifications

- `GET /notifications` (Bearer token)
  - returns recent ticket updates for the authenticated client.

## BunnyCDN Upload

Ticket and profile file upload uses:

- Bunny when `bunny_enable=1` and both `bunny_storage_zone` + `bunny_api_key` are set.
- Local public uploads otherwise (fallback).

Recommended settings keys:

- `bunny_enable`
- `bunny_storage_zone`
- `bunny_api_key`
- `bunny_region_host` (default: `storage.bunnycdn.com`)
- `bunny_cdn_domain` (for public CDN URLs)
- `bunny_default_folder` (default: `uploads`)

## Migration

Run:

```bash
php artisan migrate
```

This adds table `mobile_api_tokens`.

