Document Approval System API

Company: Service_now_16nov

Difficulty: medium

Problem Statement

Document Approval System API Problem A document approval service accepts documents into a queue and later processes the whole queue. Each document has a documentId , a priority and a manualApproval flag. In the original assessment this was a JavaScript (Node.js) class DocumentApproval with two methods: addDocument(documentInput) -- called once per submitted document, where documentInput is a string in the format "documentId priority manualApproval" ; processDocuments() -- an async generator that yields the queued documents in processing order; the provided main() prints them. This offline version has no server and no async runtime. Standard input lists the addDocument calls in submission order, the function receives all of them at once, and it returns the documents in the order they are processed. The harness prints the result. Documents are processed in a priority-first, FIFO manner: Documents that do not require manual approval ( manualApproval = false ) are processed before document