"""
Project Together — powered by AI: o QUADRO do aluno em INGLES.

Tabela paralela de quadro.py: as MESMAS chaves, o mesmo formato. Quem junta as
duas e' `idioma.mesclar()` — chave a chave, entao uma chave que falte aqui sai em
portugues e o quadro continua sendo montado inteiro.

TERMINOLOGIA: PMBOK Guide, 8th Edition (references/pmbokguide_eighthed_eng.pdf) —
nao traducao literal do portugues. Os pares que mais importam:
    EAP -> WBS (work breakdown structure)      pacote de trabalho -> work package
    Termo de Abertura -> project charter       partes interessadas -> stakeholders
    linha de base -> baseline                  premissa/restricao -> assumption/constraint
    abordagem de desenvolvimento -> development approach
    preditiva / agil -> predictive / adaptive (agile)

CUIDADO: o nome da lista e' TAMBEM a chave de busca no quadro, e o titulo do cartao
do termo e' como o script o reencontra. Mudar um deles depois que ha alunos com o
quadro montado exige entrar em TITULOS_LEGADOS/LEGADO, como qualquer renomeacao.
"""

# ── Listas ───────────────────────────────────────────────────────────────────
COMUNS_ANTES = [
    ("REFERENCIA", "References and Steps"),
    ("INPUTS", "INPUTS (5W2H Project)"),
    ("PARTES", "Stakeholders [WHO]"),
]
ESCOPO = {
    "PREDITIVA": ("ESCOPO", "WBS → Schedule [WHAT → WHEN]"),
    "AGIL": ("ESCOPO", "Product Backlog [WHAT]"),
}
COMUNS_MEIO = [
    ("RISCOS", "Risks and Assumptions"),
    ("ORCAMENTO", "Budget [HOW MUCH]"),
]
FLUXO_AGIL = [
    ("EXECUCAO", "Sprint Backlog"),
    ("PRONTO", "Increment (Done)"),
]
COMUNS_DEPOIS = [
    ("MUDANCAS", "Changes"),
    ("CONCLUIDO", "Completed (course)"),
]

MARCA_EXEC_P7 = "🔧 Execution task (Step 7)"
MARCA_NOVO_P4 = "🆕 Discovered in Step 4 (schedule)"

# ── A caixa de entrada ───────────────────────────────────────────────────────
CAIXA = "0. Inbox — paste your AI's answer here"
CAIXA_DESC = (
    "PASTE HERE your AI's answer — the WHOLE answer, exactly as it came.\n\n"
    "Every answer comes with labels in brackets ([1.2], [2.1]...). When you run the "
    "script, it reads this inbox, files each block into the right card on this list "
    "and clears the inbox. You don't have to find the right card: just paste here.\n\n"
    "If you prefer, you can write straight into the card — the script reads both.\n\n")

# ── Os cartoes trancados (o bloco COMO nasce fechado) ────────────────────────
_TRANCADO = (
    "🔒 This card belongs to the HOW block — and you haven't chosen the HOW yet.\n\n"
    "The 'How?' of 5W2H starts with the DEVELOPMENT APPROACH: 'the means used to "
    "create and evolve the product throughout the life cycle' (PMBOK Guide, 8th "
    "Edition). Constraints, assumptions, risks, initial scope and the WHERE are the "
    "DETAIL of that how — and they take a different shape with each approach.\n\n"
    "Answer cards 1.1 to 3 first (why · what · who). Then run the script "
    "01a_escolher_abordagem.py (card 1.4 on the References list): five questions — "
    "the factors from the PMBOK Guide — and it recommends, you decide.\n\n"
    "Once you choose, Step 1 unlocks this block and builds the rest of your board in "
    "your approach.")

_TRANCADO_QUANDO_QUANTO = (
    "🔒 This card opens once you choose the DEVELOPMENT APPROACH (card 4.1).\n\n"
    "Why? Because it is the HOW that defines how the WHEN and the HOW MUCH are "
    "worked out:\n"
    "· PREDICTIVE: the milestone is the completed deliverable; the cost is the whole "
    "project's, estimated from the scope.\n"
    "· AGILE: the milestone is the first useful increment and the cadence; the date "
    "tends to be fixed and the scope to flex — and the cost is the team's per "
    "Sprint.\n\n"
    "Asking for a date before you know this is asking for a number without knowing "
    "what it means.\n\n"
    "Run the script 01a_escolher_abordagem.py (card 1.4 on the References list): "
    "five questions, it recommends, you decide.")

# ── ETAPA 1: os 14 cartoes do termo, no texto que nao depende da abordagem ───
TERMO_BASE = [
    ("1.1 WHY — Project justification",
     "Today's pain and the value the project creates. YOU write this card — it is the "
     "one thing AI cannot do for you, because it is your context.\n"
     "3 to 6 sentences: what hurts today · who suffers from it · what happens if "
     "nothing is done · what changes once the project delivers.\n\n"
     "It is the start of the chain: every next step builds on this text.\n"
     "Stuck? Card 90 on the References list: the AI asks you questions (the text stays "
     "yours)."),
    ("1.2 WHY — Objectives and Key Results (OKR)",
     "As many objectives as the project calls for — most have more than one. Each "
     "objective says WHERE you want to get to (qualitative, short). Under EACH "
     "objective, 2 to 5 Key Results that prove you got there: specific, measurable "
     "(number + unit), realistic — measuring the OUTCOME, never the task.\n\n"
     "A KR has no owner and no deadline — it is only the outcome and the target. Who "
     "does it and when belong to the deliverables and the tasks (the schedule and the "
     "execution), not to the KR.\n\n"
     "Number them: KR 1.1, KR 1.2 (of objective 1), KR 2.1... — it is by that number "
     "that the deliverables on card 2.1 say which Key Result they serve.\n\n"
     "PROMPT 1: 'based on this justification, which objectives do you recommend?'"),
    ("2.1 WHAT — Products and expected deliverables",
     "What has to EXIST for the Key Results to happen. Each deliverable is an outcome "
     "(a noun), not an activity: 'Purchasing policy published', not 'Write the "
     "policy'.\n\n"
     "No Key Result may be left without a deliverable: if a KR has nothing that "
     "achieves it, a deliverable is missing (or the KR did not belong to this "
     "project).\n\n"
     "PROMPT 2: 'based on these objectives, which deliverables do you recommend?'"),
    ("2.2 WHAT — Requirements",
     "For each deliverable: what it must have to be accepted (the requested "
     "characteristics) and the acceptance criterion — how we will know it is done.\n\n"
     "A requirement is not a wish: it is a verifiable condition."),
    ("3. WHO — Stakeholders",
     "Who receives the value (CLIENTS), who does the work (TEAM) and who influences, "
     "approves, regulates or is impacted (OTHERS). The SPONSOR is the one who "
     "authorizes and funds it — if you don't know who that is, you don't have an "
     "authorized project yet.\n\n"
     "PROMPT 3: 'based on these deliverables, who are the stakeholders?'\n"
     "The detail of each one goes to the 'Stakeholders [WHO]' list."),
    ("4.1 HOW — Development approach", _TRANCADO),
    ("4.2 HOW — Constraints", _TRANCADO),
    ("4.3 HOW — Assumptions", _TRANCADO),
    ("4.4 HOW — Initial risks", _TRANCADO),
    ("4.5 HOW — Initial scope (WBS or Product Backlog)", _TRANCADO),
    ("4.6 WHERE — Context and boundaries", _TRANCADO),
    ("5. WHEN — Timeline", _TRANCADO_QUANDO_QUANTO),
    ("6. HOW MUCH — Costs (order of magnitude)", _TRANCADO_QUANDO_QUANTO),
]

# ── ETAPA 2 · PREDITIVA ──────────────────────────────────────────────────────
TERMO_PREDITIVA = [
    ("1.1 WHY — Project justification",
     "Today's pain and the value the project creates. YOU write this card — it is the "
     "one thing AI cannot do for you, because it is your context.\n"
     "3 to 6 sentences: what hurts today · who suffers from it · what happens if "
     "nothing is done · what changes once the project delivers.\n\n"
     "It is the start of the chain: every next step builds on this text."),
    ("1.2 WHY — Objectives and Key Results (OKR)",
     "As many objectives as the project calls for — most have more than one. Each "
     "objective says WHERE you want to get to (qualitative, short). Under EACH "
     "objective, 2 to 5 Key Results that prove you got there: specific, measurable "
     "(number + unit), realistic — measuring the OUTCOME, never the task.\n\n"
     "A KR has no owner and no deadline — it is only the outcome and the target. Who "
     "does it and when belong to the deliverables and the tasks (the schedule and the "
     "execution), not to the KR.\n\n"
     "Number them: KR 1.1, KR 1.2 (of objective 1), KR 2.1... — it is by that number "
     "that the deliverables on card 2.1 say which Key Result they serve.\n\n"
     "PROMPT 1: 'based on this justification, which objectives do you recommend?'"),
    ("2.1 WHAT — Products and expected deliverables",
     "What has to EXIST for the Key Results to happen. Each deliverable is an outcome "
     "(a noun), not an activity: 'Purchasing policy published', not 'Write the "
     "policy'.\n\n"
     "No Key Result may be left without a deliverable: if a KR has nothing that "
     "achieves it, a deliverable is missing (or the KR did not belong to this "
     "project).\n\n"
     "PROMPT 2: 'based on these objectives, which deliverables do you recommend?'\n"
     "In step 2 these deliverables become the WBS."),
    ("2.2 WHAT — Requirements",
     "For each deliverable: what it must have to be accepted (the requested "
     "characteristics) and the acceptance criterion — how we will know it is done.\n\n"
     "A requirement is not a wish: it is a verifiable condition."),
    ("3. WHO — Stakeholders",
     "Who receives the value (CLIENTS), who does the work (TEAM) and who influences, "
     "approves, regulates or is impacted (OTHERS). The SPONSOR is the one who "
     "authorizes and funds it — if you don't know who that is, you don't have an "
     "authorized project yet.\n\n"
     "PROMPT 3: 'based on these deliverables, who are the stakeholders?'\n"
     "The detail of each one goes to the 'Stakeholders [WHO]' list."),
    ("4.1 HOW — Development approach",
     "PREDICTIVE. 'The means used to create and evolve the product throughout the life "
     "cycle' (PMBOK Guide, 8th Edition). The 'How?' of 5W2H starts HERE: first you "
     "decide HOW you will run it; constraints, assumptions, risks and the WBS are the "
     "detail of that how.\n\n"
     "You chose predictive because the scope is known and stable enough to plan before "
     "executing: you define the scope, decompose it into a WBS, estimate time and "
     "cost, approve a baseline and control change against it.\n\n"
     "The script 01a_escolher_abordagem.py writes your rationale (the five factors "
     "from the Guide) — and what to watch for so you know when to borrow from agile."),
    ("4.2 HOW — Constraints",
     "The limits imposed from outside: deadline, budget, regulation, technology, "
     "contract, people available.\n\n"
     "A constraint is not negotiated inside the project — you work around it or you "
     "accept it."),
    ("4.3 HOW — Assumptions",
     "What you are ASSUMING to be true without being sure ('the supplier delivers in "
     "30 days', 'the team will be available in July').\n\n"
     "Every assumption that falls becomes a risk. That is why they live side by side."),
    ("4.4 HOW — Initial risks",
     "The high-level risks you can already see at the start — enough for someone to "
     "decide whether to authorize the project.\n"
     "Write them as CAUSE -> EVENT -> IMPACT. 'Delay' is not a risk: it is the "
     "impact.\n\n"
     "In step 3 you go deeper on the 'Risks and Assumptions' list (probability, "
     "impact, response and owner) and the script generates the risk and issue "
     "register."),
    ("4.5 HOW — Initial scope (WBS or Product Backlog)",
     "PREDICTIVE: the first decomposition of the scope — the deliverables opened into "
     "the big parts of the work. This is an initial view: enough to size the "
     "project.\n\n"
     "In step 2 it becomes the full WBS (deliverables -> work packages) on the 'WBS → "
     "Schedule' list, and the script generates the WBS Dictionary. In step 4 those same "
     "work packages get dates, durations and dependencies — the WBS becomes a "
     "schedule."),
    ("4.6 WHERE — Context and boundaries",
     "Where the project happens and how far it goes: area, unit, system, region, "
     "on-site or remote — and, above all, what is left OUT.\n\n"
     "The WHERE is part of the HOW: where the work happens depends on the way you run "
     "it.\n\n"
     "It is the least decisive of the seven questions — if you don't know yet, LEAVE "
     "IT BLANK and decide at the right moment. What really counts here is what is left "
     "OUT: it is the line that prevents the most arguments later.\n\n"
     "The PMBOK Guide, 8th Edition includes this question in the project charter list "
     "('Where will it occur?')."),
    ("5. WHEN — Timeline",
     "The milestones you can already promise. In relative time ('Week 4', 'Month 2') "
     "if you don't have dates yet — it is preliminary on purpose.\n\n"
     "In step 4 this becomes a schedule with dates, dependencies and critical path."),
    ("6. HOW MUCH — Costs (order of magnitude)",
     "A rough estimate, with the BASE and the MARGIN ('USD 20 to 30k — 2 people x 3 "
     "months; margin -25%/+50%').\n\n"
     "Saying 'I don't know yet, and this is the basis of my guess' is honest. Faking "
     "precision is what breaks trust at step 8."),
]

# ── ETAPA 2 · AGIL ───────────────────────────────────────────────────────────
TERMO_AGIL = [
    ("1.1 WHY — Project justification",
     "Today's pain and the value the project creates. YOU write this card — it is the "
     "one thing AI cannot do for you, because it is your context.\n"
     "3 to 6 sentences: what hurts today · who suffers from it · what happens if "
     "nothing is done · what changes once the project delivers.\n\n"
     "In the agile approach this text is the basis of the PRODUCT VISION — and the "
     "PMBOK Guide, 8th Edition says the adaptive life cycle begins exactly here: "
     "'define project and product visions'."),
    ("1.2 WHY — Objectives and Key Results (OKR)",
     "The Vision answers the WHY; the OKR makes it verifiable. As many objectives as "
     "the project calls for — most have more than one. Each objective says where to "
     "get to; and each carries 2 to 5 Key Results that prove you got there: measurable "
     "(number + unit), measuring the OUTCOME (not the task).\n\n"
     "A KR has no owner and no deadline — it is only the outcome and the target. Who "
     "does it and when belong to the deliverables and the tasks (the schedule and the "
     "execution).\n\n"
     "Number them: KR 1.1, KR 1.2 (of objective 1), KR 2.1... — it is by that number "
     "that the deliverables on card 2.1 say which Key Result they serve.\n\n"
     "PROMPT 1: 'based on this justification, which objectives do you recommend?'\n"
     "In agile the KRs also say what the next Sprint has to move."),
    ("2.1 WHAT — Products and expected deliverables",
     "In agile this card is your PRODUCT VISION + the deliverables.\n"
     "What has to EXIST for the Key Results to happen. Here the answer is leaner ON "
     "PURPOSE: a clear vision + the deliverables you can already see today.\n\n"
     "PMBOK Guide, 8th Edition: 'a clear vision is established at the beginning and "
     "known requirements are progressively elaborated... in the form of the product "
     "backlog'.\n\n"
     "PROMPT 2: 'based on these objectives, which deliverables do you recommend?'"),
    ("2.2 WHAT — Requirements",
     "In agile, the requirement of each backlog item becomes its ACCEPTANCE CRITERION "
     "— how you will know that item is done.\n\n"
     "Here, on card 2.2, live the requirements that hold for the WHOLE product (what "
     "does not fit in a single item): performance, security, regulation, "
     "compatibility. They feed the Definition of Done (DoD) in step 5."),
    ("3. WHO — Stakeholders",
     "Who receives the value (CLIENTS/users), who does the work (TEAM) and who "
     "influences, approves or is impacted (OTHERS). The SPONSOR authorizes and funds "
     "it.\n\n"
     "Also identify who plays the PRODUCT OWNER role (who decides backlog priority) "
     "and who the real user of the stories is — without them, a story is a guess.\n\n"
     "PROMPT 3: 'based on these deliverables, who are the stakeholders?'"),
    ("4.1 HOW — Development approach",
     "AGILE — the PMBOK Guide, 8th Edition calls this family ADAPTIVE; Scrum is its "
     "most used method. 'The means used to create and evolve the product throughout "
     "the life cycle'. The 'How?' of 5W2H starts HERE: first you decide HOW you will "
     "run it.\n\n"
     "You chose agile because the requirements are not clear enough to plan everything "
     "up front — and frequent feedback is worth more than predictability: you deliver "
     "in short increments, learn and re-prioritize.\n\n"
     "The script 01a_escolher_abordagem.py writes your rationale (the five factors "
     "from the Guide) — and what to watch for so you know when to borrow from "
     "predictive."),
    ("4.2 HOW — Constraints",
     "The limits imposed from outside: market date, budget, regulation, technology, "
     "team size.\n\n"
     "In agile the typical constraint is the DATE: it is usually fixed — and it is the "
     "scope that flexes to fit inside it."),
    ("4.3 HOW — Assumptions",
     "What you are ASSUMING to be true without being sure ('the user will want this', "
     "'the partner's API can take it').\n\n"
     "In agile an assumption has a better fate than a list: it becomes a HYPOTHESIS — "
     "and Sprint 1 exists to test it."),
    ("4.4 HOW — Initial risks",
     "The high-level risks you can already see at the start. Write them as CAUSE -> "
     "EVENT -> IMPACT.\n\n"
     "In agile a risk does not live in a parallel document: it goes into the BACKLOG. "
     "What is a knowledge uncertainty ('I don't know whether it works') becomes a "
     "time-boxed SPIKE; what is a genuine threat moves up in priority — learning early "
     "what could kill the project is the best risk response there is."),
    ("4.5 HOW — Initial scope (WBS or Product Backlog)",
     "AGILE: the first items of value you can already see, in priority order — the "
     "initial Product Backlog. This is an initial view: enough to size the product and "
     "get started.\n\n"
     "In step 2 it becomes the full Product Backlog (INVEST stories with acceptance "
     "criteria and points) on the 'Product Backlog' list, and the script generates the "
     "spreadsheet."),
    ("4.6 WHERE — Context and boundaries",
     "Where the product lives and how far it goes: area, system, audience — and what "
     "is left OUT (not everything that is possible belongs in the vision).\n\n"
     "The WHERE is part of the HOW: where the work happens depends on the way you run "
     "it (a team that delivers in short increments and gets feedback from the real "
     "user works in a different 'where' from one that delivers everything at the "
     "end).\n\n"
     "It is the least decisive of the seven questions — if you don't know yet, LEAVE "
     "IT BLANK and decide at the right moment. What really counts here is what is left "
     "OUT: in agile the boundary does not freeze the scope; it protects the focus.\n\n"
     "The PMBOK Guide, 8th Edition includes this question in the adaptive project "
     "charter ('Where will it occur?')."),
    ("5. WHEN — Timeline",
     "The horizon: when you want the first delivery of value (the first useful "
     "increment) and which milestones are already promised.\n\n"
     "In agile the date is usually fixed and it is the scope that flexes. In step 4 "
     "this becomes a Sprint roadmap."),
    ("6. HOW MUCH — Costs (order of magnitude)",
     "A rough estimate, with the BASE and the MARGIN.\n\n"
     "In agile the cost per Sprint tends to be FIXED (the team is the same, the Sprint "
     "is the same size) — what varies is how much value fits inside it. Step 4 details "
     "this on the 'Budget' list."),
]

# ── Os textos-guia de cada lista ─────────────────────────────────────────────
GUIA_TITULO = "Guide to this list"

GUIAS_ESCOPO = {
    "PREDITIVA": (
        "The WHAT, at the level where the work happens: the WBS (work breakdown "
        "structure).\n"
        "Each deliverable from card 2.1 opens up here into WORK PACKAGES — the lowest "
        "level, the one that has cost, duration and an acceptance criterion.\n"
        "Rule: a work package is an OUTCOME (a noun), not an activity. 'Purchasing "
        "policy published', not 'write the policy'.\n"
        "Filled in by step 2 — and it is from here that the schedule and the budget "
        "come."),
    "AGIL": (
        "The WHAT, at the level where the work happens: the PRODUCT BACKLOG.\n"
        "PMBOK Guide, 8th Edition: 'a dynamic, prioritized list of work items and "
        "features', focused on VALUE-DRIVEN OUTCOMES. Each deliverable from card 2.1 "
        "becomes items of value here, always ordered by value: the most important on "
        "top.\n"
        "Each item is an OUTCOME that comes to exist (e.g. 'Strength routine twice a "
        "week in place'). The user story — 'As a <who>, I want <what>, so that "
        "<value>' — is OPTIONAL (you choose the form in Step 1); it is not required in "
        "order to be agile.\n"
        "The backlog is neither born complete nor ever finished: it is refined every "
        "Sprint (progressive elaboration).\n"
        "Filled in by step 2."),
}

GUIAS = {
    "PARTES": (
        "WHO. One card per stakeholder, in three groups: CLIENTS (who receives the "
        "value), TEAM (who does the work) and OTHERS (who influences, approves, "
        "regulates or is impacted).\n"
        "Step 1: who they are and what they expect. Step 6: how to engage each one — "
        "from where they are (resistant/neutral/supportive/leading) to where they need "
        "to be.\n"
        "Projects don't die of schedule. They die of people who weren't listened to."),
    "RISCOS": (
        "What could go wrong — and what could go very right (an opportunity).\n"
        "Write the risk as CAUSE -> EVENT -> IMPACT ('because it depends on a single "
        "supplier, the contract may be delayed, pushing deliverable X'). 'Delay' is "
        "not a risk: it is the impact.\n"
        "This is also where the ASSUMPTIONS live (what you take as true without being "
        "sure — if it falls, it becomes a risk) and the CONSTRAINTS (the limits "
        "imposed on you).\n"
        "Filled in by step 3."),
    "ORCAMENTO": (
        "HOW MUCH. Step 1: the order of magnitude (an honest guess, with a margin). "
        "Step 4: the budget item by item, with the month the money goes out and a "
        "contingency reserve proportional to the risks.\n"
        "One card per cost item."),
    "EXECUCAO": (
        "The work that is happening NOW. Pull here what is in progress and move it to "
        "the done list when it finishes — that is what feeds the Status Report (step "
        "8): planned vs. actual comes from here.\n"
        "The rule that separates a project from a wish list: nothing enters here "
        "without an owner and a date."),
    "PRONTO": (
        "What is really DONE — done according to the Definition of Done you wrote in "
        "step 5, not 'done in my head'.\n"
        "Every card that arrives here is value delivered. In step 10 you compare what "
        "arrived with the Key Results from step 1."),
    "MUDANCAS": (
        "Everything changes. A serious project is not one that doesn't change: it is "
        "one that knows what the change costs.\n"
        "One card per change request: what is being asked, why, and the impact on "
        "scope, time, cost, quality, risks and stakeholders (step 9). Approved? The "
        "baseline changes — and the card records the new one.\n"
        "In the agile approach, change enters as a re-prioritization of the backlog: "
        "what moves up, and what moves down to make room."),
    "CONCLUIDO": (
        "Your track record in the course: each completed step becomes a card here, "
        "with the date. It is your evidence of progress (and the basis of your "
        "certificate).\n"
        "Don't move project cards here — this list belongs to the COURSE."),
}

# ── Escalas do registro de riscos (a planilha usa 5 niveis) ──────────────────
ROT_PROB = {1: "1-Very low", 2: "2-Low", 3: "3-Medium", 4: "4-High", 5: "5-Very high"}
ROT_IMP = {1: "1-Very low", 2: "2-Low", 3: "3-Medium", 4: "4-High", 5: "5-Very high"}

# ── Agil: os prefixos dos cartoes de Meta e de Definicao de Pronto ───────────
META_PREFIXO = "🎯 SPRINT GOAL"
META_PRODUTO_PREFIXO = "🏁 PRODUCT GOAL"
DOD_PREFIXO = "✅ Definition of Done"

# ── A foto viva do quadro (o [INPUT QUADRO] dos passos 5 a 10) ───────────────
ROTULO_SNAPSHOT = [
    ("ESCOPO", "WBS → SCHEDULE (scope + task status) / Product Backlog"),
    ("EXECUCAO", "SPRINT BACKLOG"),
    ("PRONTO", "INCREMENT / DELIVERED"),
    ("RISCOS", "RISKS AND ASSUMPTIONS"),
    ("ORCAMENTO", "BUDGET"),
    ("PARTES", "STAKEHOLDERS"),
    ("MUDANCAS", "CHANGES"),
]
