info:
  name: Fuzzy Author Filter
  type: http
  seq: 10

http:
  method: GET
  url: "{{base_url}}/api/media-items/search?library_id={{library_id}}&author_filter=Conan"
  params:
    - name: library_id
      value: "{{library_id}}"
      type: query
    - name: author_filter
      value: Conan
      type: query
  auth: inherit

settings:
  encodeUrl: true
  timeout: 0
  followRedirects: true
  maxRedirects: 5

docs: |-
  ## Fuzzy Author Filter

  Filters media items by author using fuzzy matching (tolerates typos).

  **Method:** GET

  **Endpoint:** /api/media-items/search

  **Authentication:** Required (Bearer token)

  **Query Parameters:**
  - `library_id` (string, required): Library UUID to search within
  - `author_filter` (string, required): Author name to fuzzy match (e.g., "asimov" matches "Asimov, Isaac")

  **How Fuzzy Matching Works:**
  - Uses PostgreSQL pg_trgm word_similarity()
  - Threshold: 0.3 (30% similarity)
  - Handles typos: "azimov" → "Asimov"
  - Handles partial matches: "asimov" → "Asimov, Isaac"
  - Case-insensitive

  **Response:** HTTP 200 (OK)
  ```json
  [
    {
      "id": "uuid",
      "title": "Foundation",
      "author": "Asimov, Isaac",
      "library_id": "uuid",
      "library_name": "E-Books"
    }
  ]
  ```

  **Examples:**
  - `author_filter=asimov` → Matches "Asimov, Isaac", "Asimov, Isaac & Robert Silverberg"
  - `author_filter=rowling` → Matches "Rowling, J.K."
  - `author_filter=tolkien` → Matches "Tolkien, J.R.R."

  **Success Criteria:**
  - Status: 200
  - Returns items with authors similar to the filter
  - Results sorted by similarity score
