"""
AI Room Designer — Stage 1 spike: mode definitions + structure-lock prompt builder.

The whole spike hinges on ONE question: can an image-edit model redesign a room
while keeping the SAME room recognisable (architecture, windows, doors, camera
angle, layout geometry)?

Strategy ("structure lock"): every mode prompt is built as
  [immutable structure clause] + [mode-specific change clause] + [realism clause]
The structure clause is identical across modes so drift differences between
modes are attributable to how aggressive the mode's change clause is.
"""

STRUCTURE_LOCK = (
    "Edit this exact room photo. Preserve the room's architecture exactly: "
    "same walls, ceiling, floor footprint, window and door positions and sizes, "
    "same camera angle and perspective, same room proportions. "
    "Do not add or remove windows, doors, or walls. "
    "The result must be instantly recognisable as the same room, redesigned."
)

REALISM = (
    "Photorealistic interior photograph, natural light, no warped furniture, "
    "no melted objects, no extra handles or limbs, no text or watermark."
)

MODES = {
    "complete-transformation": {
        "label": "Complete Transformation",
        "aggression": 5,
        "changes": (
            "Fully redesign the interior: new furniture style, new colour palette, "
            "new decor, new lighting fixtures. Everything inside the room's shell "
            "may change, but the shell itself must not."
        ),
        "keeps_furniture": False,
    },
    "look-more-expensive": {
        "label": "Look More Expensive",
        "aggression": 3,
        "changes": (
            "Keep the same furniture layout, but upgrade every finish to look "
            "high-end and luxurious: richer materials (marble, brass, velvet, "
            "solid wood), layered lighting, tailored styling, decluttered surfaces."
        ),
        "keeps_furniture": False,
    },
    "pinterest-mode": {
        "label": "Pinterest Mode",
        "aggression": 4,
        "changes": (
            "Restyle the room to a polished, magazine-worthy Pinterest aesthetic: "
            "cohesive colour story, styled shelves and surfaces, plants, art, "
            "soft layered textiles. Keep the same furniture positions."
        ),
        "keeps_furniture": False,
    },
    "budget-refresh": {
        "label": "Budget Refresh",
        "aggression": 2,
        "changes": (
            "A realistic low-budget refresh only: repaint walls a fresh colour, "
            "keep all existing furniture in place, tidy and declutter, add only "
            "cheap touches (cushions, a rug, plants, simple art). Nothing structural, "
            "nothing expensive-looking."
        ),
        "keeps_furniture": True,
    },
    "fix-my-layout": {
        "label": "Fix My Layout",
        "aggression": 3,
        "changes": (
            "Keep ALL of the user's existing furniture and finishes exactly as they "
            "are — same pieces, same colours, same materials — but rearrange the "
            "furniture into a better, more functional layout with clear walkways."
        ),
        "keeps_furniture": True,
    },
    "colors-and-lighting": {
        "label": "Colors & Lighting",
        "aggression": 1,
        "changes": (
            "Change ONLY the wall colour and the lighting mood (warmer, layered "
            "light). Every piece of furniture, its position, and every object "
            "stays exactly where it is."
        ),
        "keeps_furniture": True,
    },
}


def build_prompt(mode_key: str) -> str:
    """Full edit prompt for one mode = structure lock + mode changes + realism."""
    if mode_key not in MODES:
        raise KeyError(f"Unknown mode '{mode_key}'. Valid: {sorted(MODES)}")
    m = MODES[mode_key]
    return f"{STRUCTURE_LOCK} {m['changes']} {REALISM}"
