info:
  name: Delete Saved Filter
  type: http
  seq: 4
http:
  method: DELETE
  url: '{{base_url}}/api/saved-filters/{{filter_id}}'
  auth: inherit

docs: |-
  ## Delete Saved Filter

  Permanently deletes a saved filter.

  **Method:** DELETE

  **Endpoint:** /api/saved-filters/{filter_id}

  **Authentication:** Required (Bearer token)

  **Path Parameters:**
  - `filter_id` (string, required): UUID of the filter to delete
    - Must be a valid UUID
    - Must belong to the authenticated user

  **Response:**
  - 204 No Content (success)
  - Empty response body

  **Status Codes:**
  - 204: No Content - Filter deleted successfully
  - 400: Bad Request - Invalid filter ID format
  - 401: Unauthorized - Invalid or missing authentication token
  - 404: Not Found - Filter doesn't exist or doesn't belong to user
  - 500: Internal Server Error - Database error

  **Example Usage:**
  ```bash
  curl -X DELETE \
    -H "Authorization: Bearer YOUR_TOKEN" \
    "{{base_url}}/api/saved-filters/{{filter_id}}"
  ```

  **Important Notes:**
  - You can only delete filters that belong to you
  - Deletion is permanent - cannot be undone
  - Returns 204 No Content on success (no response body)
  - If filter doesn't exist or belongs to another user, returns 404

  **Error Response Examples:**

  Invalid filter ID:
  ```json
  {
    "error": "invalid filter ID"
  }
  ```

  Filter not found:
  ```json
  {
    "error": "failed to delete filter"
  }
  ```

  **Testing Deletion:**
  ```bash
  # First, create a filter
  CREATE_RESPONSE=$(curl -s -X POST \
    -H "Authorization: Bearer YOUR_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{
      "name": "To Be Deleted",
      "resource_type": "media-items",
      "filters": {}
    }' \
    "{{base_url}}/api/saved-filters")

  # Extract the ID
  FILTER_ID=$(echo $CREATE_RESPONSE | jq -r '.id')

  # Delete the filter
  curl -X DELETE \
    -H "Authorization: Bearer YOUR_TOKEN" \
    "{{base_url}}/api/saved-filters/$FILTER_ID"

  # Verify it's gone
  curl -H "Authorization: Bearer YOUR_TOKEN" \
    "{{base_url}}/api/saved-filters?resource_type=media-items"
  ```

  **Cascade Effects:**
  - No cascade effects - saved filters are standalone records
  - User deletion automatically cascades to delete their filters
  - No foreign key dependencies on other tables
