info:
  name: Test Collection Rules
  type: http
  seq: 1
http:
  method: POST
  url: '{{base_url}}/api/collections/test-rules'
  auth: inherit
  body:
    type: json
    jsonBody: "{\n    \"rules\": [\n      {\n        \"field\": \"genre\",\n     \
      \   \"operator\": \"equals\",\n        \"value\": \"Science Fiction\""
  headers:
  - key: Content-Type
    value: application/json
  - key: Authorization
    value: Bearer {{authToken

docs: |-
  ## Test Collection Rules
  
    Tests collection rules against the library to see which books match, without creating a collection. Useful for previewing what books would be included in a collection with specific rules.
  
    **Method:** POST
  
    **Endpoint:** /api/collections/test-rules
  
    **Authentication:** Bearer token
  
    **Request Body:**
    - `rules` (array): Array of rule objects to test
      - `field` (string): Field to test (genre, author, copyright_year, tags, etc.)
      - `operator` (string): Comparison operator
        - `equals`: Exact match
        - `contains`: Contains substring (for text fields)
        - `greater_than`: Greater than (for numeric fields)
        - `less_than`: Less than (for numeric fields)
        - `not_equals`: Not equal to
        - `starts_with`: Starts with
        - `ends_with`: Ends with
        - `is_empty`: Field is empty or null
        - `is_not_empty`: Field is not empty and not null
      - `value` (string): Value to compare against (not required for is_empty/is_not_empty)
  
    **Response:**
    - `matches` (array): Array of matching books
      - `id` (string): Book UUID
      - `title` (string): Book title
      - `author` (string): Book author
      - `genre` (string): Book genre
      - Additional book metadata
    - `total` (number): Total number of matching books
  
    **Status Codes:**
    - 200: Success - returns matching books
    - 400: Invalid request (empty rules array, invalid field/operator)
    - 401: Unauthorized
    - 500: Internal server error
  
    **Example Request:**
    ```json
    {
      "rules": [
        {
          "field": "genre",
          "operator": "equals",
          "value": "Science Fiction"
