{"openapi":"3.1.0","info":{"title":"Mercury Bridges Backend","version":"3.0"},"paths":{"/request-code":{"post":{"summary":"Request Code","operationId":"request_code_request_code_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestCodeRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/register":{"post":{"summary":"Register User","operationId":"register_user_register_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RegisterRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/verify-login":{"post":{"summary":"Verify Login","operationId":"verify_login_verify_login_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoginRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/create-checkout-session":{"post":{"summary":"Create Checkout Session","description":"Crea una Stripe Checkout Session per l'abbonamento scelto.\nIl frontend reindirizza l'utente all'URL restituito.","operationId":"create_checkout_session_create_checkout_session_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckoutRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/stripe-webhook":{"post":{"summary":"Stripe Webhook","description":"Riceve gli eventi da Stripe (pagamento riuscito, cancellazione, ecc.)\ne aggiorna Supabase di conseguenza.\n\nDa configurare su Stripe Dashboard → Sviluppatori → Webhook:\nURL: https://mercurybridges.com/stripe-webhook\nEventi da ascoltare:\n  - customer.subscription.created\n  - customer.subscription.updated\n  - customer.subscription.deleted","operationId":"stripe_webhook_stripe_webhook_post","parameters":[{"name":"stripe-signature","in":"header","required":false,"schema":{"type":"string","title":"Stripe-Signature"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/user-plan":{"get":{"summary":"Get User Plan","description":"Restituisce il piano corrente dell'utente e i contatori.\nChiamato dal frontend per mostrare le info all'utente.","operationId":"get_user_plan_user_plan_get","parameters":[{"name":"email","in":"query","required":true,"schema":{"type":"string","title":"Email"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/":{"get":{"summary":"Get Home","operationId":"get_home__get","responses":{"200":{"description":"Successful Response","content":{"text/html":{"schema":{"type":"string"}}}}}}},"/login.html":{"get":{"summary":"Get Login","operationId":"get_login_login_html_get","responses":{"200":{"description":"Successful Response","content":{"text/html":{"schema":{"type":"string"}}}}}}},"/register.html":{"get":{"summary":"Get Register","operationId":"get_register_register_html_get","responses":{"200":{"description":"Successful Response","content":{"text/html":{"schema":{"type":"string"}}}}}}},"/privacy.html":{"get":{"summary":"Get Privacy","operationId":"get_privacy_privacy_html_get","responses":{"200":{"description":"Successful Response","content":{"text/html":{"schema":{"type":"string"}}}}}}},"/terms.html":{"get":{"summary":"Get Terms","operationId":"get_terms_terms_html_get","responses":{"200":{"description":"Successful Response","content":{"text/html":{"schema":{"type":"string"}}}}}}},"/applicationinfo.html":{"get":{"summary":"Get Appinfo","operationId":"get_appinfo_applicationinfo_html_get","responses":{"200":{"description":"Successful Response","content":{"text/html":{"schema":{"type":"string"}}}}}}},"/plans.html":{"get":{"summary":"Get Plans","operationId":"get_plans_plans_html_get","responses":{"200":{"description":"Successful Response","content":{"text/html":{"schema":{"type":"string"}}}}}}},"/privacy_en.html":{"get":{"summary":"Get Privacy En","operationId":"get_privacy_en_privacy_en_html_get","responses":{"200":{"description":"Successful Response","content":{"text/html":{"schema":{"type":"string"}}}}}}},"/terms_en.html":{"get":{"summary":"Get Terms En","operationId":"get_terms_en_terms_en_html_get","responses":{"200":{"description":"Successful Response","content":{"text/html":{"schema":{"type":"string"}}}}}}},"/applicationinfo_en.html":{"get":{"summary":"Get Appinfo En","operationId":"get_appinfo_en_applicationinfo_en_html_get","responses":{"200":{"description":"Successful Response","content":{"text/html":{"schema":{"type":"string"}}}}}}},"/hub.html":{"get":{"summary":"Get Hub","operationId":"get_hub_hub_html_get","responses":{"200":{"description":"Successful Response","content":{"text/html":{"schema":{"type":"string"}}}}}}},"/learn.html":{"get":{"summary":"Get Learn","operationId":"get_learn_learn_html_get","responses":{"200":{"description":"Successful Response","content":{"text/html":{"schema":{"type":"string"}}}}}}},"/learn/chat":{"post":{"summary":"Learn Chat","description":"Proxy per le risposte AI di Mercury Learn (domande dell'esaminatore,\nrisposte suggerite). Sostituisce la chiamata diretta a OpenAI dal client:\nqui la chiave resta server-side e il consumo viene scalato dallo stesso\npool di /translate-conversation.","operationId":"learn_chat_learn_chat_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LearnChatRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/learn/translate":{"post":{"summary":"Learn Translate","description":"Traduzione di supporto (es. mostrare la frase suggerita anche nella\nlingua madre dell'utente). NON consuma minuti: è un'utility di\nvisualizzazione, il consumo vero avviene in /learn/chat per ogni turno.","operationId":"learn_translate_learn_translate_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LearnTranslateRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/learn/progress":{"post":{"summary":"Save Learn Progress","description":"Salva o aggiorna il progresso del corso A1→C2 su Supabase.\nUpsert su email — nessuna conversazione salvata, solo livello e lezione.","operationId":"save_learn_progress_learn_progress_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LearnProgressRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"summary":"Load Learn Progress","description":"Carica il progresso salvato dell'utente per il corso.","operationId":"load_learn_progress_learn_progress_get","parameters":[{"name":"email","in":"query","required":true,"schema":{"type":"string","title":"Email"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/translate-conversation":{"post":{"summary":"Translate Conversation","operationId":"translate_conversation_translate_conversation_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_translate_conversation_translate_conversation_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/brief":{"post":{"summary":"Mercury Brief","description":"Mercury Brief — Riassunto + traduzione di un documento o URL.\n\nInput:  file (PDF/DOCX) oppure url\nOutput: { summary, translation, chars_processed, lang, piano }\n\nConsumo dal pool condiviso (stessa colonna di Translate e Learn):\n  free        → 2 turni da traduzioni_oggi\n  a pagamento → 1.30 minuti fissi","operationId":"mercury_brief_brief_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_mercury_brief_brief_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/brief.html":{"get":{"summary":"Get Brief","operationId":"get_brief_brief_html_get","responses":{"200":{"description":"Successful Response","content":{"text/html":{"schema":{"type":"string"}}}}}}},"/brief/download/pdf":{"post":{"summary":"Brief Download Pdf","operationId":"brief_download_pdf_brief_download_pdf_post","requestBody":{"content":{"application/x-www-form-urlencoded":{"schema":{"$ref":"#/components/schemas/Body_brief_download_pdf_brief_download_pdf_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/brief/download/docx":{"post":{"summary":"Brief Download Docx","operationId":"brief_download_docx_brief_download_docx_post","requestBody":{"content":{"application/x-www-form-urlencoded":{"schema":{"$ref":"#/components/schemas/Body_brief_download_docx_brief_download_docx_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/manga/translate":{"post":{"summary":"Manga Translate","operationId":"manga_translate_manga_translate_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_manga_translate_manga_translate_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/manga.html":{"get":{"summary":"Get Manga","operationId":"get_manga_manga_html_get","responses":{"200":{"description":"Successful Response","content":{"text/html":{"schema":{"type":"string"}}}}}}},"/shield/check-message":{"post":{"summary":"Shield Check Message","operationId":"shield_check_message_shield_check_message_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_shield_check_message_shield_check_message_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/shield/check-phone":{"post":{"summary":"Shield Check Phone","operationId":"shield_check_phone_shield_check_phone_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ShieldPhoneCheckRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/shield/report-phone":{"post":{"summary":"Shield Report Phone","operationId":"shield_report_phone_shield_report_phone_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ShieldPhoneReportRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/shield.html":{"get":{"summary":"Get Shield","operationId":"get_shield_shield_html_get","responses":{"200":{"description":"Successful Response","content":{"text/html":{"schema":{"type":"string"}}}}}}}},"components":{"schemas":{"Body_brief_download_docx_brief_download_docx_post":{"properties":{"summary":{"type":"string","title":"Summary","default":""},"translation":{"type":"string","title":"Translation","default":""},"lang":{"type":"string","title":"Lang","default":"Italiano"},"filename":{"type":"string","title":"Filename","default":"mercury-brief"},"mode":{"type":"string","title":"Mode","default":"summary"},"email":{"type":"string","title":"Email","default":""}},"type":"object","title":"Body_brief_download_docx_brief_download_docx_post"},"Body_brief_download_pdf_brief_download_pdf_post":{"properties":{"summary":{"type":"string","title":"Summary","default":""},"translation":{"type":"string","title":"Translation","default":""},"lang":{"type":"string","title":"Lang","default":"Italiano"},"filename":{"type":"string","title":"Filename","default":"mercury-brief"},"mode":{"type":"string","title":"Mode","default":"summary"},"email":{"type":"string","title":"Email","default":""}},"type":"object","title":"Body_brief_download_pdf_brief_download_pdf_post"},"Body_manga_translate_manga_translate_post":{"properties":{"email":{"type":"string","title":"Email"},"target_lang":{"type":"string","title":"Target Lang","default":"italiano"},"regions":{"type":"string","title":"Regions","default":"[]"},"file":{"type":"string","contentMediaType":"application/octet-stream","title":"File"},"file_clean":{"type":"string","contentMediaType":"application/octet-stream","title":"File Clean"}},"type":"object","required":["file"],"title":"Body_manga_translate_manga_translate_post"},"Body_mercury_brief_brief_post":{"properties":{"file":{"type":"string","contentMediaType":"application/octet-stream","title":"File"},"url":{"type":"string","title":"Url"},"target_lang":{"type":"string","title":"Target Lang","default":"Italiano"},"email":{"type":"string","title":"Email"}},"type":"object","title":"Body_mercury_brief_brief_post"},"Body_shield_check_message_shield_check_message_post":{"properties":{"email":{"type":"string","title":"Email"},"testo":{"type":"string","title":"Testo"},"file":{"type":"string","contentMediaType":"application/octet-stream","title":"File"}},"type":"object","title":"Body_shield_check_message_shield_check_message_post"},"Body_translate_conversation_translate_conversation_post":{"properties":{"source_lang":{"type":"string","title":"Source Lang"},"target_lang":{"type":"string","title":"Target Lang"},"speaker_label":{"type":"string","title":"Speaker Label"},"context_type":{"type":"string","title":"Context Type","default":"generale"},"text_input":{"type":"string","title":"Text Input"},"file":{"type":"string","contentMediaType":"application/octet-stream","title":"File"},"email":{"type":"string","title":"Email"},"durata_sec":{"type":"number","title":"Durata Sec","default":0}},"type":"object","required":["source_lang","target_lang","speaker_label"],"title":"Body_translate_conversation_translate_conversation_post"},"CheckoutRequest":{"properties":{"email":{"type":"string","title":"Email"},"price_id":{"type":"string","title":"Price Id"}},"type":"object","required":["email","price_id"],"title":"CheckoutRequest"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"LearnChatRequest":{"properties":{"email":{"type":"string","title":"Email"},"messages":{"items":{},"type":"array","title":"Messages"},"system":{"type":"string","title":"System"},"durata_sec":{"type":"number","title":"Durata Sec","default":0},"max_tokens":{"type":"integer","title":"Max Tokens","default":300}},"type":"object","required":["messages","system"],"title":"LearnChatRequest"},"LearnProgressRequest":{"properties":{"email":{"type":"string","title":"Email"},"target_lang":{"type":"string","title":"Target Lang"},"native_lang":{"type":"string","title":"Native Lang"},"level":{"type":"string","title":"Level"},"lesson":{"type":"integer","title":"Lesson","default":0}},"type":"object","required":["email","target_lang","native_lang","level"],"title":"LearnProgressRequest"},"LearnTranslateRequest":{"properties":{"email":{"type":"string","title":"Email"},"text":{"type":"string","title":"Text"},"target_lang_name":{"type":"string","title":"Target Lang Name"}},"type":"object","required":["text","target_lang_name"],"title":"LearnTranslateRequest"},"LoginRequest":{"properties":{"email":{"type":"string","title":"Email"},"code":{"type":"string","title":"Code"}},"type":"object","required":["email","code"],"title":"LoginRequest"},"RegisterRequest":{"properties":{"email":{"type":"string","title":"Email"},"code":{"type":"string","title":"Code"}},"type":"object","required":["email","code"],"title":"RegisterRequest"},"RequestCodeRequest":{"properties":{"email":{"type":"string","title":"Email"}},"type":"object","required":["email"],"title":"RequestCodeRequest"},"ShieldPhoneCheckRequest":{"properties":{"email":{"type":"string","title":"Email"},"numero":{"type":"string","title":"Numero"}},"type":"object","required":["numero"],"title":"ShieldPhoneCheckRequest"},"ShieldPhoneReportRequest":{"properties":{"email":{"type":"string","title":"Email"},"numero":{"type":"string","title":"Numero"},"categoria":{"type":"string","title":"Categoria","default":"sospetto"}},"type":"object","required":["email","numero"],"title":"ShieldPhoneReportRequest"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}}}