PRD-009: Case Workflow — Pareceres / Bodies Opinion (conditional)
Author: MLT backend team | Date: 2026-08-19 | Status: Draft | Version: v0.1.0
Revision History
| Version | Date | Author | Description of Change |
|---|---|---|---|
| v0.1.0 | 2026-08-19 | MLT backend team | Initial draft — seventh phase (conditional), backfilled from the rebuild roadmap (interim PRD). Carries the validation pass's fix: opinions modelled as an independent set so CITE can't be skipped. |
1. Context & Business Rationale
Pareceres / Bodies Opinion (BODIES_OPINION, conditional) is where — before a dismissal decision —
the employer must obtain the mandatory external opinions triggered by the employee's protected status.
It is reached only when dismissal_intent holds and at least one protected-status trigger applies;
otherwise the phase is skipped.
The obligations are an independent set, not one nested condition. Each protected-status trigger
stands alone, so a worker with more than one trigger needs more than one parecer, and missing any
single required one voids the dismissal — this was the single most dangerous gap the validation pass
found (a nested AND let a pregnant non-union worker skip CITE).
Part of the Case Workflow theme (theme: case-workflow, label workflow: pareceres (7/8)).
Sourcing: the firm brief (_poc/firm-qa.md). PoC autopsy:
bodies opinion mandatory,
conditional branching.
2. Problem Statement
There is no server-side way to compute which mandatory opinions a dismissal requires, request them, wait the statutory period, and block the advance until each required parecer arrives — and the PoC conflated the triggers into a single union-only condition that silently dropped CITE.
3. Goals, Non-Goals, and Success Metrics
3.1 Goals
- Compute the required opinions as an independent set from the employee's protected status +
dismissal_intent. - Request each triggered opinion and wait the statutory period via the calculator.
- Block the advance to
FINAL_REPORTuntil every required parecer arrives or its wait elapses.
3.2 Non-Goals
- The final report and decision (8/8).
- Capturing protected status (that happens at intake, PRD-004).
3.3 Success Metrics
| Metric Type | Metric Definition | Baseline | Target |
|---|---|---|---|
| Primary | Every mandatory opinion triggered by protected status is requested | PoC: union-only (CITE dropped) | 100% of triggers |
| Guard Rail | Dismissal advances with a required parecer missing | PoC: possible | Blocked |
4. User Personas & Actors
4.1 Case Manager / Instrutor (Primary)
- Role: trigger and record the mandatory consults.
4.2 External bodies (CT/Sindicato, CITE, sector council)
- Role: issue the parecer within the statutory window.
5. User Stories
- As a case manager, when a dismissal is intended I want the system to compute and request every mandatory opinion my worker's protected status triggers — CT/Sindicato for union/works-council, CITE for pregnancy/parental (independent of union), a sector council for public bodies — so no mandatory consult is ever silently skipped. → #67
- As a case manager, I want to record each parecer (or that the deadline elapsed) and advance to the final report only once every required opinion is in. → #68
6. System Requirements
6.1 Trigger set
- SYS-REQ-101: Each obligation shall be evaluated independently and ANDed with
dismissal_intentseparately: CT/Sindicato ← union/works-council; CITE ← pregnancy/parental; sector council ← public body. - SYS-REQ-102: A pregnant / parental-leave worker facing dismissal shall always get a CITE parecer, even with no union membership.
- SYS-REQ-103: The phase shall be skipped only when no obligation is triggered.
6.2 Wait & advance
- SYS-REQ-201: Each triggered opinion shall be requested and its wait computed with the calculator.
- SYS-REQ-202: Advance to
FINAL_REPORTshall be permitted only once all required opinions are in or their waits have elapsed.
7. Workflow
(from Evidence phase, dismissal_intent = true)
│
▼
BODIES_OPINION ── required = { }
├─ union / works-council? → + CT_SINDICATO
├─ pregnancy / parental? → + CITE (independent of union)
├─ public-sector body? → + SECTOR_COUNCIL
│
├─ required empty → SKIP phase
└─ else: request each; wait +5 days (day-kind: OPEN, see §8)
advance blocked until every required parecer in or wait elapsed
▼
FINAL_REPORT (8/8)
8. Open Questions
- Wait period day-kind. firm-qa says "within 5 days" — calendar vs working-day is unconfirmed (the PoC assumed working days, holiday-blind). Confirm with counsel (art. 356.º CT uses dias úteis) and cite it before building.
9. Edge Cases & Exception Handling
- Multiple triggers → multiple coexisting requests; all must resolve before advance.
- A required parecer never arrives → advance permitted only after the statutory wait elapses.
- No trigger → phase skipped entirely.
10. Given-When-Then Acceptance Criteria
Obtain mandatory opinions (#67)
- Each obligation is evaluated independently and ANDed with dismissal_intent separately.
- A pregnant / parental-leave worker facing dismissal always gets a CITE parecer, even with no union membership.
- The phase is skipped only when no obligation is triggered; otherwise every triggered parecer must be requested.
- The consult wait (firm-qa: "5 days"; day-kind OPEN pending counsel) is computed with the calculator; advance is blocked until each required parecer arrives or its wait elapses.
Record opinions and advance (#68)
- Received pareceres are recorded and attached to the case.
- Advance to FINAL_REPORT is permitted once all required opinions are in or their waits elapsed.
11. Technical Constraints & Dependencies
- Blocked by: "Run evidence-phase diligências & consolidate the timeline" (5–6/8).
- Reads the employee's protected status captured at intake (PRD-004); uses the holiday-aware calculator.