#!/usr/bin/env python3
"""Writes inputs.json: the made-up LinkedIn drafts (an imaginary UX research consultancy, Fernhill Research) and two length controls."""
import json

PLAIN = ("Most usability problems are found by the first five people who try your product. "
         "That is why our December workshop is short: two hours, one real prototype, five test sessions you run yourself. "
         "You leave with a script, a note-taking sheet and a list of the three fixes that matter most. "
         "Seats are limited to twelve so everyone gets feedback on their own questions. "
         "Comment WORKSHOP and I will send the details.")
LINES = ["Most usability problems are found by the first five people who try your product.",
         "Our December workshop:",
         "- two hours",
         "- one real prototype",
         "- five test sessions you run yourself",
         "You leave with a script, a note-taking sheet and the three fixes that matter most.",
         "Twelve seats. Comment WORKSHOP for the details."]
BREAKS = "\n\n".join(LINES)
EMOJI = ("✅ Two hours, one real prototype\n\n"
         "\U0001F449 Five test sessions you run yourself\n\n"
         "\U0001F680 Leave with the three fixes that matter most")
PEOPLE = ("\U0001F44B\U0001F3FD Hello from Toronto \U0001F1E8\U0001F1E6\n\n"
          "\U0001F469‍\U0001F4BB Twelve seats for product designers and researchers.")
def bold(s):
    out = []
    for ch in s:
        if "A" <= ch <= "Z": out.append(chr(0x1D5D4 + ord(ch) - 65))
        elif "a" <= ch <= "z": out.append(chr(0x1D5EE + ord(ch) - 97))
        else: out.append(ch)
    return "".join(out)
HOOK = "Five users find most usability problems."
BOLD_PLAIN = HOOK + "\n\nOur December workshop shows you how to run those five sessions yourself."
BOLD = bold(HOOK) + "\n\nOur December workshop shows you how to run those five sessions yourself."
URL = ("Workshop details and the free note-taking sheet: "
       "https://example.com/workshops/usability-testing-december?utm_source=linkedin&utm_medium=social&utm_campaign=dec-workshop")
TAGS = ("Thanks to everyone who joined the pilot session with @Fernhill Research last week.\n\n"
        "#UXResearch #UsabilityTesting #ProductDesign")
para = ("Here is what changed after five usability sessions on one checkout prototype: the team stopped arguing about button colors "
        "and started fixing the address form, because four of five people got stuck there. ")
NEAR = ""
while len(NEAR) + len(para) < 2900:
    NEAR += para
NEAR = NEAR.rstrip() + "\n\n" + " ".join(["\U0001F680"] * 30) + "\n\nTwelve seats. Comment WORKSHOP for the details."
COMMENT = ("Great question. " + "In our sessions the address form caused more drop-offs than anything else on the page, so we test it first. ") * 9
COMMENT = COMMENT.strip()
HEADLINE = "UX Research Consultant | Usability Testing for SaaS Teams \U0001F3A4 Speaker | I help product teams find the problems before customers do"
drafts = [
    ["control-3000", "Control: the letter a, 3,000 times", "a" * 3000],
    ["control-3001", "Control: the letter a, 3,001 times", "a" * 3001],
    ["plain", "Plain paragraph, no emoji, no line breaks", PLAIN],
    ["line-breaks", "A shorter workshop post as a list with blank lines", BREAKS],
    ["crlf", "The list post saved with Windows line breaks", BREAKS.replace("\n", "\r\n")],
    ["emoji-bullets", "Three emoji bullets: check mark, pointing hand, rocket", EMOJI],
    ["skin-flag-zwj", "Waving hand with skin tone, a flag, a woman technologist", PEOPLE],
    ["bold-plain", "Hook in plain letters", BOLD_PLAIN],
    ["bold-unicode", "Same hook in Unicode bold letters", BOLD],
    ["long-url", "A link with tracking parameters", URL],
    ["hashtags-mention", "Three hashtags and a typed @mention", TAGS],
    ["near-limit", "Long post with 30 rocket emoji near the limit", NEAR],
    ["comment", "A long comment draft", COMMENT],
    ["headline", "A profile headline with pipes and one emoji", HEADLINE],
]
json.dump({"drafts": drafts}, open("inputs.json", "w", encoding="utf-8"), ensure_ascii=False, indent=1)
print("wrote inputs.json:", len(drafts), "drafts")
