# Mutual Fund — Fund Risk Profile

**Controller:** `App\Http\Controllers\MfRiskProfileController`  
**Model:** `App\Models\MfRiskProfile`  
**Table:** `mf_risk_profiles`  
**Middleware:** `jwt.auth`, `check.token`, `dynamic.permission`

Assign these route names to the back-office role in route-API permissions before calling them.

---

## Purpose

Master data for mutual-fund risk profiles. Used when creating/editing funds (`mf_funds.risk_profile_id`) and anywhere a risk-profile dropdown is needed.

## Fields

| Column | Type | Notes |
|--------|------|--------|
| `id` | bigint | PK |
| `risk_level` | enum `LOW` / `MEDIUM` / `HIGH` | Required |
| `risk_tag_name` | varchar(64) | Unique (e.g. Conservative, Aggressive) |
| `description` | text | Optional |
| `is_active` | enum `A` / `I` | Default `A` (Active) |
| `create_by` | int | `fintra_back_users.user_id` |
| `create_at` | datetime | Eloquent `CREATED_AT` |
| `update_by` | int | nullable |
| `update_at` | datetime | Eloquent `UPDATED_AT` |

`create_by` / `update_by` are taken from `users_id` in the request body.

## Endpoints

| Action | Method | Path | Route name |
|--------|--------|------|------------|
| List | GET | `/api/mf-risk-profile/mf-risk-profile-index` | `mf-risk-profile-index` |
| Show | GET | `/api/mf-risk-profile/mf-risk-profile-show/{id}` | `mf-risk-profile-show/{id}` |
| Dropdown | GET | `/api/mf-risk-profile/mf-risk-profile-dropdown` | `mf-risk-profile-dropdown` |
| Create | POST | `/api/mf-risk-profile/mf-risk-profile-store` | `mf-risk-profile-store` |
| Update | POST | `/api/mf-risk-profile/mf-risk-profile-update/{id}` | `mf-risk-profile-update/{id}` |
| Delete | DELETE | `/api/mf-risk-profile/mf-risk-profile-delete/{id}` | `mf-risk-profile-delete/{id}` |

Update is **POST**, not PUT — same as fund category.

## Query params

**Index**

| Param | Default | Description |
|-------|---------|-------------|
| `per_page` | 10 | 1–100 |
| `page` | 1 | Laravel paginator |
| `risk_level` | — | `LOW`, `MEDIUM`, or `HIGH` |
| `is_active` | — | `A` or `I` |
| `q` | — | Search `risk_tag_name` or `risk_level` |

**Dropdown**

| Param | Default | Description |
|-------|---------|-------------|
| `is_active` | `A` | `A`, `I`, or `all` |
| `risk_level` | — | Optional filter: `LOW`, `MEDIUM`, or `HIGH` |

Dropdown returns only `id`, `risk_level`, `risk_tag_name` (no pagination).

## Delete rule

If any row in `mf_funds` uses this risk profile, delete returns **409** with `funds_count`. Soft-inactivate with `is_active = I` instead.

## Response shape

Same as fund-category APIs:

```json
{
  "status": true,
  "message": "Fund risk profile created successfully",
  "data": {}
}
```

List also includes `pagination`: `current_page`, `last_page`, `per_page`, `total`.

Empty index returns **404** with `"No fund risk profiles found"`. Empty dropdown returns **200** with `"data": []`.

## Related docs

- cURL examples: `mf_risk_profile_api_curl.md`
- Postman collection: `mf_risk_profile.postman_collection.json`
