"""Recorded prices from Stage 2 deep-read.

These are the canonical numbers the test harness compares against. Update only
when Stage 2 facts change (rare).
"""

# Source: lfcs-pricing-investigation/investigation-output/stage-2-job-analysis.md

JOBS = {
    "2602": {
        "job_no": "2602",
        "client": "Dec Projects",
        "name": "Munmorah Bridge",
        "job_category": "Bridge-FRP",
        "agent_first_pass_v1_ex_gst": 407_870.00,
        "agent_first_pass_v2_blind_ex_gst": 553_841.00,
        "liam_submitted_ex_gst": 407_870.00,
        "liam_submitted_inc_gst": 448_657.00,
        "submission_authored_by": "liam",
        "submission_date": "2026-05-04",
        "notes": (
            "CC v1 = $407,870 (ratified by Liam-signed cover sheet, dated 2026-05-04). "
            "CC v2-blind = $553,841 (+35.8% over v1; STANDING-SCOPE CORRECTION removed pumps + EWP "
            "in the post-blind pass per LFCS standing FRP scope). v1 IS what went out as Liam-final. "
            "Test-harness v2-blind comparison shows agent-without-anchor wide variance per Stage 2 § 2.7."
        ),
    },
    "2629": {
        "job_no": "2629",
        "client": "TCE Contracting",
        "name": "Erskine Park WWTP Slab",
        "job_category": "WWTP-Slab-Industrial",
        "agent_first_pass_v1_ex_gst": 219_800.00,
        "hasibul_priced_ex_gst": 264_767.00,
        "liam_submitted_ex_gst": 267_237.00,
        "liam_submitted_inc_gst": 293_960.00,
        "submission_authored_by": "liam",
        "submission_date": "2026-05-07",
        "notes": (
            "CC v1 = $219,800 (Rocky-signed cover, 2026-05-04, used 15% redundancy). "
            "Hasibul = $264,767 (actuals basis @ $94.58/m² EC; both +15% margin AND +10% contingency). "
            "Liam-final = $267,237 (Liam revised pricing per Hus's basis 2026-05-07; +10% contingency only). "
            "Spread CC → Liam-final: +$47,437 (+21.6%). Hasibul → Liam-final: +$2,470 (+0.9%)."
        ),
    },
    "HCB": {
        "job_no": "HCB",
        "client": "The Civil Experts Pty Ltd",
        "name": "Hammond Canal Bridge (P424-HCB)",
        "job_category": "Bridge-FRP",
        # HONEST: agent has NEVER priced HCB. The methodology Rate Templates were
        # DERIVED from HCB's submitted BOQ (5 formwork rates: $207.87/m² abutment,
        # $227.82 wingwall, $624.20 deck, $700.40 diaphragm, $205.76 approach-slab).
        # An agent first-pass using those very rate templates would tautologically
        # match HCB submitted (or close) — that's the leak the user flagged.
        # Until lfcs-pricing-estimator (M5) exists with rates DERIVED FROM OTHER JOBS,
        # there is no honest agent_first_pass for HCB. Setting to None here so TEST 1
        # explicitly skips it rather than falsely returning 0%.
        "agent_first_pass_v1_ex_gst": None,
        "liam_submitted_ex_gst": 434_462.00,
        "liam_submitted_inc_gst": 477_908.20,
        "submission_authored_by": "liam",
        "submission_date": "2026-05-06",
        "notes": (
            "HCB Liam-submitted = $434,462 ex GST (from canonical fixture letter-of-offer-template.docx). "
            "Methodology rate templates are DERIVED from HCB BOQ; agent has never priced HCB itself. "
            "Therefore an apples-to-apples first-pass-vs-submitted error CANNOT be computed honestly "
            "until rate templates are derived from independent jobs (Stage 5 milestone 5 work). "
            "Including HCB as a third reference job for fixture diversity + as an explicit "
            "tautology guard (the harness must SKIP HCB rather than return 0%)."
        ),
    },
}


# Synthetic override fixtures — one per significant CC-vs-Liam delta on 2629.
# These are the overrides Liam *would* have captured if the override-capture skill
# had been live during the 2026-05-04 to 2026-05-07 review session.
SYNTHETIC_OVERRIDES_2629 = [
    {
        "description": "Slab pour productivity — actuals-derived basis vs hourly-Rate-Card",
        "original_rate_ex_gst": 11_100.00,  # CC's $74/m² × 150 m²
        "override_rate_ex_gst": 14_187.00,  # Liam-final basis ($94.58/m² × 150 m²)
        "reason_codes": ["RATE-BASIS", "PRODUCTIVITY-CALIBRATION"],
        "reviewer_type": "Trades-Internal-Liam",
        "reviewer_name": "Liam",
        "free_text_rationale": (
            "Replaced Rate Card V1.7 hourly basis with EC actuals from Hus's pricing. "
            "Productivity adjustment for irregular pentagon + heavy reo + plinth congestion."
        ),
    },
    {
        "description": "Reo install productivity — cogged-edges + banded zones",
        "original_rate_ex_gst": 8_500.00,
        "override_rate_ex_gst": 9_775.00,  # +15%
        "reason_codes": ["PRODUCTIVITY-CALIBRATION"],
        "reviewer_type": "Trades-Internal-Liam",
        "reviewer_name": "Liam",
        "free_text_rationale": (
            "+15% productivity drop for cogged-edges-everywhere + 5N24/8N20 banded zones."
        ),
    },
    {
        "description": "BW1 blocklayer — in scope to by-others",
        "original_rate_ex_gst": 4_500.00,
        "override_rate_ex_gst": 0.00,
        "reason_codes": ["SCOPE-SHIFT"],
        "reviewer_type": "Trades-Internal-Liam",
        "reviewer_name": "Liam",
        "free_text_rationale": (
            "BW1 internal blocklay removed from LFCS scope — by-others blocklayer takes it."
        ),
    },
    {
        "description": "PF1 line item rate adjustment",
        "original_rate_ex_gst": 2_055.00,  # Hasibul's rate
        "override_rate_ex_gst": 4_300.00,  # Liam-final
        "reason_codes": ["RATE-BASIS"],
        "reviewer_type": "Trades-Internal-Liam",
        "reviewer_name": "Liam",
        "free_text_rationale": (
            "PF1 line bumped from Hus's $2,055 to Liam's $4,300 — only line-level "
            "difference identified between Hus's pricing and Liam's final per Stage 2 § 3.3."
        ),
    },
    {
        "description": "Contingency mechanism — redundancy → 90%-to-IFC drift contingency",
        "original_rate_ex_gst": 28_670.00,  # 15% redundancy on $191,130
        "override_rate_ex_gst": 24_294.00,  # 10% contingency on $242,943
        "reason_codes": ["PRELIM-VISIBILITY", "POSTURE-MISMATCH"],
        "reviewer_type": "Trades-Internal-Liam",
        "reviewer_name": "Liam",
        "free_text_rationale": (
            "Replaced LFCS-standard 15% redundancy with 10% contingency for 90%-to-IFC drift. "
            "Conceptually different cushion: scope-risk vs margin. Per Stage 2 § 3.5 framing."
        ),
    },
]


SYNTHETIC_OVERRIDES_HCB = [
    {
        "description": "Diaphragm beams ADDED — missing from HC pricing schedule",
        "original_rate_ex_gst": 0.00,
        "override_rate_ex_gst": 14_611.00,
        "reason_codes": ["STRUCTURAL-ADD"],
        "reviewer_type": "Trades-Internal-Liam",
        "reviewer_name": "Liam",
        "free_text_rationale": (
            "Added diaphragm beams at the abutments — missing from HC pricing schedule. "
            "3 lines: $11,094 formwork + $3,046 reo + $470 concrete."
        ),
    },
    {
        "description": "Bridge edge protection — Rate Only fallback for hire beyond N-week base",
        "original_rate_ex_gst": 0.00,
        "override_rate_ex_gst": 9_000.00,  # ~6 weeks @ $1,500/wk
        "reason_codes": ["SCOPE-SHIFT", "POSTURE-MISMATCH"],
        "reviewer_type": "Trades-Internal-Liam",
        "reviewer_name": "Liam",
        "free_text_rationale": (
            "Rate Only line for bridge edge protection hire beyond 6-week base period. "
            "Hire-duration assumption clause inserted in Detailed Assumptions."
        ),
    },
    {
        "description": "Cranage delineation — HC supplies for super-T launches; LFCS supplies parapet lifts only",
        "original_rate_ex_gst": 0.00,
        "override_rate_ex_gst": 0.00,  # Documentation-only; locks scope boundary
        "reason_codes": ["SCOPE-SHIFT", "POSTURE-MISMATCH"],
        "reviewer_type": "Trades-Internal-Liam",
        "reviewer_name": "Liam",
        "free_text_rationale": (
            "Cranage delineation explicit per HCB pattern: HC supplies for super-T launches; "
            "LFCS supplies for parapet lifts. #1 source of bridge-job disputes — never leave ambiguous."
        ),
    },
]


SYNTHETIC_OVERRIDES_2602 = [
    {
        "description": "Saltwater consumables uplift — wrong-applied (lake not saltwater)",
        "original_rate_ex_gst": 19_400.00,  # Synthetic; ~5% of $407,870 less prelims
        "override_rate_ex_gst": 0.00,
        "reason_codes": ["BOILERPLATE-CARRY"],
        "reviewer_type": "Trades-Internal-Rocky",
        "reviewer_name": "Rocky",
        "free_text_rationale": (
            "Hammond Canal is LAKE, not seawater, not tidal. Q-G7 grill answer overrides "
            "boilerplate 5% saltwater uplift carried over from coastal precedent."
        ),
    },
    {
        "description": "Concrete pumps + EWP — STANDING-SCOPE CORRECTION (LFCS standing FRP scope)",
        "original_rate_ex_gst": 11_500.00,
        "override_rate_ex_gst": 0.00,
        "reason_codes": ["STRUCTURAL-DEDUCT", "SCOPE-SHIFT"],
        "reviewer_type": "Trades-Internal-Rocky",
        "reviewer_name": "Rocky",
        "free_text_rationale": (
            "Concrete pumps + EWP excluded per LFCS standing FRP scope. Direct $11,500; "
            "lump $12,880 after prelim+margin removal. Per Stage 2 § 2.7 STANDING-SCOPE CORRECTION."
        ),
    },
    {
        "description": "Variation rate-card mismatch — $98/hr vs $85/hr submission",
        "original_rate_ex_gst": 5_000.00,
        "override_rate_ex_gst": 5_000.00,  # Documentation-only; rate value unchanged but flagged
        "reason_codes": ["POSTURE-MISMATCH"],
        "reviewer_type": "Trades-Internal-Liam",
        "reviewer_name": "Liam",
        "free_text_rationale": (
            "Variation rate-card shows $98/hr trade vs $85/hr submission, $108/hr supervisor vs $95, "
            "materials cost+12.5% vs +10%. Defensible-for-variations posture broken. "
            "Pre-Pricing-Grill Q-F1 said defensible — lock variation rates to submission rates."
        ),
    },
]
