--- name: plan-management description: "Handles compensation plan creation, versioning rules, and commercial goals parameters. Use this when defining collaborator quotas, managing active/closed plans, or adjusting commercial targets." --- # Plan Management Provides rules and guardrails for configuring compensation plans, version control constraints, and collaborator goal mappings. ## Core Rationale To maintain historical accuracy and prevent retroactive computation errors, compensation structures must never be updated in place once active. Changing rules mid-period without versioning destroys audit trails. ## Execution Rules ### 1. Plan Versioning Constraints - **Never Edit an Active Plan In-Place**: If a plan is marked as `ACTIVE` (or `ACTIVO`), any modification to its formulas, percentage brackets, or core rules must: 1. Close the active plan (set end date or mark status as `CLOSED` / `CERRADO`). 2. Create a new plan record with a incremented version number or new validity date range. - **Why**: Retroactive recalculations rely on the exact state of the plan at the time of the sale. Modifying rules in-place invalidates prior settlement calculations. ### 2. Goals & Quotas Isolation - **Period Isolation**: Assign commercial targets and quotas strictly by period (monthly or quarterly). - **Collaborator Assignment**: Ensure quotas are mapped per collaborator and per hotel site (e.g., "Cartagena", "Bogota") to prevent cross-contamination. ### 3. Localized Keywords and i18n - Support localized status strings and target types across database queries and UI forms: - Plan statuses: `ACTIVE` / `ACTIVO`, `CLOSED` / `CERRADO`. - Target types: `REVENUE` / `INGRESOS`, `NIGHTS` / `NOCHES`. - Ensure schema updates preserve these exact value mappings, mapping them safely to the respective DB enums or text fields.