Company: Service_now_16nov
Difficulty: medium
Problem Description Design a RESTful API for a Document Approval System where documents can be submitted into a queue and processed according to specific prioritization rules. The system must process queued documents in a priority-first, FIFO (First In, First Out) manner using the following rules: Documents that do not require manual approval ( manualApproval = false ) are processed before documents that require manual approval ( manualApproval = true ), regardless of their priority. Within each category (automatic vs. manual), documents are processed in ascending priority order (e.g., priority 1 is processed before priority 2). Ties in priority within the same category are resolved by submission order (FIFO). Endpoints 1. Submit a Document POST /documents Adds a new document to the processing queue. 2. Process Documents GET /documents/process Retrieves all queued documents in their correct processing order and clears the queue. Request Format POST /documents Content-Type: application/