> ## Documentation Index
> Fetch the complete documentation index at: https://docs.flextell.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Hasta Notları API

> Hasta profili altına serbest metin notları eklemek, listelemek, güncellemek ve silmek için endpoint'ler.

<Note>
  Bu API, `customers` (Hastalar) modülü altında **iç içe (nested)** bir yapıdadır. Tüm isteklerde `X-Tenant` header'ı **zorunludur**. İşlemler yalnızca belirtilen tenant'a ait hastalar ve onlara bağlı notlar ile sınırlandırılmıştır.
</Note>

## Endpoint özeti

| Metot    | Endpoint                                       | Açıklama                     |
| -------- | ---------------------------------------------- | ---------------------------- |
| `GET`    | `/api/v1/customers/{id}/notes`                 | Hastanın notlarını listeler  |
| `GET`    | `/api/v1/customers/{id}/notes/{note_id}`       | Tek bir notu detaylı getirir |
| `POST`   | `/api/v1/customers/{id}/notes`                 | Hastaya yeni not ekler       |
| `PUT`    | `/api/v1/customers/{id}/notes/{note_id}`       | Notu günceller               |
| `DELETE` | `/api/v1/customers/{id}/notes/{note_id}`       | Notu soft delete eder        |
| `DELETE` | `/api/v1/customers/{id}/notes/{note_id}/force` | Notu kalıcı olarak siler     |

<Tip>
  Tüm parametreler, alanlar ve örnek istek/yanıtlar için **[API Referansı](/api-reference)** sekmesine bakın.
</Tip>

## Hasta notu kavramı

Hasta Notu (`Customer Note`), sistemde kayıtlı bir hasta profili altına eklenen ve **personel tarafından görüntülenebilen** serbest metin açıklamalarıdır.

Notlar her zaman spesifik bir hasta bağlamında (`{id}`) çalışır. Bir not; içeriği, notu oluşturan yazarın (`author`) bilgileri ve zaman damgaları ile birlikte yönetilir.

## İş kuralları

<Tip>
  **`user_id` iş kuralı:** Bu alan gönderilmezse, sistem notun yazarı olarak otomatik olarak **API isteğini yapan (authenticated) kullanıcının ID'sini** atar.
</Tip>

<Warning>
  Notun yazarı (`user_id`) veya ait olduğu hasta (`customer`, yani `{id}`) **sonradan değiştirilemez**.
</Warning>

## Yetkilendirme

<Note>
  Hasta notları API'sine erişim için hem **Hasta (`Customer`)** hem de **Not (`Note`)** üzerinde yetkiye sahip olunması gerekir.
</Note>

### Uygulama izinleri (permissions)

| İşlem                       | Gerekli izin kombinasyonu                 |
| --------------------------- | ----------------------------------------- |
| Listeleme                   | `View:Customer` **VE** `ViewAny:Note`     |
| Detay / Tek gösterme        | `View:Customer` **VE** `View:Note`        |
| Oluşturma                   | `View:Customer` **VE** `Create:Note`      |
| Güncelleme                  | `View:Customer` **VE** `Update:Note`      |
| Silme (soft delete)         | `View:Customer` **VE** `Delete:Note`      |
| Kalıcı silme (force delete) | `View:Customer` **VE** `ForceDelete:Note` |

### Token scope'ları (Passport)

| İşlem                                               | Scope                                  |
| --------------------------------------------------- | -------------------------------------- |
| Okuma (`index`, `show`)                             | `customers:read` **VE** `notes:read`   |
| Yazma (`store`, `update`, `destroy`, `forceDelete`) | `customers:write` **VE** `notes:write` |
