# NOMAZRA API Endpoints — Stats, Feedback & Emergency
Base URL: `https://nomazra.kelthos.com/api/nomazra/`

All endpoints require `Authorization: Bearer <access_token>`

---

## GET /stats/
Get user activity statistics.

**Response 200:**
```json
{
  "id": "uuid",
  "user": "user-uuid",
  "total_conversations": 15,
  "total_messages": 247,
  "total_documents": 8,
  "total_voice_sessions": 3,
  "total_tokens_used": 45230,
  "streak_days": 5,
  "last_active": "2025-01-20T14:30:00Z",
  "created_at": "..."
}
```

---

## POST /feedback/
Submit feedback for an AI response.

**Request Body:**
```json
{
  "message_id": "uuid",
  "rating": 5,
  "comment": "Very accurate and helpful explanation of land law"
}
```

**Validation:**
- `message_id`: Required, must be a valid AI message
- `rating`: Required, integer 1-5
- `comment`: Optional, max 2000 chars

**Response 201:**
```json
{
  "id": "uuid",
  "message": "message-uuid",
  "rating": 5,
  "comment": "Very accurate and helpful explanation of land law",
  "created_at": "..."
}
```

---

## GET /emergency-info/
**[TO BE BUILT]** Get emergency legal contacts and hotlines.

**Response 200:**
```json
{
  "country": "Cambodia",
  "hotlines": [
    {
      "name": "Legal Aid of Cambodia (LAC)",
      "phone": "+855-23-220-504",
      "description": "Free legal representation for vulnerable groups",
      "hours": "Mon-Fri 8:00-17:00"
    },
    {
      "name": "Cambodia Human Rights Committee (CHRC)",
      "phone": "1285",
      "description": "Human rights violations hotline",
      "hours": "24/7"
    },
    {
      "name": "Cambodian Center for Human Rights (CCHR)",
      "phone": "+855-23-726-901",
      "description": "Human rights advocacy and legal assistance",
      "hours": "Mon-Fri 8:00-17:00"
    },
    {
      "name": "Police Emergency",
      "phone": "117",
      "description": "National police emergency line",
      "hours": "24/7"
    },
    {
      "name": "Anti-Human Trafficking Hotline",
      "phone": "1288",
      "description": "Report trafficking and exploitation",
      "hours": "24/7"
    },
    {
      "name": "Women's Crisis Center (LICADHO)",
      "phone": "+855-23-727-102",
      "description": "Support for women experiencing violence",
      "hours": "Mon-Fri 8:00-17:00"
    }
  ],
  "online_resources": [
    {
      "name": "Cambodian Legal Information Portal",
      "url": "https://www.cambodianlaw.com"
    },
    {
      "name": "Bar Association of Cambodia",
      "url": "https://www.bakc.org.kh"
    }
  ]
}
```

---

## GET /law-entries/
**[FROM MODELS]** List available law database entries. Supports search.

**Query Parameters:**
- `search` (optional): Search in title and content
- `category` (optional): Filter by legal category
- `country` (optional): Filter by country code

**Response 200:**
```json
[
  {
    "id": "uuid",
    "title": "Civil Code - Property Rights",
    "category": "property",
    "content": "Article 85: The right of ownership...",
    "source": "Civil Code of Cambodia (2007)",
    "country": "KH",
    "effective_date": "2007-12-08",
    "is_active": true,
    "created_at": "..."
  }
]
```
