{"openapi":"3.1.0","info":{"title":"n9ve production","version":"0.1.0"},"paths":{"/":{"get":{"summary":"Read Root","operationId":"read_root__get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/evaluation":{"post":{"tags":["evaluation"],"summary":"Submit Evaluation","description":"Handles the submission of the 20-step Hair Loss Intake Quiz.\nPerforms hard eligibility checks:\n- Age < 18 -> Ineligible\n- Sex Assigned at Birth == Female -> Ineligible (Waitlist)","operationId":"submit_evaluation_evaluation_post","requestBody":{"content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Payload"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/evaluation/{evaluation_id}":{"get":{"tags":["evaluation"],"summary":"Get Evaluation","description":"Retrieve evaluation details (backoffice only).\n\nReturns the full quiz answers — date of birth, allergies, conditions,\ndoctor notes. It used to be open: an evaluation_id was enough to read a\npatient's medical history. The patient funnel never calls this (the quiz\nkeeps answers client-side and only POSTs), so the gate costs it nothing.","operationId":"get_evaluation_evaluation__evaluation_id__get","parameters":[{"name":"evaluation_id","in":"path","required":true,"schema":{"type":"string","title":"Evaluation Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/auth/request-magic-link":{"post":{"tags":["auth"],"summary":"Request Magic Link","operationId":"request_magic_link_api_auth_request_magic_link_post","requestBody":{"content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Payload"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/auth/verify-magic-link":{"get":{"tags":["auth"],"summary":"Verify Magic Link","operationId":"verify_magic_link_api_auth_verify_magic_link_get","parameters":[{"name":"token","in":"query","required":true,"schema":{"type":"string","title":"Token"}},{"name":"redirect","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Redirect"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/auth/recover-email":{"post":{"tags":["auth"],"summary":"Recover Email","description":"Recover or update a bounced email using a Magic Token sent via SMS.","operationId":"recover_email_api_auth_recover_email_post","requestBody":{"content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Payload"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/auth/request-otp":{"post":{"tags":["auth"],"summary":"Request Otp","description":"Request SMS OTP for phone-based login.","operationId":"request_otp_api_auth_request_otp_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestOtpPayload"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/auth/request-verification-otp":{"post":{"tags":["auth"],"summary":"Request Verification Otp Endpoint","description":"Request OTP for PHONE VERIFICATION (Quiz).","operationId":"request_verification_otp_endpoint_api_auth_request_verification_otp_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestOtpPayload"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/auth/verify-otp":{"post":{"tags":["auth"],"summary":"Verify Otp","description":"Verify SMS OTP and return user_id on success.","operationId":"verify_otp_api_auth_verify_otp_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VerifyOtpPayload"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/auth/trigger-verification-email":{"post":{"tags":["auth"],"summary":"Trigger Verification Email","description":"Send 6-digit OTP to user's email for verification (10 minutes TTL).","operationId":"trigger_verification_email_api_auth_trigger_verification_email_post","requestBody":{"content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Payload"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/auth/verify-email-otp":{"post":{"tags":["auth"],"summary":"Verify Email Otp","description":"Verify the 6-digit email OTP code and mark email as verified.","operationId":"verify_email_otp_api_auth_verify_email_otp_post","requestBody":{"content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Payload"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/auth/update-email/codice":{"post":{"tags":["auth"],"summary":"Update Email Code","description":"The SMS code that proves the account before its email changes: only to the phone on file,\nnever in the response (staging's debug flag included). The answer is {\"ok\": true} with a phone or\nwithout one, and never says which number. Refusals: 429 troppi_tentativi | troppi_codici |\ntroppi_codici_oggi | troppi_codici_ora.","operationId":"update_email_code_api_auth_update_email_codice_post","requestBody":{"content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Payload"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/auth/update-email":{"post":{"tags":["auth"],"summary":"Update Email Endpoint","description":"Update email address and reset verification status. Refusals: 401 codice_richiesto (no session:\nask /update-email/codice), codice_errato, codice_scaduto; 429 troppi_tentativi; 400\nemail_already_in_use, invalid_email_format. An account without a phone gets the same answers (it\nchanges its email with its session or through us).","operationId":"update_email_endpoint_api_auth_update_email_post","requestBody":{"content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Payload"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/auth/request-email-login-otp":{"post":{"tags":["auth"],"summary":"Request Email Login Otp","description":"Send 4-digit OTP to email for LOGIN (no user_id required). 10 min TTL.","operationId":"request_email_login_otp_api_auth_request_email_login_otp_post","requestBody":{"content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Payload"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/auth/verify-email-login-otp":{"post":{"tags":["auth"],"summary":"Verify Email Login Otp","description":"Verify 4-digit email OTP and return session same as verify-otp.","operationId":"verify_email_login_otp_api_auth_verify_email_login_otp_post","requestBody":{"content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Payload"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/auth/google":{"post":{"tags":["auth"],"summary":"Google Login","description":"Exchanges Google Access Token for User Session.","operationId":"google_login_api_auth_google_post","requestBody":{"content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Payload"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/auth/me":{"get":{"tags":["auth"],"summary":"Get Current User Minimal","operationId":"get_current_user_minimal_api_auth_me_get","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/auth/patient/me":{"get":{"tags":["auth"],"summary":"Get Patient Profile","description":"Fetch full patient profile for Dashboard (case state, Chatwoot HMAC, receipt).","operationId":"get_patient_profile_api_auth_patient_me_get","parameters":[{"name":"user_id","in":"query","required":true,"schema":{"type":"string","title":"User Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/auth/me/export":{"get":{"tags":["auth"],"summary":"Export My Data","operationId":"export_my_data_api_auth_me_export_get","parameters":[{"name":"user_id","in":"query","required":true,"schema":{"type":"string","title":"User Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/auth/link-nuovo":{"post":{"tags":["auth"],"summary":"Link Nuovo","operationId":"link_nuovo_api_auth_link_nuovo_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LinkNuovoPayload"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/public/articles":{"get":{"tags":["public"],"summary":"List Public Articles","operationId":"list_public_articles_api_public_articles_get","parameters":[{"name":"section","in":"query","required":false,"schema":{"enum":["capelli","pelle","denti","salute-sessuale","sudore-rasatura","prevenzione","sonno-alimentazione"],"type":"string","default":"capelli","title":"Section"}},{"name":"with_content","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"With Content"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/public/articles/{slug}":{"get":{"tags":["public"],"summary":"Get Public Article","operationId":"get_public_article_api_public_articles__slug__get","parameters":[{"name":"slug","in":"path","required":true,"schema":{"type":"string","title":"Slug"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/public/switches":{"get":{"tags":["public"],"summary":"Public Switches","operationId":"public_switches_api_public_switches_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/users/{user_id}/status":{"get":{"tags":["status"],"summary":"Get User Status","operationId":"get_user_status_users__user_id__status_get","parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"string","title":"User Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/charge/cases/{case_id}/approve":{"post":{"tags":["charge","charge"],"summary":"Approve Charge","description":"Ops: approve (or block) the capture on a medically-approved case.\n\n`approved_by` is the authenticated admin. The old `X-Support-Id` header was\nnever validated against anything, so it gated nothing: any string opened\nthe capture. It is gone; the header is now ignored if still sent.","operationId":"approve_charge_charge_cases__case_id__approve_post","parameters":[{"name":"case_id","in":"path","required":true,"schema":{"type":"string","title":"Case Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChargeApproveBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/fulfillment/start":{"post":{"summary":"Start Fulfillment","description":"Starts fulfillment only if: eligibility == Eligible AND capture_succeeded exists.\nIdempotent: returns current state if already Started/Completed.","operationId":"start_fulfillment_api_fulfillment_start_post","requestBody":{"content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Payload"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/fulfillment/{user_id}":{"get":{"summary":"Get Fulfillment Status","operationId":"get_fulfillment_status_api_fulfillment__user_id__get","parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"string","title":"User Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/pharmacy/queue":{"get":{"summary":"Get Pharmacy Queue","description":"Fetch cases in a specific state for the Pharmacy Kitchen View.","operationId":"get_pharmacy_queue_api_pharmacy_queue_get","parameters":[{"name":"status","in":"query","required":false,"schema":{"type":"string","default":"PharmacyReview","title":"Status"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/pharmacy/queue/count":{"get":{"summary":"Get Pharmacy Queue Count","description":"I numeri del pallino \"Portale Farmacia\": {\"count\", \"ready\", \"pickup_missed\"}.\n\ncount = le righe \"Da preparare\" della lista \"Da Evadere\"; ready = i \"Pronti per\nPoste\"; pickup_missed = quelli fra i pronti che sono in rosso, con la sua stessa\nbase (vedi pharmacy_badge_counts).\nNiente logger.info sul successo: e' chiesto ogni 15 secondi da ogni scheda\naperta, sarebbe solo rumore.","operationId":"get_pharmacy_queue_count_api_pharmacy_queue_count_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/pharmacy/cases/{case_id}":{"get":{"summary":"Get Pharmacy Case Detail","description":"Fetch single case details for Pharmacy Order View.","operationId":"get_pharmacy_case_detail_api_pharmacy_cases__case_id__get","parameters":[{"name":"case_id","in":"path","required":true,"schema":{"type":"string","title":"Case Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/pharmacy/cases/{case_id}/patient-orders":{"get":{"summary":"Get Case Patient Orders","description":"Fulfillment-only order history for the case's patient (pharmacy case-page section).\nCase-scoped (no user_id exposed). Shipping/invoicing fields only, NO clinical data —\nthe pharmacy never sees the doctor's case view. Read-only.","operationId":"get_case_patient_orders_api_pharmacy_cases__case_id__patient_orders_get","parameters":[{"name":"case_id","in":"path","required":true,"schema":{"type":"string","title":"Case Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/pharmacy/cases/{case_id}/prescription-pdf":{"get":{"summary":"Get Prescription Download Url","description":"Returns a short-lived presigned download URL for the prescription PDF, if present.","operationId":"get_prescription_download_url_api_pharmacy_cases__case_id__prescription_pdf_get","parameters":[{"name":"case_id","in":"path","required":true,"schema":{"type":"string","title":"Case Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/pharmacy/cases/{case_id}/prescriptions":{"get":{"summary":"List Case Prescriptions","description":"Tutte le ricette del caso: la prima e' l'attiva, le altre sono la storia.\n\nLa farmacia lavora sull'attiva (stesso documento del puntatore sul caso);\nle precedenti restano scaricabili perche' un galenico gia' preparato su una\nricetta poi sostituita deve poter mostrare su quale ricetta e' stato fatto.","operationId":"list_case_prescriptions_api_pharmacy_cases__case_id__prescriptions_get","parameters":[{"name":"case_id","in":"path","required":true,"schema":{"type":"string","title":"Case Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/pharmacy/cases/{case_id}/prescriptions/{prescription_id}/download":{"get":{"summary":"Download Case Prescription","operationId":"download_case_prescription_api_pharmacy_cases__case_id__prescriptions__prescription_id__download_get","parameters":[{"name":"case_id","in":"path","required":true,"schema":{"type":"string","title":"Case Id"}},{"name":"prescription_id","in":"path","required":true,"schema":{"type":"string","title":"Prescription Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/pharmacy/cases/{case_id}/verify":{"post":{"summary":"Verify Prescription","description":"PharmacyReview → Verified.","operationId":"verify_prescription_api_pharmacy_cases__case_id__verify_post","parameters":[{"name":"case_id","in":"path","required":true,"schema":{"type":"string","title":"Case Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/pharmacy/cases/{case_id}/reject":{"post":{"summary":"Reject Prescription","description":"PharmacyReview → QueuedForReview (send back to Doctor).","operationId":"reject_prescription_api_pharmacy_cases__case_id__reject_post","parameters":[{"name":"case_id","in":"path","required":true,"schema":{"type":"string","title":"Case Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/app__api__pharmacy__case_actions__RejectBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/pharmacy/cases/{case_id}/postpone":{"post":{"summary":"Postpone Order","description":"Postpone to next batch (max 1 per order). Admin is alerted externally.","operationId":"postpone_order_api_pharmacy_cases__case_id__postpone_post","parameters":[{"name":"case_id","in":"path","required":true,"schema":{"type":"string","title":"Case Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PostponeBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/pharmacy/cases/{case_id}/mark-shipped":{"post":{"summary":"Mark Shipped","description":"Security-gated: Verified/Paid/PharmacyReview → Shipped.\n\n`tracking_url` is the FULL URL provided by whichever courier (GLS, SDA, BRT, etc.)\nused by the pharmacy. If None, the email/SMS skips the tracking line gracefully.\nWired into FE in N9V-160 (currently FE button calls /ship → 404, shipping is manual).","operationId":"mark_shipped_api_pharmacy_cases__case_id__mark_shipped_post","parameters":[{"name":"case_id","in":"path","required":true,"schema":{"type":"string","title":"Case Id"}},{"name":"tracking_id","in":"query","required":false,"schema":{"type":"string","default":"TRACK123","title":"Tracking Id"}},{"name":"tracking_url","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tracking Url"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/pharmacy/cases/{case_id}/unship":{"post":{"summary":"Unship Case","description":"Admin: revert Shipped → PharmacyReview.","operationId":"unship_case_api_pharmacy_cases__case_id__unship_post","parameters":[{"name":"case_id","in":"path","required":true,"schema":{"type":"string","title":"Case Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/pharmacy/cases/{case_id}/return-to-support":{"post":{"summary":"Return To Support","description":"Pharmacy → Support (Ops) for missing info/payment issues.\n\nState is `PharmacyReturn`, NOT `NeedsMoreInfo`. Until 2026-09-04 this wrote\n`NeedsMoreInfo`, which across the system means \"the doctor asked the patient\nsomething and is waiting\": cron_nmi would have chased the patient with \"il\ntuo medico è in attesa di una tua risposta\" at D1/D3/D5 and closed his case\nat D7, and the /percorso page would have told him to answer in chat — for a\nproblem that is entirely ours to solve, with nothing to answer. Ops owns\nthis case; the patient is told nothing and asked nothing.\n\nBack to the pharmacy via POST /ops/cases/{case_id}/send-pharmacy, which has\nno state guard and works from here unchanged.","operationId":"return_to_support_api_pharmacy_cases__case_id__return_to_support_post","parameters":[{"name":"case_id","in":"path","required":true,"schema":{"type":"string","title":"Case Id"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Body"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/pharmacy/cases/{case_id}/address":{"patch":{"summary":"Set Shipping Address","description":"Manually set shipping address for the order linked to a case (for test/admin orders missing address).","operationId":"set_shipping_address_api_pharmacy_cases__case_id__address_patch","parameters":[{"name":"case_id","in":"path","required":true,"schema":{"type":"string","title":"Case Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/app__api__pharmacy__case_actions__ShippingAddressBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/pharmacy/cases/{case_id}/unprepare":{"post":{"summary":"Unprepare Order","description":"Admin only, \"Rimetti da preparare\": the order leaves \"Pronti per Poste\" and the pharmacy sees it to\nprepare again (a box that never left the pharmacy, a label printed by mistake). Never offered to the\npharmacy: moving a prepared order back up is how a second box gets made. Idempotent: an order already\nto prepare answers ok with no second audit row.","operationId":"unprepare_order_api_pharmacy_cases__case_id__unprepare_post","parameters":[{"name":"case_id","in":"path","required":true,"schema":{"type":"string","title":"Case Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnprepareBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/pharmacy/batches/ready":{"post":{"summary":"Get Ready Batch","description":"Mark a batch of cases as Ready for Courier → case_state = Shipped.","operationId":"get_ready_batch_api_pharmacy_batches_ready_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BatchRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/pharmacy/batches/labels":{"post":{"summary":"Print Batch Labels","description":"Generate Sendcloud Parcels and retrieve a PDF label URL.","operationId":"print_batch_labels_api_pharmacy_batches_labels_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BatchRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/pharmacy/batches/coversheet":{"post":{"summary":"Print Batch Coversheet","description":"Generate a PDF cover sheet for a batch:\n- Section A: orders with NRE/CF → printed as CODE128 barcodes (farmacist scans with reader)\n- Section B: OTC orders → plain list, no barcode needed","operationId":"print_batch_coversheet_api_pharmacy_batches_coversheet_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CoversheetRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/pharmacy/cases/{case_id}/labels/galenico":{"get":{"summary":"Get Galenico Label","description":"Generate a DL219/2006-compliant pharmaceutical label PDF for a case.","operationId":"get_galenico_label_api_pharmacy_cases__case_id__labels_galenico_get","parameters":[{"name":"case_id","in":"path","required":true,"schema":{"type":"string","title":"Case Id"}},{"name":"type","in":"query","required":false,"schema":{"type":"string","default":"spray","title":"Type"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/pharmacy/shipping/config":{"get":{"summary":"Shipping Config","description":"FE reads this to choose the dashboard mode.\n\nauto_pickup_enabled=False (default) → MANUAL: single flat list, row-by-row ship\nwith live cost. =True → the batch/automatic planning UI. Mirrors the backend flag\nSENDCLOUD_AUTO_PICKUP_ENABLED used by cron_logistics.py — one source of truth.","operationId":"shipping_config_api_pharmacy_shipping_config_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/pharmacy/shipping/to-ship":{"get":{"summary":"List To Ship","description":"Flat list of orders ready to ship: case Verified + order paid, not yet announced.","operationId":"list_to_ship_api_pharmacy_shipping_to_ship_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/pharmacy/cases/{case_id}/delivery-note":{"patch":{"summary":"Update Delivery Note","description":"Edit the patient delivery note on the shippable order (it becomes the label's\naddress_2). Lets staff shorten an over-long note so the full instruction fits\nSendcloud's 35-char label limit. Persisted on the order's shipping_address JSON;\nship-confirm re-reads it, so the saved value is what goes on the label.","operationId":"update_delivery_note_api_pharmacy_cases__case_id__delivery_note_patch","parameters":[{"name":"case_id","in":"path","required":true,"schema":{"type":"string","title":"Case Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeliveryNoteBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/pharmacy/cases/{case_id}/shipping-address":{"patch":{"summary":"Update Shipping Address","description":"Correct the shipping address of the order the pharmacy is about to ship.\n\nTwo callers, same endpoint: the one-click on a validator suggestion, and the\npencil in the ship modal when the pharmacy types the fix itself.\n\nMERGES into the existing JSON — first name, last name, province and the delivery\nnote must survive an address correction. (The older\nPATCH /pharmacy/cases/{id}/address REPLACES the whole object and would wipe them;\nit stays for orders that have no address at all.)","operationId":"update_shipping_address_api_pharmacy_cases__case_id__shipping_address_patch","parameters":[{"name":"case_id","in":"path","required":true,"schema":{"type":"string","title":"Case Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ShippingAddressPatch"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/pharmacy/cases/{case_id}/ship-quote":{"post":{"summary":"Ship Quote","description":"REVIEW step: returns recipient address + notes, the live Sendcloud cost, and an\nestimated delivery window. No side effects — read-only, nothing is created.","operationId":"ship_quote_api_pharmacy_cases__case_id__ship_quote_post","parameters":[{"name":"case_id","in":"path","required":true,"schema":{"type":"string","title":"Case Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/pharmacy/cases/{case_id}/ship-confirm":{"post":{"summary":"Ship Confirm","description":"CONFIRM step: create the Sendcloud parcel (recipient = patient, sender = N9VE\nfrom the panel, pickup = pharmacy 'Ritiro' address), book the courier pickup for\nthe chosen day, and set the order to 'ready_for_courier' (Prenotato).\n\nDoes NOT mark the case Shipped and sends NO patient message — that happens on real\ncarrier movement via the webhook.","operationId":"ship_confirm_api_pharmacy_cases__case_id__ship_confirm_post","parameters":[{"name":"case_id","in":"path","required":true,"schema":{"type":"string","title":"Case Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ShipConfirmBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/pharmacy/incassi":{"get":{"summary":"Get Pharmacy Incassi","description":"I bonifici arrivati e quelli in arrivo, ognuno con le quote degli ordini.","operationId":"get_pharmacy_incassi_api_pharmacy_incassi_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/pharmacy/incassi/ricevuta/{ref}":{"get":{"summary":"Get Pharmacy Receipt","description":"Il link alla ricevuta Stripe di una quota, da aprire in un'altra scheda.","operationId":"get_pharmacy_receipt_api_pharmacy_incassi_ricevuta__ref__get","parameters":[{"name":"ref","in":"path","required":true,"schema":{"type":"string","title":"Ref"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/chat/config":{"get":{"tags":["chat","chat"],"summary":"Get Chat Config","description":"Validates the magic link token and returns configuration for the Chatwoot Widget.","operationId":"get_chat_config_api_chat_config_get","parameters":[{"name":"token","in":"query","required":true,"schema":{"type":"string","description":"Magic Link Token","title":"Token"},"description":"Magic Link Token"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/chat/thread":{"get":{"tags":["chat","chat"],"summary":"Get Unified Thread","description":"Returns a unified timeline of Chatwoot messages and System Events (Notifications).","operationId":"get_unified_thread_api_chat_thread_get","parameters":[{"name":"token","in":"query","required":false,"schema":{"type":"string","title":"Token"}},{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/chat/message":{"post":{"tags":["chat","chat"],"summary":"Send Unified Message","description":"Patient → native chat. Accepts text and/or one or more attachments.","operationId":"send_unified_message_api_chat_message_post","parameters":[{"name":"token","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Token"}},{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"content","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Message Body","title":"Content"},"description":"Message Body"}],"requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_send_unified_message_api_chat_message_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/chat/webhook":{"post":{"tags":["chat","chat"],"summary":"Chatwoot Webhook","operationId":"chatwoot_webhook_api_chat_webhook_post","requestBody":{"content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Payload"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/chat/conversations":{"get":{"tags":["admin_chat"],"summary":"List Conversations","description":"Lists cases enriched with last message snippet, unread count and awaiting-reply flag.\n\nDefault: only cases that already have chat messages (back-compat for the doctor /\nsupport inboxes). With scope='active' (\"Tutte le Chat\"): every active-client case —\nawaiting medical review (pre-terminal case_state) OR active subscription — plus any\ncase that has messages, so the master ops view shows all active patients and no\nthread is ever hidden. The two `where_extra` / `order_clause` fragments below are\nfixed literals chosen by a controlled branch (no user input is interpolated).","operationId":"list_conversations_api_admin_chat_conversations_get","parameters":[{"name":"status","in":"query","required":false,"schema":{"type":"string","description":"Chatwoot conversation status","default":"open","title":"Status"},"description":"Chatwoot conversation status"},{"name":"inbox_id","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"Filter by Chatwoot Inbox ID","title":"Inbox Id"},"description":"Filter by Chatwoot Inbox ID"},{"name":"queue","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by queue: doctor, support","title":"Queue"},"description":"Filter by queue: doctor, support"},{"name":"scope","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"'active' = every active-client case (awaiting review + active subscription), not just those with messages","title":"Scope"},"description":"'active' = every active-client case (awaiting review + active subscription), not just those with messages"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/chat/conversations/medical-messages":{"get":{"tags":["admin_chat"],"summary":"List Medical Messages","description":"Returns open conversations labeled 'clinico' — used by the doctor dashboard\nMessages tab to surface chat handoffs without a separate inbox.\nEnriches each conversation with the linked case_id and a message snippet.","operationId":"list_medical_messages_api_admin_chat_conversations_medical_messages_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/chat/conversations/support-messages":{"get":{"tags":["admin_chat"],"summary":"Get Support Messages","description":"Returns cases with pending SUPPORT or MUTATION handoffs or unread patient messages.\nFeeds the Messaggi tab in the ops/support dashboard.","operationId":"get_support_messages_api_admin_chat_conversations_support_messages_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/chat/unread-count":{"get":{"tags":["admin_chat"],"summary":"Get Unread Count","description":"Returns total unread user messages across all cases.","operationId":"get_unread_count_api_admin_chat_unread_count_get","parameters":[{"name":"inbox_id","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"Filter by Chatwoot Inbox ID","title":"Inbox Id"},"description":"Filter by Chatwoot Inbox ID"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/chat/conversations/{conversation_id}/messages":{"get":{"tags":["admin_chat"],"summary":"Get Conversation Messages","description":"Fetches all messages for a given case (conversation_id = case_id in native mode).\nAlso marks user messages as read.","operationId":"get_conversation_messages_api_admin_chat_conversations__conversation_id__messages_get","parameters":[{"name":"conversation_id","in":"path","required":true,"schema":{"type":"string","title":"Conversation Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["admin_chat"],"summary":"Send Conversation Message","description":"Sends a message (or private note) to a case conversation.\nconversation_id = case_id in native mode.","operationId":"send_conversation_message_api_admin_chat_conversations__conversation_id__messages_post","parameters":[{"name":"conversation_id","in":"path","required":true,"schema":{"type":"string","title":"Conversation Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatMessageBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/chat/conversations/{conversation_id}/native-attachment":{"post":{"tags":["admin_chat"],"summary":"Send Native Attachment","description":"Staff → native chat con uno o più allegati. Mirror del flusso paziente\nin app/api/chat.py: upload su S3 sotto chat_media/{case_id}/, poi\nsave_message con sender_type='staff' e tutti gli allegati nel singolo\nmessaggio. SMS notify gira come per il messaggio testuale (skippato\nse private=True). conversation_id = case_id (UUID). Mantenuto separato\ndall'endpoint Chatwoot legacy /messages/attachments che usa conversation_id int.","operationId":"send_native_attachment_api_admin_chat_conversations__conversation_id__native_attachment_post","parameters":[{"name":"conversation_id","in":"path","required":true,"schema":{"type":"string","title":"Conversation Id"}}],"requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_send_native_attachment_api_admin_chat_conversations__conversation_id__native_attachment_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/chat/conversations/{conversation_id}/assign":{"post":{"tags":["admin_chat"],"summary":"Assign Conversation To Self","description":"Assigns the Chatwoot conversation to the current N9VE admin/doctor by matching their N9VE email.","operationId":"assign_conversation_to_self_api_admin_chat_conversations__conversation_id__assign_post","parameters":[{"name":"conversation_id","in":"path","required":true,"schema":{"type":"integer","title":"Conversation Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/chat/conversations/{conversation_id}/messages/attachments":{"post":{"tags":["admin_chat"],"summary":"Send Conversation Attachment","description":"Uploads a file and sends it as a message or a private note to the Chatwoot conversation.","operationId":"send_conversation_attachment_api_admin_chat_conversations__conversation_id__messages_attachments_post","parameters":[{"name":"conversation_id","in":"path","required":true,"schema":{"type":"integer","title":"Conversation Id"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_send_conversation_attachment_api_admin_chat_conversations__conversation_id__messages_attachments_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/chat/conversations/{conversation_id}/request-info":{"post":{"tags":["admin_chat"],"summary":"Request Conversation Info","description":"Manually triggers a Missing Info Action Card (System Notification) into the chat.","operationId":"request_conversation_info_api_admin_chat_conversations__conversation_id__request_info_post","parameters":[{"name":"conversation_id","in":"path","required":true,"schema":{"type":"integer","title":"Conversation Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestInfoBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/chat/conversations/{conversation_id}/reassign":{"post":{"tags":["admin_chat"],"summary":"Reassign Conversation","description":"Re-routes a conversation to the medical or support team.\nUseful when the AI makes a wrong triage decision, or a team member\nneeds to hand off to another role.\nUpdates the Chatwoot label and reassigns to the team's default agent.","operationId":"reassign_conversation_api_admin_chat_conversations__conversation_id__reassign_post","parameters":[{"name":"conversation_id","in":"path","required":true,"schema":{"type":"integer","title":"Conversation Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReassignBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/flows/":{"get":{"tags":["quiz_admin"],"summary":"List Flows","operationId":"list_flows_api_admin_flows__get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Response List Flows Api Admin Flows  Get"}}}}}},"post":{"tags":["quiz_admin"],"summary":"Create Flow","operationId":"create_flow_api_admin_flows__post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FlowCreate"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/flows/{flow_id}":{"get":{"tags":["quiz_admin"],"summary":"Get Flow Details","operationId":"get_flow_details_api_admin_flows__flow_id__get","parameters":[{"name":"flow_id","in":"path","required":true,"schema":{"type":"string","title":"Flow Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["quiz_admin"],"summary":"Delete Flow","operationId":"delete_flow_api_admin_flows__flow_id__delete","parameters":[{"name":"flow_id","in":"path","required":true,"schema":{"type":"string","title":"Flow Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["quiz_admin"],"summary":"Update Flow","operationId":"update_flow_api_admin_flows__flow_id__put","parameters":[{"name":"flow_id","in":"path","required":true,"schema":{"type":"string","title":"Flow Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FlowUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/flows/{flow_id}/publish":{"post":{"tags":["quiz_admin"],"summary":"Publish Flow","operationId":"publish_flow_api_admin_flows__flow_id__publish_post","parameters":[{"name":"flow_id","in":"path","required":true,"schema":{"type":"string","title":"Flow Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/flows/{flow_id}/unpublish":{"post":{"tags":["quiz_admin"],"summary":"Unpublish Flow","operationId":"unpublish_flow_api_admin_flows__flow_id__unpublish_post","parameters":[{"name":"flow_id","in":"path","required":true,"schema":{"type":"string","title":"Flow Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/quiz/current":{"get":{"tags":["quiz_engine"],"summary":"Get Current Flow","operationId":"get_current_flow_api_quiz_current_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/QuizFlowResponse"}}}}}}},"/api/quiz/progress":{"post":{"tags":["quiz_engine"],"summary":"Submit Progress","description":"Saves the answers of today's quiz. A new questionnaire always gets an id of ours (an id the server does\nnot know never becomes a row); an existing one takes answers only from its owner (_owner_proven, else 403),\nnever when it is a quiz 4 evaluation (409), and after a paid order only the photos' entry.","operationId":"submit_progress_api_quiz_progress_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProgressRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/quiz/session":{"get":{"tags":["quiz_engine"],"summary":"Get Session","operationId":"get_session_api_quiz_session_get","parameters":[{"name":"flow_id","in":"query","required":true,"schema":{"type":"string","title":"Flow Id"}},{"name":"user_id","in":"query","required":true,"schema":{"type":"string","title":"User Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/SessionResponse"},{"type":"null"}],"title":"Response Get Session Api Quiz Session Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/catalog/integrators":{"get":{"tags":["catalog"],"summary":"List Integrators","description":"List active integrators (supplements)","operationId":"list_integrators_api_catalog_integrators_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}},"post":{"tags":["catalog"],"summary":"Create Integrator","operationId":"create_integrator_api_catalog_integrators_post","requestBody":{"content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Payload"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/catalog/combinations":{"get":{"tags":["catalog"],"summary":"List Combinations","description":"List valid treatment combinations — excludes service-type items (e.g. consultation_only).\n\n`is_active = FALSE` = prodotto completo ma non ancora in vendita: esiste in\ncatalogo col suo contenuto, ma il paziente non lo deve vedere.\n\n`include_inactive` esiste perche' questo endpoint lo legge ANCHE la pagina admin\ndei prodotti, non solo il checkout: filtrando senza via d'uscita, un prodotto\nspento sparirebbe dalla schermata da cui lo si riaccende. Vale solo con la sessione\ndi un admin: un prodotto non ancora in vendita non si legge da fuori.","operationId":"list_combinations_api_catalog_combinations_get","parameters":[{"name":"include_inactive","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Include Inactive"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["catalog"],"summary":"Create Combination","operationId":"create_combination_api_catalog_combinations_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Payload"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/catalog/consultation-price":{"get":{"tags":["catalog"],"summary":"Get Consultation Price","description":"Public endpoint to fetch the current consultation (medical visit) price in cents,\nplus the requires_photo flag that controls the photo-upload step in the patient quiz.","operationId":"get_consultation_price_api_catalog_consultation_price_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/catalog/allergies":{"get":{"tags":["catalog"],"summary":"List Allergies","operationId":"list_allergies_api_catalog_allergies_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/catalog/medications":{"get":{"tags":["catalog"],"summary":"List Medications","operationId":"list_medications_api_catalog_medications_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/catalog/conditions":{"get":{"tags":["catalog"],"summary":"List Conditions","operationId":"list_conditions_api_catalog_conditions_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/catalog/combinations/{combo_id}/duplicate":{"post":{"tags":["catalog"],"summary":"Duplicate Combination","description":"Copia un prodotto per poterne modificare confezione o prezzo.\n\nE' la via d'uscita promessa dal 409 su un prodotto gia' venduto. Senza, l'admin\ndovrebbe ricopiare a mano una ventina di campi di un galenico (eccipienti,\nposologia, quote), ed e' esattamente li' che nascono gli errori.\n\nLa copia nasce SPENTA e col nome marcato: va rivista e riaccesa apposta, non si\nritrova in vendita per sbaglio. Sottoscrizioni e ordini non la seguono, restano\nattaccati all'originale, che e' il punto di tutta l'operazione.","operationId":"duplicate_combination_api_catalog_combinations__combo_id__duplicate_post","parameters":[{"name":"combo_id","in":"path","required":true,"schema":{"type":"string","title":"Combo Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/catalog/integrators/{integrator_id}":{"put":{"tags":["catalog"],"summary":"Update Integrator","operationId":"update_integrator_api_catalog_integrators__integrator_id__put","parameters":[{"name":"integrator_id","in":"path","required":true,"schema":{"type":"string","title":"Integrator Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Payload"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["catalog"],"summary":"Delete Integrator","operationId":"delete_integrator_api_catalog_integrators__integrator_id__delete","parameters":[{"name":"integrator_id","in":"path","required":true,"schema":{"type":"string","title":"Integrator Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/catalog/combinations/{combo_id}":{"put":{"tags":["catalog"],"summary":"Update Combination","operationId":"update_combination_api_catalog_combinations__combo_id__put","parameters":[{"name":"combo_id","in":"path","required":true,"schema":{"type":"string","title":"Combo Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Payload"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["catalog"],"summary":"Delete Combination","operationId":"delete_combination_api_catalog_combinations__combo_id__delete","parameters":[{"name":"combo_id","in":"path","required":true,"schema":{"type":"string","title":"Combo Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/catalog/side-effects":{"get":{"tags":["catalog"],"summary":"List Global Side Effects","description":"List all global side effects","operationId":"list_global_side_effects_api_catalog_side_effects_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}},"post":{"tags":["catalog"],"summary":"Create Global Side Effect","operationId":"create_global_side_effect_api_catalog_side_effects_post","requestBody":{"content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Payload"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/catalog/side-effects/{effect_id}":{"put":{"tags":["catalog"],"summary":"Update Global Side Effect","operationId":"update_global_side_effect_api_catalog_side_effects__effect_id__put","parameters":[{"name":"effect_id","in":"path","required":true,"schema":{"type":"string","title":"Effect Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Payload"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["catalog"],"summary":"Delete Global Side Effect","operationId":"delete_global_side_effect_api_catalog_side_effects__effect_id__delete","parameters":[{"name":"effect_id","in":"path","required":true,"schema":{"type":"string","title":"Effect Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/faqs":{"get":{"tags":["faqs"],"summary":"List Public Faqs","description":"Public read.\n- ?surface=visita → the pinned, active FAQs for that page, in pin order, capped\n  at the surface's max_pins; ads-restricted surfaces only ever get ads_safe FAQs.\n  Falls back to the top active FAQs by sort_order if the page has no pins.\n- no surface → all active FAQs ordered by sort_order (the /domande full list).","operationId":"list_public_faqs_api_faqs_get","parameters":[{"name":"surface","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Surface"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/faqs/surfaces":{"get":{"tags":["faqs"],"summary":"List Surfaces","description":"Surface catalogue for the admin pinning UI.","operationId":"list_surfaces_api_faqs_surfaces_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/faqs/admin":{"get":{"tags":["faqs"],"summary":"List All Faqs","description":"All FAQs (active + inactive) for the admin table, with where-they're-pinned.","operationId":"list_all_faqs_api_faqs_admin_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}},"post":{"tags":["faqs"],"summary":"Create Faq","operationId":"create_faq_api_faqs_admin_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FaqIn"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/faqs/admin/{faq_id}":{"put":{"tags":["faqs"],"summary":"Update Faq","operationId":"update_faq_api_faqs_admin__faq_id__put","parameters":[{"name":"faq_id","in":"path","required":true,"schema":{"type":"integer","title":"Faq Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FaqIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["faqs"],"summary":"Delete Faq","operationId":"delete_faq_api_faqs_admin__faq_id__delete","parameters":[{"name":"faq_id","in":"path","required":true,"schema":{"type":"integer","title":"Faq Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/faqs/admin/pins/{surface}":{"get":{"tags":["faqs"],"summary":"Get Pins","description":"Ordered pinned FAQ ids for a surface (for the admin pinning editor).","operationId":"get_pins_api_faqs_admin_pins__surface__get","parameters":[{"name":"surface","in":"path","required":true,"schema":{"type":"string","title":"Surface"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["faqs"],"summary":"Set Pins","description":"Replace the whole ordered pin list for a surface, atomically.","operationId":"set_pins_api_faqs_admin_pins__surface__put","parameters":[{"name":"surface","in":"path","required":true,"schema":{"type":"string","title":"Surface"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PinsIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/faqs/admin/seed":{"post":{"tags":["faqs"],"summary":"Seed Endpoint","description":"One-time seed from the committed content (28 current FAQs + 3 trust-FAQs + pins).\nNo-op if FAQs already exist — safe to call once per environment after deploy.","operationId":"seed_endpoint_api_faqs_admin_seed_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/orders":{"post":{"tags":["orders"],"summary":"Create Order","description":"Creates an Order based on:\n- User ID (from auth or session)\n- Evaluation ID (medical context)\n- Selected Product Combination (e.g., COMBO_FULL)\n- Selected Integrators (optional)\n\nCalculates total price on server side.","operationId":"create_order_api_orders_post","requestBody":{"content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Payload"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/orders/{order_id}":{"get":{"tags":["orders"],"summary":"Get Order","description":"The order's progress for /order/[orderId] (it reads `status`). The order id alone opens it,\nso nothing personal goes out: no address, no card or PayPal details, no user or Stripe ids\n(it returned the whole row until 24/10/2026, B5).","operationId":"get_order_api_orders__order_id__get","parameters":[{"name":"order_id","in":"path","required":true,"schema":{"type":"string","title":"Order Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/waitlist/":{"post":{"tags":["waitlist"],"summary":"Add To Waitlist","operationId":"add_to_waitlist_api_waitlist__post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WaitlistRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/checkout/promo/validate":{"post":{"tags":["checkout"],"summary":"Validate Promo","description":"Preview a discount code for the checkout screen (\"Hai un codice?\").\n\nAnswers what the patient would pay: list amount, discount, final amount.\nEvery refusal that is not the patient's own doing gets the SAME generic\nmessage (a code must not reveal that it exists). Never 500s on a bad code.","operationId":"validate_promo_api_checkout_promo_validate_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PromoValidateRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/checkout/init":{"post":{"tags":["checkout"],"summary":"Init Checkout","description":"Orchestrates the creation of Checkout via CheckoutService.\n\nThe account is the one patient_uid resolves (B5): in enforce the session's (401 without one,\n403 for another id); in off and log the user_id the quiz sends, as before. In every mode the\ncheckout writes no login key (phone, email) and rewrites no date of birth or codice fiscale\nunless the request carries that account's session, and another patient's paid evaluation is\nnever taken (UserRepository.upsert_checkout_user, EvaluationRepository.paid_by_another_patient).","operationId":"init_checkout_api_checkout_init_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckoutInitRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/checkout/init-from-recovery":{"post":{"tags":["checkout"],"summary":"Init From Recovery","description":"N9V-383: init checkout dal recovery short-link token.\n\nDifferente da /init perche':\n- User e' gia' noto (dal token, no upsert needed)\n- Product_id viene dal token payload, non dal body request\n- Shipping address e' lasciato VUOTO — sara' raccolto post-payment\n  (Iteration 2 / N9V-392). Authorize non lo richiede.\n- Riusa al 100% CheckoutService.process_checkout costruendo internamente\n  un CheckoutInitRequest a partire dai dati DB dell'utente + token.\n\nReturns: {status, order_id, user_id, client_secret, amount_cents}","operationId":"init_from_recovery_api_checkout_init_from_recovery_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RecoveryInitRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/checkout/recovery-info":{"get":{"tags":["checkout"],"summary":"Recovery Info","description":"N9V-383: fetch recovery token info for FE step 1 (cadence picker).\n\nReturns product_id + evaluation_id + user info preview without creating\nan order. Order creation happens on /init-from-recovery after cadence pick.\n\nIdempotent (resolve_short_link uses COALESCE on first_used_at).\n\nThe page sends the token in the X-Link-Token header, out of the access log (25/10/2026);\n?token= still answers, only for a page older than this backend: remove it with the page's\nfallback (frontend/src/components/recovery/recoveryInfo.ts) by 2026-11-08.","operationId":"recovery_info_api_checkout_recovery_info_get","parameters":[{"name":"token","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Token"}},{"name":"X-Link-Token","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Link-Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/checkout/recover":{"post":{"tags":["checkout"],"summary":"Recover Order","description":"Recovers the latest pending order for a user to allow payment completion.","operationId":"recover_order_api_checkout_recover_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RecoverOrderRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/checkout/confirm":{"post":{"tags":["checkout"],"summary":"Confirm Checkout","description":"Manually triggers 'payment success' logic.\nUseful for localhost where webhooks might be blocked/delayed,\nand ensures immediate feedback for the user (Doctor Dashboard visibility).","operationId":"confirm_checkout_api_checkout_confirm_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConfirmCheckoutRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/checkout/paypal-setup":{"post":{"tags":["checkout"],"summary":"Paypal Setup","description":"PayPal billing-agreement: creates a SetupIntent (no hold) for an existing order.\nCalled by the FE when the patient picks PayPal at checkout. The capture happens\noff_session after the doctor approves.","operationId":"paypal_setup_api_checkout_paypal_setup_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaypalSetupRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/checkout/update-shipping":{"post":{"tags":["checkout"],"summary":"Update Shipping","description":"Aggiorna shipping_address sull'ordine quando il paziente lo modifica\ninline al checkout. Senza questo, l'edit FE restava in coreAnswers e\nSendcloud avrebbe spedito al vecchio indirizzo. Lock-out post-shipped:\nse l'ordine è già stato spedito non si può più toccare l'indirizzo.","operationId":"update_shipping_api_checkout_update_shipping_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateShippingRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/products/treatments":{"get":{"summary":"Get Treatments","description":"Fetch treatments based on preference (oral, topical, all).\nExcludes category='service' items (e.g. consultation_only) — those are billing artifacts.\ntype: 'oral', 'topical', 'all'\n\nis_active = FALSE → prodotto completo ma non in vendita: il paziente non lo deve\nvedere ne' nel quiz ne' al checkout.\n\ninclude_inactive esiste per il PANNELLO DI PRESCRIZIONE DEL MEDICO, che legge\nquesto stesso endpoint (useClinicalDecision.ts). Filtrando senza via d'uscita, un\nprodotto spento sparirebbe dalla lista da cui il medico prescrive — cioe'\nesattamente il contrario dello scopo: il galenico combinato esiste PERCHE' il\nmedico possa prescriverlo prima che sia in vendita. Default sicuro: solo attivi.","operationId":"get_treatments_api_products_treatments_get","parameters":[{"name":"type","in":"query","required":false,"schema":{"type":"string","default":"all","title":"Type"}},{"name":"include_inactive","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Include Inactive"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Product"},"title":"Response Get Treatments Api Products Treatments Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/products/addons":{"get":{"summary":"Get Addons","description":"Fetch active add-ons (integrators).","operationId":"get_addons_api_products_addons_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/Addon"},"type":"array","title":"Response Get Addons Api Products Addons Get"}}}}}}},"/api/marketing/unsubscribe":{"post":{"tags":["marketing","marketing"],"summary":"Unsubscribe One Click","description":"RFC 8058 one-click unsubscribe (List-Unsubscribe-Post header).\n\nGmail/Outlook will send POST here with the token from the header.\nIdempotent: re-clicks return 200 ok.","operationId":"unsubscribe_one_click_api_marketing_unsubscribe_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnsubscribeBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["marketing","marketing"],"summary":"Unsubscribe Landing","description":"Browser landing — for users who clicked an unsubscribe link in email body.\n\nGET version still effects the unsubscribe (some clients only do GET).\nSame idempotent behavior as POST.\n\nOne click on \"Disiscriviti\" in the email: done, then the browser lands on the confirmation page\n(frontend /disiscrizione) instead of this JSON. A tampered or expired link writes nothing and lands on\n/disiscrizione/non-valido (Frederic's text, 02/11/2026). POST keeps the JSON (RFC 8058).","operationId":"unsubscribe_landing_api_marketing_unsubscribe_get","parameters":[{"name":"token","in":"query","required":true,"schema":{"type":"string","title":"Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/marketing/stop":{"post":{"tags":["marketing","marketing"],"summary":"Web Stop Confirm","description":"Web-based SMS opt-out (preferred over Twilio STOP keyword).\n\nToken is the same format as unsubscribe_token (HMAC-SHA256, channel='sms').\nIdempotent: re-clicks return 200 ok.","operationId":"web_stop_confirm_api_marketing_stop_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StopBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["marketing","marketing"],"summary":"Web Stop Landing","description":"Browser landing for SMS web-stop link.\n\nThe link in SMS body is `n9ve.io/no/{token}` (short link), which redirects\nor directly hits this endpoint. FE page `/stop` will call POST after user\nconfirms; this GET form is a fallback for clients that auto-follow.","operationId":"web_stop_landing_api_marketing_stop_get","parameters":[{"name":"token","in":"query","required":true,"schema":{"type":"string","title":"Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/marketing/recovery/resolve":{"get":{"tags":["marketing","marketing"],"summary":"Recovery Resolve","description":"Resolve short recovery token + apply side effects + return redirect.\n\nFE FIRST (Next.js page /r/[token]) calls this endpoint server-side then\nredirects with cookie set. Per ora endpoint backend è la single source\nof truth — FE landing routes solo come riferimento.\n\nThe token comes in the X-Link-Token header (the FE route sends it there): a query string is\nprinted whole by the access log, and the token opens a session for days (25/10/2026).\n?token= still answers as before.\n\nReturns:\n    {ok: true, scope, redirect_url, user_id, evaluation_id, product_id, campaign_id}\n    or HTTPException on bad/expired token.","operationId":"recovery_resolve_api_marketing_recovery_resolve_get","parameters":[{"name":"token","in":"query","required":false,"schema":{"anyOf":[{"type":"string","minLength":4,"maxLength":32},{"type":"null"}],"title":"Token"}},{"name":"X-Client-User-Agent","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Client-User-Agent"}},{"name":"user-agent","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User-Agent"}},{"name":"X-Link-Token","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Link-Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/marketing/lpv":{"post":{"tags":["marketing","marketing"],"summary":"Landing Page View","description":"Record a Meta-origin /inizia landing as a server-side CAPI PageView.\n\n- Returns 204 immediately (the actual CAPI call runs in background).\n- Validates fbclid format defensively.\n- Reads IP from X-Forwarded-For and UA from request headers.\n- Computes event_id deterministically so the browser Pixel can dedupe.\n- No PII handled. fbclid is data Meta itself attached to the click.\n\nBody is intentionally empty — fbclid via query keeps the request compatible\nwith `navigator.sendBeacon()` (which can only send POST with text/plain body).","operationId":"landing_page_view_api_marketing_lpv_post","parameters":[{"name":"fbclid","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":512,"title":"Fbclid"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/partner/onboarding/{token}":{"get":{"tags":["partner","partner","referral"],"summary":"Get Onboarding","description":"Public: partner self-onboarding prefill for a one-time link.","operationId":"get_onboarding_api_partner_onboarding__token__get","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["partner","partner","referral"],"summary":"Submit Onboarding","description":"Public: the partner completes + accepts the T&C. Requires BOTH the general\nacceptance and the specific-clauses approval (Italian 1341-1342 enforceability)\nplus the accepting person's name. Records the client IP + user-agent as proof\nof stipulation (T&C Art.15).","operationId":"submit_onboarding_api_partner_onboarding__token__post","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OnboardingSubmit"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/partner/onboarding/{token}/logo":{"post":{"tags":["partner","partner","referral"],"summary":"Upload Onboarding Logo","description":"Public, token-gated: the partner uploads its own logo during onboarding.\nOnly a still-pending onboarding token is accepted (prevents random uploads).\nReturns the R2 URL; the caller then submits it as logo_url (optional — if the\npartner uploads nothing, the PM's logo, if any, is kept).","operationId":"upload_onboarding_logo_api_partner_onboarding__token__logo_post","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_upload_onboarding_logo_api_partner_onboarding__token__logo_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/partner/voucher/{code}":{"get":{"tags":["partner","partner","referral"],"summary":"Get Voucher","description":"Public co-branded voucher view for /sconto/<code>.","operationId":"get_voucher_api_partner_voucher__code__get","parameters":[{"name":"code","in":"path","required":true,"schema":{"type":"string","title":"Code"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/partner/ref/{code}":{"get":{"tags":["partner","partner","referral"],"summary":"Get Ref","description":"Public partner branding for the ref-aware banner on /visita.","operationId":"get_ref_api_partner_ref__code__get","parameters":[{"name":"code","in":"path","required":true,"schema":{"type":"string","title":"Code"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/partner/scan/{code}":{"post":{"tags":["partner","partner","referral"],"summary":"Count Scan","description":"Best-effort scan counter, hit by the /p/<code> QR redirect. Never fails\nthe caller — the redirect must happen even if this write does.\n\n`country` e `device` arrivano dalla rotta Next.js, non da qui: la chiamata a\nquesto endpoint la fa Vercel server-to-server, quindi l'indirizzo e lo user\nagent che vediamo noi sono i SUOI, non quelli di chi ha scansionato. Solo la\nrotta ha in mano la richiesta vera.\n\nServono a separare le prove interne dal traffico vero. Restano grezzi di\nproposito — «IT + phone» contro «US + desktop» — perche' e' tutto cio' che\nserve a decidere, e non identifica nessuno.","operationId":"count_scan_api_partner_scan__code__post","parameters":[{"name":"code","in":"path","required":true,"schema":{"type":"string","title":"Code"}},{"name":"country","in":"query","required":false,"schema":{"type":"string","title":"Country"}},{"name":"device","in":"query","required":false,"schema":{"type":"string","title":"Device"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/partner/redeem":{"post":{"tags":["partner","partner","referral"],"summary":"Redeem","description":"Burn the voucher (barber, next visit). Returns the burn outcome for the UI.","operationId":"redeem_api_partner_redeem_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RedeemPayload"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/track/{token}":{"get":{"tags":["tracking","tracking"],"summary":"Get Tracking","operationId":"get_tracking_api_track__token__get","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/system/tick":{"post":{"tags":["system"],"summary":"System Tick","description":"Deterministic enforcement job (manual/admin).\nCloses expired cases as NotApprovedExpired, releases preauth, and logs audit.","operationId":"system_tick_system_tick_post","requestBody":{"content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Payload"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/upload/presigned":{"post":{"tags":["upload"],"summary":"Get Presigned Url","operationId":"get_presigned_url_api_upload_presigned_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PresignedUrlRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/upload/prescription-presigned":{"post":{"tags":["upload"],"summary":"Get Prescription Presigned Url","description":"Doctor-only: presigned PUT URL for uploading a prescription PDF to the isolated PHI bucket.","operationId":"get_prescription_presigned_url_api_upload_prescription_presigned_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrescriptionPresignedRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/upload/patient-photos":{"post":{"tags":["upload"],"summary":"Upload Patient Photos","description":"Receives 3 photos from UploadBayStep.tsx, uploads them to R2/S3.\nTransitions the case from 'MissingData' to 'QueuedForReview'.\n\nOnly the order's patient or staff (see _photo_order). The photos go to the clinical bucket and\nthe response carries no link to them: they are shown only through signed links.","operationId":"upload_patient_photos_api_upload_patient_photos_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_upload_patient_photos_api_upload_patient_photos_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/upload/upload-link":{"get":{"tags":["upload"],"summary":"Get Upload Magic Link","description":"Generates a magic link for the current user to upload photos from mobile.\nUsed by the QR code in UploadBayStep.\n\nThe link logs the phone in as the order's patient, so only that patient (or staff) may ask\nfor it: an order id alone used to be enough (see _photo_order).","operationId":"get_upload_magic_link_api_upload_upload_link_get","parameters":[{"name":"order_id","in":"query","required":true,"schema":{"type":"string","title":"Order Id"}},{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/upload/guided-sweep":{"post":{"tags":["upload"],"summary":"Upload Guided Sweep","description":"Receives the 4 high-res clinical photos from the WebAR Camera sweep.\nUploads them directly to S3/Cloudflare R2 and returns their keys (never a link).\nBack office only: the camera sweep lives in /sandbox, no patient page calls it (24/10/2026).","operationId":"upload_guided_sweep_api_upload_guided_sweep_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_upload_guided_sweep_api_upload_guided_sweep_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/upload/guided-sweep-process":{"post":{"tags":["upload"],"summary":"Process Guided Sweep","description":"Receives the R2 key of the directly-uploaded WebM video.\nTriggers the background task to extract frames and delete the video.","operationId":"process_guided_sweep_api_upload_guided_sweep_process_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SweepProcessRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/upload/guided-sweep-video-process":{"post":{"tags":["upload"],"summary":"Process Guided Sweep Video","description":"Receives the WebM video directly from the browser (bypassing CORS limits on R2),\nuploads it to R2 using S3Service, and triggers the background AI extraction task.","operationId":"process_guided_sweep_video_api_upload_guided_sweep_video_process_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_process_guided_sweep_video_api_upload_guided_sweep_video_process_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/public/subscribe":{"post":{"tags":["public"],"summary":"Subscribe","operationId":"subscribe_api_public_subscribe_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriberBase"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Subscriber"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/public/social-dm/go/{slug}/{src}":{"get":{"tags":["public"],"summary":"Resolve Go","operationId":"resolve_go_api_public_social_dm_go__slug___src__get","parameters":[{"name":"slug","in":"path","required":true,"schema":{"type":"string","title":"Slug"}},{"name":"src","in":"path","required":true,"schema":{"type":"string","title":"Src"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/checkout/geocode":{"post":{"tags":["geocoding"],"summary":"Geocode","description":"Resolve a free-text address to a postal_code via Google Geocoding API.\n\nSilent best-effort: returns {postal_code: null} on any failure rather\nthan 5xx, so the frontend's manual-entry fallback keeps working.","operationId":"geocode_api_checkout_geocode_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GeocodeRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GeocodeResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/cron/broadcast-monday-2026-05-26":{"post":{"tags":["cron","cron"],"summary":"Broadcast Monday Endpoint","description":"One-shot broadcast for the Monday 26/05 recovery campaign.\n\nReturns a per-cohort, per-channel breakdown of sent / skipped / failed.","operationId":"broadcast_monday_endpoint_api_cron_broadcast_monday_2026_05_26_post","parameters":[{"name":"dry_run","in":"query","required":false,"schema":{"type":"boolean","description":"MUST pass ?dry_run=false to actually send.","default":true,"title":"Dry Run"},"description":"MUST pass ?dry_run=false to actually send."},{"name":"force_quiet_hours","in":"query","required":false,"schema":{"type":"boolean","description":"Override quiet-hours guard. Off by default — defense in depth.","default":false,"title":"Force Quiet Hours"},"description":"Override quiet-hours guard. Off by default — defense in depth."},{"name":"X-Cron-Secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Cron-Secret"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/cron/financial-snapshot":{"post":{"tags":["cron","cron_financial"],"summary":"Financial Snapshot Endpoint","description":"Rebuild last N months of financial_monthly_snapshot. Default 13 for\ntrailing-12 charts. Idempotent — safe to retry.","operationId":"financial_snapshot_endpoint_api_cron_financial_snapshot_post","parameters":[{"name":"months","in":"query","required":false,"schema":{"type":"integer","maximum":36,"minimum":1,"default":13,"title":"Months"}},{"name":"X-Cron-Secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Cron-Secret"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/cron/experiments":{"post":{"tags":["cron","cron_experiments"],"summary":"Experiments Endpoint","operationId":"experiments_endpoint_api_cron_experiments_post","parameters":[{"name":"X-Cron-Secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Cron-Secret"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/cron/financial/data-completeness-check":{"post":{"tags":["cron","cron_financial"],"summary":"Data Completeness Check","description":"Run completeness check for the PREVIOUS calendar month.\n\nCalled by cron-data-completeness-check.yml on days 5, 8, 15 of each month.\nIdempotent: multiple calls in the same month produce the same Slack alert\n(or no alert) and the same response. The 3 schedule slots give the PM\nmultiple chances to react.","operationId":"data_completeness_check_api_cron_financial_data_completeness_check_post","parameters":[{"name":"X-Cron-Secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Cron-Secret"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/webhooks/postmark/bounce":{"post":{"tags":["webhooks"],"summary":"Handle Postmark Bounce","description":"Webhook from Postmark — handles HardBounce events.\n\nExpected payload:\n  { \"RecordType\": \"Bounce\", \"Type\": \"HardBounce\", \"Email\": \"john@example.com\", ... }\n\nActions:\n  1. Sets email_bounced_at on the user (suppresses all future email sends).\n  2. Clears email_verified_at.\n  3. Sends a recovery SMS with a magic link if the user has a phone number.","operationId":"handle_postmark_bounce_api_webhooks_postmark_bounce_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/webhooks/postmark/spam":{"post":{"tags":["webhooks"],"summary":"Handle Postmark Spam Complaint","description":"Webhook from Postmark — handles SpamComplaint events.\n\nExpected payload:\n  { \"RecordType\": \"SpamComplaint\", \"Email\": \"john@example.com\", ... }\n\nActions:\n  1. Sets email_bounced_at on the user — reuses the same suppression column\n     so all outbound send paths (crons, webhooks) automatically skip this address.\n  2. Sends a recovery SMS as a courtesy channel-switch nudge.\n\nCAN-SPAM / GDPR: on a spam complaint the sender MUST stop all marketing.\nWe suppress ALL emails (not just marketing) to be safe. Clinical communications\ncan be re-enabled manually by staff if the patient contacts support.","operationId":"handle_postmark_spam_complaint_api_webhooks_postmark_spam_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/webhooks/postmark/delivery":{"post":{"tags":["webhooks"],"summary":"Handle Postmark Delivery","description":"N9V-203 — Postmark Delivery event.\n\nPayload: {RecordType: \"Delivery\", MessageID: \"...\", Recipient: \"...\", ...}\nAction: UPDATE marketing_sends SET delivered_at = COALESCE(delivered_at, NOW())\n        WHERE provider_id = MessageID.","operationId":"handle_postmark_delivery_api_webhooks_postmark_delivery_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/webhooks/postmark/open":{"post":{"tags":["webhooks"],"summary":"Handle Postmark Open","description":"N9V-203 — Postmark Open event (pixel tracking).\n\nPayload: {RecordType: \"Open\", MessageID: \"...\", FirstOpen: bool, ...}\nAction: UPDATE marketing_sends SET opened_at = COALESCE(opened_at, NOW())\n        WHERE provider_id = MessageID.\n\nNOTE: Open events possono firing multipli (ogni volta che il pixel viene\ncaricato). COALESCE garantisce idempotency — solo primo open conta.","operationId":"handle_postmark_open_api_webhooks_postmark_open_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/webhooks/postmark/click":{"post":{"tags":["webhooks"],"summary":"Handle Postmark Click","description":"Postmark Click event — patient clicked a tracked link in the email.\n\nPayload: {RecordType: \"Click\", MessageID: \"...\", OriginalLink: \"...\", ...}\nAction: UPDATE marketing_sends SET clicked_at = COALESCE(clicked_at, NOW())\n        WHERE provider_id = MessageID.\n\nHighest-intent engagement signal short of a paid conversion. Surfaced\non users__360_timeline as `email_clicked` event so the Strategist can\nanswer \"did this user click my recovery email\" without leaving Airtable.\n\nNOTE: COALESCE makes multi-click idempotent — only the first click sets\nthe timestamp. (We can revisit if per-link timing matters; today PM only\nneeds \"did they engage at all\".)\n\nSetup (Postmark Dashboard, post-deploy):\n  Server → Webhooks → existing webhook → Subscribe to \"Link Click\".\n  URL: https://api.n9ve.io/api/webhooks/postmark/click","operationId":"handle_postmark_click_api_webhooks_postmark_click_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/webhooks/postmark/inbound":{"post":{"tags":["webhooks"],"summary":"Handle Postmark Inbound","description":"N9V-169 [M9] — Postmark Inbound: utente risponde a mail recovery.","operationId":"handle_postmark_inbound_api_webhooks_postmark_inbound_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/webhooks/sentry":{"post":{"tags":["webhooks","monitoring"],"summary":"Handle Sentry Webhook","description":"Sentry Internal Integration webhook → Linear issue create.\n\nReturns 200 on every accepted webhook (incl. ones we don't handle, like\n`issue.resolved`) so Sentry doesn't retry. Only the unauthenticated case\nreturns 401.","operationId":"handle_sentry_webhook_api_webhooks_sentry_post","parameters":[{"name":"Sentry-Hook-Resource","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sentry-Hook-Resource"}},{"name":"Sentry-Hook-Signature","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sentry-Hook-Signature"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/webhooks/posthog":{"post":{"tags":["webhooks","monitoring"],"summary":"Handle Posthog Webhook","description":"PostHog Hog Function → Linear issue create.\n\nReturns 200 on every accepted webhook (incl. Linear-failure) so PostHog\ndoesn't retry-storm us. 401 only on missing/wrong bearer; 400 on\ninvalid JSON or missing required fields.","operationId":"handle_posthog_webhook_api_webhooks_posthog_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/webhooks/twilio/status":{"post":{"tags":["webhooks","webhooks-twilio"],"summary":"Twilio Status Callback","description":"Receives Twilio delivery status updates and updates communication_log.\n\nTwilio expects a 200 response regardless of our processing outcome.\nAll errors are swallowed — we log and return 200 to prevent Twilio retries.","operationId":"twilio_status_callback_api_webhooks_twilio_status_post","requestBody":{"content":{"application/x-www-form-urlencoded":{"schema":{"$ref":"#/components/schemas/Body_twilio_status_callback_api_webhooks_twilio_status_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/webhooks/twilio/inbound":{"post":{"tags":["webhooks","webhooks-twilio"],"summary":"Twilio Inbound Sms","description":"N9V-189 [M10] — Twilio inbound SMS webhook.\n\nCattura STOP/START/HELP keywords come fallback al pattern web-stop\n(M3.5 N9V-185). Se l'utente digita STOP manualmente nonostante la\npresenza del web-stop link, mirror in marketing_suppressions per\nsincronizzare lo stato + Slack alert.\n\nTwilio expects 200 always (no retry storm).\n\nLifecycle:\n- STOP / UNSUBSCRIBE / STOPALL → mirror in marketing_suppressions\n  (channel='sms', reason='twilio_stop_keyword')\n- START / UNSTOP → rimuove riga twilio_stop_keyword (riattiva marketing)\n- HELP → log only (Twilio risponde con auto-reply pre-configurato dashboard)\n\nIdempotent: re-STOP non duplica.","operationId":"twilio_inbound_sms_api_webhooks_twilio_inbound_post","requestBody":{"content":{"application/x-www-form-urlencoded":{"schema":{"$ref":"#/components/schemas/Body_twilio_inbound_sms_api_webhooks_twilio_inbound_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/webhooks/twilio/usage":{"post":{"tags":["webhooks","webhooks-twilio"],"summary":"Twilio Usage Callback","description":"Today's Twilio spend went over the threshold of the usage trigger. A normal day costs about\n0,65 $; a loop sending one SMS a minute costs about 190 $ a day and auto-recharge keeps paying\nit, so this tells Slack within minutes instead of the next morning.\n\nAlways 200: Twilio retries otherwise, and a second alert says nothing new.","operationId":"twilio_usage_callback_api_webhooks_twilio_usage_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/sendcloud/webhook":{"post":{"tags":["logistics"],"summary":"Sendcloud Webhook","operationId":"sendcloud_webhook_api_sendcloud_webhook_post","parameters":[{"name":"Sendcloud-Signature","in":"header","required":false,"schema":{"type":"string","title":"Sendcloud-Signature"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/webhooks/chatwoot/bot":{"post":{"tags":["ai","triage"],"summary":"Chatwoot Bot Webhook","description":"Webhook endpoint to receive messages from Chatwoot.","operationId":"chatwoot_bot_webhook_api_webhooks_chatwoot_bot_post","parameters":[{"name":"x-chatwoot-signature","in":"header","required":false,"schema":{"type":"string","title":"X-Chatwoot-Signature"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/chatwoot/bot":{"post":{"tags":["ai","triage"],"summary":"Chatwoot Bot Webhook","description":"Webhook endpoint to receive messages from Chatwoot.","operationId":"chatwoot_bot_webhook_chatwoot_bot_post","parameters":[{"name":"x-chatwoot-signature","in":"header","required":false,"schema":{"type":"string","title":"X-Chatwoot-Signature"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/cron/logistics":{"post":{"tags":["cron"],"summary":"Run Logistics Cron","operationId":"run_logistics_cron_api_cron_logistics_post","parameters":[{"name":"X-Cron-Secret","in":"header","required":false,"schema":{"type":"string","default":"","title":"X-Cron-Secret"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/test/latest-otp":{"get":{"tags":["test"],"summary":"Get Latest Otp","operationId":"get_latest_otp_api_test_latest_otp_get","parameters":[{"name":"phone","in":"query","required":true,"schema":{"type":"string","minLength":8,"title":"Phone"}},{"name":"X-E2E-Secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-E2E-Secret"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/test/user":{"delete":{"tags":["test"],"summary":"Delete Test User","operationId":"delete_test_user_api_test_user_delete","parameters":[{"name":"phone","in":"query","required":true,"schema":{"type":"string","minLength":8,"title":"Phone"}},{"name":"X-E2E-Secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-E2E-Secret"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/test/seed-user":{"post":{"tags":["test"],"summary":"Seed Test User","operationId":"seed_test_user_api_test_seed_user_post","parameters":[{"name":"X-E2E-Secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-E2E-Secret"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Payload"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/test/seed-case":{"post":{"tags":["test"],"summary":"Seed Test Case","description":"Create an order + case for a user, idempotently. Required by chat.spec.ts\nbecause /dashboard/supporto redirects to /quiz when patient/me returns no\norder_id (see frontend/src/app/(patient)/dashboard/supporto/page.tsx).\n\nBody: {phone: \"+39...\", case_state?: \"Paid\"}\nReturns: {user_id, case_id, order_id}","operationId":"seed_test_case_api_test_seed_case_post","parameters":[{"name":"X-E2E-Secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-E2E-Secret"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Payload"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/test/inject-chat-message":{"post":{"tags":["test"],"summary":"Inject Chat Message","description":"Insert a chat_messages row directly. Used by chat.spec.ts to simulate a\nstaff reply without driving the doctor backoffice UI (which is exercised\nseparately in doctor-flow.spec.ts).\n\nBody: {case_id, sender_type: \"user\"|\"staff\", content,\n       sender_name?, sender_role?}\nReturns: {message_id}","operationId":"inject_chat_message_api_test_inject_chat_message_post","parameters":[{"name":"X-E2E-Secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-E2E-Secret"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Payload"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/test/seed-subscription":{"post":{"tags":["test"],"summary":"Seed Test Subscription","description":"Insert a minimal subscription row for a phone-identified user. Required\nby subscription.spec.ts to exercise pause/resume without running the\nfull payment funnel.\n\nTo make `/api/subscriptions/mine` return the row (it INNER-JOINs through\nsubscription_versions → molecule_combinations), we also seed a version\npointing at the first available combo. If no combos exist on the env\nwe fall back to a versionless subscription — the pause/resume endpoint\nstill works (it only reads subscription_id).\n\nBody: {phone: \"+39...\", status?: \"ACTIVE\"}\nReturns: {user_id, subscription_id, status}","operationId":"seed_test_subscription_api_test_seed_subscription_post","parameters":[{"name":"X-E2E-Secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-E2E-Secret"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Payload"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/test/seed-doctor-session":{"post":{"tags":["test"],"summary":"Seed Doctor Session","description":"Upsert a medical-role admin user and return a signed JWT.\n\nBody: {email?: str}  (defaults to \"doctor+e2e@n9ve.io\")\nReturns: {user_id, email, token, expires_at}","operationId":"seed_doctor_session_api_test_seed_doctor_session_post","parameters":[{"name":"X-E2E-Secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-E2E-Secret"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"default":{},"title":"Payload"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/test/doctor":{"delete":{"tags":["test"],"summary":"Delete Test Doctor","description":"Cleanup for seed-doctor-session. Removes the admin_users row and any\ncase_claims it owns (cases themselves belong to a patient and are cleaned\nup by DELETE /api/test/user against the patient phone).","operationId":"delete_test_doctor_api_test_doctor_delete","parameters":[{"name":"email","in":"query","required":true,"schema":{"type":"string","minLength":3,"title":"Email"}},{"name":"X-E2E-Secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-E2E-Secret"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/cron/cf-reminders":{"get":{"tags":["cron"],"summary":"Process Cf Reminders","description":"Hourly cron for CF correction follow-up.\nD0 (~5 min)  SMS only\nD3 (+72h)    SMS + Email\nD5 (+120h)   SMS + Email (last attempt)","operationId":"process_cf_reminders_api_cron_cf_reminders_get","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/cron/nmi-reminders":{"get":{"tags":["cron"],"summary":"Process Nmi Reminders","description":"Hourly cron — sends multi-day follow-up reminders for NeedsMoreInfo cases.","operationId":"process_nmi_reminders_api_cron_nmi_reminders_get","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/cron/missing-photos-reminders":{"get":{"tags":["cron"],"summary":"Process Missing Photos Reminders","description":"Hourly cron — sends follow-up reminders to patients who haven't uploaded photos.","operationId":"process_missing_photos_reminders_api_cron_missing_photos_reminders_get","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/cron/partner-vouchers":{"post":{"tags":["cron"],"summary":"Deliver Partner Vouchers","description":"Deliver due partner vouchers. Auth via Bearer CRON_SECRET (same as the\nother crons). No-op unless the referral feature is on.","operationId":"deliver_partner_vouchers_api_cron_partner_vouchers_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/cron/preauth-expiry":{"get":{"tags":["cron"],"summary":"Process Preauth Expiry","description":"Called by Vercel Cron (or external scheduler) every 6 hours.\nChecks for pre-authorizations approaching or past expiry.","operationId":"process_preauth_expiry_api_cron_preauth_expiry_get","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/cron/renewals":{"post":{"tags":["cron"],"summary":"Run Renewals Cron","operationId":"run_renewals_cron_api_cron_renewals_post","parameters":[{"name":"dry_run","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Dry Run"}},{"name":"lookahead_days","in":"query","required":false,"schema":{"type":"integer","default":0,"title":"Lookahead Days"}},{"name":"X-Cron-Secret","in":"header","required":false,"schema":{"type":"string","default":"","title":"X-Cron-Secret"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/cron/email-audit":{"post":{"tags":["cron","cron"],"summary":"Cron Email Audit","description":"N9V-152 cron daily — paying users missing critical email.","operationId":"cron_email_audit_api_cron_email_audit_post","parameters":[{"name":"X-Cron-Secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Cron-Secret"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/cron/webhook-retry":{"post":{"tags":["cron","cron"],"summary":"Cron Webhook Retry","operationId":"cron_webhook_retry_api_cron_webhook_retry_post","parameters":[{"name":"X-Cron-Secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Cron-Secret"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/cron/recovery-t2h":{"post":{"tags":["cron","cron"],"summary":"Recovery T2H Endpoint","description":"N9V-190 [M11] Cron endpoint per recovery T+2h primo touch.\n\nDefault dry_run=true. Render cron deve esplicitamente passare ?dry_run=false\nper send live (combinato con flag MARKETING_RECOVERY_LIVE_ENABLED).","operationId":"recovery_t2h_endpoint_api_cron_recovery_t2h_post","parameters":[{"name":"dry_run","in":"query","required":false,"schema":{"type":"boolean","description":"Default TRUE per safety. Render env CRON_RECOVERY_DRY_RUN può overrideare.","default":true,"title":"Dry Run"},"description":"Default TRUE per safety. Render env CRON_RECOVERY_DRY_RUN può overrideare."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":1000,"minimum":1,"default":200,"title":"Limit"}},{"name":"payment_page_days","in":"query","required":false,"schema":{"type":"integer","maximum":45,"minimum":1,"description":"Finestra del ramo pagina di pagamento. 14 nei giri normali; piu' larga solo per un recupero una tantum deciso dal PM.","default":14,"title":"Payment Page Days"},"description":"Finestra del ramo pagina di pagamento. 14 nei giri normali; piu' larga solo per un recupero una tantum deciso dal PM."},{"name":"X-Cron-Secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Cron-Secret"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/cron/recovery-quiz-t24h":{"post":{"tags":["cron","cron"],"summary":"Recovery Quiz T24H Endpoint","operationId":"recovery_quiz_t24h_endpoint_api_cron_recovery_quiz_t24h_post","parameters":[{"name":"dry_run","in":"query","required":false,"schema":{"type":"boolean","default":true,"title":"Dry Run"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":1000,"minimum":1,"default":200,"title":"Limit"}},{"name":"X-Cron-Secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Cron-Secret"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/cron/recovery-quiz-t72h":{"post":{"tags":["cron","cron"],"summary":"Recovery Quiz T72H Endpoint","description":"D3 entry. channels=email per fire 11:30 IT, channels=sms per fire 15:00 IT.","operationId":"recovery_quiz_t72h_endpoint_api_cron_recovery_quiz_t72h_post","parameters":[{"name":"dry_run","in":"query","required":false,"schema":{"type":"boolean","default":true,"title":"Dry Run"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":1000,"minimum":1,"default":200,"title":"Limit"}},{"name":"channels","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Comma-separated: email,sms (default both)","title":"Channels"},"description":"Comma-separated: email,sms (default both)"},{"name":"X-Cron-Secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Cron-Secret"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/cron/recovery-quiz-d7":{"post":{"tags":["cron","cron"],"summary":"Recovery Quiz D7 Endpoint","description":"D7 last touch — fires when user has 3 prior touches (D0+D1+D3) and last\nwas 96-120h ago. Soft close-out tone, no fear language.","operationId":"recovery_quiz_d7_endpoint_api_cron_recovery_quiz_d7_post","parameters":[{"name":"dry_run","in":"query","required":false,"schema":{"type":"boolean","default":true,"title":"Dry Run"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":1000,"minimum":1,"default":200,"title":"Limit"}},{"name":"X-Cron-Secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Cron-Secret"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/cron/auto-promote-anonymous":{"post":{"tags":["cron","cron"],"summary":"Auto Promote Anonymous Endpoint","description":"Gap 1 closer: promotes anonymous evaluations (transcript email but no\nbound_user_id) to synthetic GhostLead users. Successive T+2h cron then\ncaptures them naturally.","operationId":"auto_promote_anonymous_endpoint_api_cron_auto_promote_anonymous_post","parameters":[{"name":"dry_run","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Dry Run"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}},{"name":"X-Cron-Secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Cron-Secret"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/cron/recovery-payment-failed-t24h":{"post":{"tags":["cron","cron"],"summary":"Recovery Payment Failed T24H Endpoint","operationId":"recovery_payment_failed_t24h_endpoint_api_cron_recovery_payment_failed_t24h_post","parameters":[{"name":"dry_run","in":"query","required":false,"schema":{"type":"boolean","default":true,"title":"Dry Run"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":500,"minimum":1,"default":100,"title":"Limit"}},{"name":"X-Cron-Secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Cron-Secret"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/cron/recovery-q4":{"post":{"tags":["cron","cron"],"summary":"Recovery Q4 Endpoint","operationId":"recovery_q4_endpoint_api_cron_recovery_q4_post","parameters":[{"name":"dry_run","in":"query","required":false,"schema":{"type":"boolean","default":true,"title":"Dry Run"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":1000,"minimum":1,"default":200,"title":"Limit"}},{"name":"X-Cron-Secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Cron-Secret"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/cron/airtable-funnel":{"post":{"tags":["cron","cron"],"summary":"Airtable Funnel Endpoint","description":"Compute + upsert daily funnel snapshot.\n\nDefault: yesterday UTC. Override via `target_date=YYYY-MM-DD` per il\nbackfill (es. dopo un'incident dove il cron non ha girato per N giorni).","operationId":"airtable_funnel_endpoint_api_cron_airtable_funnel_post","parameters":[{"name":"target_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"ISO date (YYYY-MM-DD). Default: yesterday UTC. Useful per backfill manuale.","title":"Target Date"},"description":"ISO date (YYYY-MM-DD). Default: yesterday UTC. Useful per backfill manuale."},{"name":"dry_run","in":"query","required":false,"schema":{"type":"boolean","description":"True salta l'upsert su Airtable. Override env: AIRTABLE_FUNNEL_DRY_RUN=true.","default":false,"title":"Dry Run"},"description":"True salta l'upsert su Airtable. Override env: AIRTABLE_FUNNEL_DRY_RUN=true."},{"name":"X-Cron-Secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Cron-Secret"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/cron/airtable-paying-customers":{"post":{"tags":["cron","cron"],"summary":"Airtable Paying Customers Endpoint","description":"Pull paying customers from Postgres + upsert to Airtable.","operationId":"airtable_paying_customers_endpoint_api_cron_airtable_paying_customers_post","parameters":[{"name":"dry_run","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Dry Run"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":5000,"minimum":1,"default":1000,"title":"Limit"}},{"name":"X-Cron-Secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Cron-Secret"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/cron/airtable-ads":{"post":{"tags":["cron","cron"],"summary":"Airtable Ads Endpoint","description":"Pull Meta Ads insights for the window + upsert to Airtable.","operationId":"airtable_ads_endpoint_api_cron_airtable_ads_post","parameters":[{"name":"since_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"ISO date. Default: yesterday UTC.","title":"Since Date"},"description":"ISO date. Default: yesterday UTC."},{"name":"until_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"ISO date. Default: same as since_date.","title":"Until Date"},"description":"ISO date. Default: same as since_date."},{"name":"dry_run","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Dry Run"}},{"name":"X-Cron-Secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Cron-Secret"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/cron/airtable-user-journeys":{"post":{"tags":["cron","cron"],"summary":"Airtable User Journeys Endpoint","description":"Pull user journeys from Postgres (+ optional PostHog) + upsert to Airtable.","operationId":"airtable_user_journeys_endpoint_api_cron_airtable_user_journeys_post","parameters":[{"name":"dry_run","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Dry Run"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":5000,"minimum":1,"default":1000,"title":"Limit"}},{"name":"X-Cron-Secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Cron-Secret"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/cron/airtable-ig":{"post":{"tags":["cron","cron"],"summary":"Airtable Ig Endpoint","description":"Pull last `days_back` days of IG posts + upsert to Airtable.","operationId":"airtable_ig_endpoint_api_cron_airtable_ig_post","parameters":[{"name":"dry_run","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Dry Run"}},{"name":"days_back","in":"query","required":false,"schema":{"type":"integer","maximum":365,"minimum":1,"default":30,"title":"Days Back"}},{"name":"X-Cron-Secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Cron-Secret"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/cron/airtable-tiktok":{"post":{"tags":["cron","cron"],"summary":"Airtable Tiktok Endpoint","description":"Pull last `days_back` days of TikTok videos + upsert to Airtable.","operationId":"airtable_tiktok_endpoint_api_cron_airtable_tiktok_post","parameters":[{"name":"dry_run","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Dry Run"}},{"name":"days_back","in":"query","required":false,"schema":{"type":"integer","maximum":365,"minimum":1,"default":30,"title":"Days Back"}},{"name":"X-Cron-Secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Cron-Secret"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/cron/airtable-timeline":{"post":{"tags":["cron","cron"],"summary":"Airtable Timeline Endpoint","description":"Pull cross-source events for active users + upsert to Airtable users__360_timeline.","operationId":"airtable_timeline_endpoint_api_cron_airtable_timeline_post","parameters":[{"name":"since_days","in":"query","required":false,"schema":{"type":"integer","maximum":365,"minimum":1,"default":90,"title":"Since Days"}},{"name":"dry_run","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Dry Run"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":5000,"minimum":1,"default":1000,"title":"Limit"}},{"name":"user_ids","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Comma-separated user_id list (overrides cohort)","title":"User Ids"},"description":"Comma-separated user_id list (overrides cohort)"},{"name":"X-Cron-Secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Cron-Secret"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/cron/posthog-retroactive-identify":{"post":{"tags":["cron","cron"],"summary":"Posthog Retroactive Identify Endpoint","description":"Merge anonymous PostHog distinct_ids into our user_id for paying customers.","operationId":"posthog_retroactive_identify_endpoint_api_cron_posthog_retroactive_identify_post","parameters":[{"name":"dry_run","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Dry Run"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":5000,"minimum":1,"default":1000,"title":"Limit"}},{"name":"user_ids","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Comma-separated user_id list","title":"User Ids"},"description":"Comma-separated user_id list"},{"name":"X-Cron-Secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Cron-Secret"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/cron/negative-events-alert":{"post":{"tags":["cron","cron"],"summary":"Negative Events Alert Endpoint","description":"Scan negative events + ping #incidents.","operationId":"negative_events_alert_endpoint_api_cron_negative_events_alert_post","parameters":[{"name":"lookback_minutes","in":"query","required":false,"schema":{"type":"integer","maximum":720,"minimum":15,"default":90,"title":"Lookback Minutes"}},{"name":"chat_breach_minutes","in":"query","required":false,"schema":{"type":"integer","maximum":1440,"minimum":30,"default":240,"title":"Chat Breach Minutes"}},{"name":"dry_run","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Dry Run"}},{"name":"X-Cron-Secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Cron-Secret"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/cron/airtable-quiz-funnel":{"post":{"tags":["cron","cron"],"summary":"Airtable Quiz Funnel Endpoint","description":"Run the step-funnel + answer-distribution writers.","operationId":"airtable_quiz_funnel_endpoint_api_cron_airtable_quiz_funnel_post","parameters":[{"name":"dry_run","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Dry Run"}},{"name":"skip_answers","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Skip Answers"}},{"name":"X-Cron-Secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Cron-Secret"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/cron/analytics-canary":{"post":{"tags":["cron","cron"],"summary":"Analytics Canary Endpoint","description":"Run the analytics canary (verify PostHog event firing reliability).","operationId":"analytics_canary_endpoint_api_cron_analytics_canary_post","parameters":[{"name":"X-Cron-Secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Cron-Secret"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/cron/seo-health":{"post":{"tags":["cron","cron"],"summary":"Seo Health Endpoint","operationId":"seo_health_endpoint_api_cron_seo_health_post","parameters":[{"name":"X-Cron-Secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Cron-Secret"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/cron/llm-health":{"post":{"tags":["cron","cron"],"summary":"Llm Health Endpoint","operationId":"llm_health_endpoint_api_cron_llm_health_post","parameters":[{"name":"X-Cron-Secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Cron-Secret"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/cron/sms-health":{"post":{"tags":["cron","cron"],"summary":"Sms Health Endpoint","operationId":"sms_health_endpoint_api_cron_sms_health_post","parameters":[{"name":"min_balance_usd","in":"query","required":false,"schema":{"type":"number","minimum":0,"default":5.0,"title":"Min Balance Usd"}},{"name":"X-Cron-Secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Cron-Secret"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/cron/sms-probe/status":{"get":{"tags":["cron","cron"],"summary":"Sms Probe Status","description":"What the workflow asks first: is a probe already out, and which commit is deployed.","operationId":"sms_probe_status_api_cron_sms_probe_status_get","parameters":[{"name":"max_age_days","in":"query","required":false,"schema":{"type":"integer","maximum":30,"minimum":1,"default":1,"title":"Max Age Days"}},{"name":"X-Cron-Secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Cron-Secret"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/cron/sms-probe/send":{"post":{"tags":["cron","cron"],"summary":"Sms Probe Send","description":"One real SMS with the patients' login text. The recipient is a constant, never a parameter.","operationId":"sms_probe_send_api_cron_sms_probe_send_post","parameters":[{"name":"max_age_days","in":"query","required":false,"schema":{"type":"integer","maximum":30,"minimum":1,"default":1,"title":"Max Age Days"}},{"name":"force","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Force"}},{"name":"X-Cron-Secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Cron-Secret"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/cron/sms-probe/verify":{"get":{"tags":["cron","cron"],"summary":"Sms Probe Verify","description":"Delivered per the status callback is the end of it. Otherwise ask Twilio and record what it\nsays: the workflow needs the error code to tell a switched-off phone from a real failure.","operationId":"sms_probe_verify_api_cron_sms_probe_verify_get","parameters":[{"name":"sid","in":"query","required":true,"schema":{"type":"string","title":"Sid"}},{"name":"X-Cron-Secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Cron-Secret"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/cron/stripe-fees":{"post":{"tags":["cron","cron"],"summary":"Stripe Fees Endpoint","operationId":"stripe_fees_endpoint_api_cron_stripe_fees_post","parameters":[{"name":"X-Cron-Secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Cron-Secret"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/cron/seo-generate":{"post":{"tags":["cron","cron"],"summary":"Seo Generate","operationId":"seo_generate_api_cron_seo_generate_post","parameters":[{"name":"X-Cron-Secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Cron-Secret"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/cron/seo-review":{"post":{"tags":["cron","cron"],"summary":"Seo Review","operationId":"seo_review_api_cron_seo_review_post","parameters":[{"name":"force","in":"query","required":false,"schema":{"type":"integer","default":0,"title":"Force"}},{"name":"X-Cron-Secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Cron-Secret"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/seo/top-queries":{"get":{"tags":["seo"],"summary":"Seo Top Queries","operationId":"seo_top_queries_api_seo_top_queries_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":20,"title":"Limit"}},{"name":"X-Internal-Secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Internal-Secret"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/seo/topic-conversion":{"get":{"tags":["seo"],"summary":"Seo Topic Conversion","description":"Per-topic conversion (which articles turn readers into evaluations) for the\nideas generator — the strongest 'what converts' signal we have. No PII:\naggregate per-article view/converter counts only.","operationId":"seo_topic_conversion_api_seo_topic_conversion_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":20,"title":"Limit"}},{"name":"days","in":"query","required":false,"schema":{"type":"integer","default":90,"title":"Days"}},{"name":"X-Internal-Secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Internal-Secret"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/cron/funnel-sync":{"post":{"tags":["cron","cron"],"summary":"Funnel Sync","operationId":"funnel_sync_api_cron_funnel_sync_post","parameters":[{"name":"backfill","in":"query","required":false,"schema":{"type":"boolean","description":"true = full history; default = last 2 days","default":false,"title":"Backfill"},"description":"true = full history; default = last 2 days"},{"name":"seed","in":"query","required":false,"schema":{"type":"boolean","description":"true = record all insert_ids WITHOUT emitting (one-time, post idempotency rollout)","default":false,"title":"Seed"},"description":"true = record all insert_ids WITHOUT emitting (one-time, post idempotency rollout)"},{"name":"X-Cron-Secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Cron-Secret"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/doctor/queue":{"get":{"tags":["doctor"],"summary":"Get Doctor Queue","description":"Returns cases that are QueuedForReview and not actively claimed.","operationId":"get_doctor_queue_api_doctor_queue_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/doctor/queue/count":{"get":{"tags":["doctor"],"summary":"Get Doctor Queue Count","description":"Quanti casi aspettano una decisione del medico. Serve al pallino.\n\nParte dalla STESSA funzione della coda invece di farsi una query propria:\ndue query separate divergono al primo cambio di regola su cosa sia un caso\nin attesa, e un pallino che dice 3 dove la pagina ne mostra 0 e' peggio di\nnessun pallino.\n\nTorna solo il numero: la barra laterale lo chiede ogni 15 secondi, e non ha\nbisogno dei casi.","operationId":"get_doctor_queue_count_api_doctor_queue_count_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/doctor/queue/unverified":{"get":{"tags":["doctor"],"summary":"Get Unverified Queue","description":"Returns cases blocked from the medical queue due to missing/invalid CF.","operationId":"get_unverified_queue_api_doctor_queue_unverified_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/doctor/queue/unverified-count":{"get":{"tags":["doctor"],"summary":"Get Unverified Queue Count","description":"Quanti casi sono FERMI per codice fiscale mancante o non valido.\n\nNon e' la stessa cosa dei casi in attesa del medico: questi non arrivano\nmai al medico e non si sbloccano da soli, serve una persona. Nella barra\nlaterale cambiano il colore del pallino, non il numero.\n\nStessa regola dell'altro contatore: chiama la funzione della pagina invece\ndi farsi una query propria, cosi' non puo' dire un numero diverso.","operationId":"get_unverified_queue_count_api_doctor_queue_unverified_count_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/doctor/queue/valutazioni-inviate":{"get":{"tags":["doctor"],"summary":"Get Sent Valutazioni Queue","description":"Valutazioni sent by the doctors and waiting on the patient (choice) or on ops (refund).","operationId":"get_sent_valutazioni_queue_api_doctor_queue_valutazioni_inviate_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/doctor/cases/{case_id}":{"get":{"tags":["doctor"],"summary":"Get Case Detail","description":"Returns full case details for the authenticated doctor.","operationId":"get_case_detail_api_doctor_cases__case_id__get","parameters":[{"name":"case_id","in":"path","required":true,"schema":{"type":"string","title":"Case Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/doctor/cases/{case_id}/claim":{"post":{"tags":["doctor"],"summary":"Claim Case","description":"Claim semantics:\n- no claim → create\n- expired claim → overwrite\n- active claim by same doctor → idempotent (200 w/ status=renewed)\n- active claim by other doctor → 409","operationId":"claim_case_api_doctor_cases__case_id__claim_post","parameters":[{"name":"case_id","in":"path","required":true,"schema":{"type":"string","title":"Case Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/doctor/cases/{case_id}/review/decision":{"post":{"tags":["doctor"],"summary":"Doctor Review Decision","description":"Doctor submits clinical decision. Requires active claim.","operationId":"doctor_review_decision_api_doctor_cases__case_id__review_decision_post","parameters":[{"name":"case_id","in":"path","required":true,"schema":{"type":"string","title":"Case Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DoctorDecisionBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/doctor/patient/info-responses":{"post":{"tags":["doctor"],"summary":"Patient Info Responses","description":"Patient submits requested information — moves case back to QueuedForReview.\n\nOnly the case's own patient (no caller in the app on 24/10/2026): until then a case id alone\nwrote answers and photo keys into any case and sent it back to the doctor (B5).","operationId":"patient_info_responses_api_doctor_patient_info_responses_post","parameters":[{"name":"case_id","in":"query","required":true,"schema":{"type":"string","title":"Case Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PatientInfoResponseBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/doctor/cases/{case_id}/chat/messages":{"get":{"tags":["doctor"],"summary":"Get Case Chat Messages","operationId":"get_case_chat_messages_api_doctor_cases__case_id__chat_messages_get","parameters":[{"name":"case_id","in":"path","required":true,"schema":{"type":"string","title":"Case Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["doctor"],"summary":"Send Case Chat Message","description":"Send a chat message to the patient. Audited (fortress 8.6).","operationId":"send_case_chat_message_api_doctor_cases__case_id__chat_messages_post","parameters":[{"name":"case_id","in":"path","required":true,"schema":{"type":"string","title":"Case Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatMessageBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/doctor/cases/{case_id}/release":{"post":{"tags":["doctor"],"summary":"Release Claim","description":"Doctor explicitly releases their claim. Audited (fortress 8.6).","operationId":"release_claim_api_doctor_cases__case_id__release_post","parameters":[{"name":"case_id","in":"path","required":true,"schema":{"type":"string","title":"Case Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/doctor/cases/{case_id}/actions":{"get":{"tags":["doctor"],"summary":"List Doctor Actions","description":"List the audit trail of doctor actions on a case (fortress 8.6).\n\nReturns the medical_audit_log rows whose actor_type='doctor' for the given\ncase, newest first. Captures: case_claimed, case_released, doctor_decision_made,\ndoctor_info_requested, doctor_undo_decision, doctor_message_sent.\n\nRead-only; any authenticated medical-role user can see the trail (matches\nthe rest of the medical portal's RBAC — there is no per-doctor partition).","operationId":"list_doctor_actions_api_doctor_cases__case_id__actions_get","parameters":[{"name":"case_id","in":"path","required":true,"schema":{"type":"string","title":"Case Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/doctor/cases/{case_id}/referto-preview":{"get":{"tags":["doctor"],"summary":"Get Referto Preview","description":"Live data for the doctor's inline referto preview while drafting the report.\n\nReturns the SAME recap cards / head-map areas / therapy form the patient will\neventually see (computed via the shared build_referto_recap helper), so the\ndoctor previews the real patient's data instead of hardcoded placeholders.\n\nDeliberately NO \"referto already sent\" gate — the doctor is still drafting.\nA missing case or evaluation yields empty fields (the preview simply shows\nfewer cards), never a 500.","operationId":"get_referto_preview_api_doctor_cases__case_id__referto_preview_get","parameters":[{"name":"case_id","in":"path","required":true,"schema":{"type":"string","title":"Case Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/doctor/cases/{case_id}/undo_decision":{"post":{"tags":["doctor"],"summary":"Undo Decision","description":"Reverts a case to 'QueuedForReview'. Allowed only for Ineligible/PharmacyReview with no payment.","operationId":"undo_decision_api_doctor_cases__case_id__undo_decision_post","parameters":[{"name":"case_id","in":"path","required":true,"schema":{"type":"string","title":"Case Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/doctor/cases/{case_id}/prescriptions":{"get":{"tags":["doctor"],"summary":"List Prescriptions","operationId":"list_prescriptions_api_doctor_cases__case_id__prescriptions_get","parameters":[{"name":"case_id","in":"path","required":true,"schema":{"type":"string","title":"Case Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["doctor"],"summary":"Issue Prescription","description":"Emette una ricetta nuova: la precedente resta, sostituita. Nessun altro effetto sul caso.","operationId":"issue_prescription_api_doctor_cases__case_id__prescriptions_post","parameters":[{"name":"case_id","in":"path","required":true,"schema":{"type":"string","title":"Case Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/NewPrescriptionBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/doctor/cases/{case_id}/prescriptions/{prescription_id}/download":{"get":{"tags":["doctor"],"summary":"Download Prescription","operationId":"download_prescription_api_doctor_cases__case_id__prescriptions__prescription_id__download_get","parameters":[{"name":"case_id","in":"path","required":true,"schema":{"type":"string","title":"Case Id"}},{"name":"prescription_id","in":"path","required":true,"schema":{"type":"string","title":"Prescription Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/doctor/cases/{case_id}/prescriptions/{prescription_id}/pdf":{"get":{"tags":["doctor"],"summary":"Open Prescription Pdf","description":"\"Apri\" dallo storico delle ricette: un link normale (scheda nuova, rel=noopener) che porta al PDF\ncon un link firmato di 15 minuti, mostrato nel browser. Solo una ricetta di QUESTO caso.","operationId":"open_prescription_pdf_api_doctor_cases__case_id__prescriptions__prescription_id__pdf_get","parameters":[{"name":"case_id","in":"path","required":true,"schema":{"type":"string","title":"Case Id"}},{"name":"prescription_id","in":"path","required":true,"schema":{"type":"string","title":"Prescription Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/doctor/cases/{case_id}/renewal/confirm":{"post":{"tags":["doctor"],"summary":"Confirm Renewal","description":"La terapia continua con la ricetta che c'e' gia': sblocca il rinnovo fermo senza documenti nuovi.","operationId":"confirm_renewal_api_doctor_cases__case_id__renewal_confirm_post","parameters":[{"name":"case_id","in":"path","required":true,"schema":{"type":"string","title":"Case Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConfirmRenewalBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/doctor/patients":{"get":{"tags":["doctor"],"summary":"List Doctor Patients","operationId":"list_doctor_patients_api_doctor_patients_get","parameters":[{"name":"view","in":"query","required":false,"schema":{"enum":["active","paused","all","valutazioni"],"type":"string","default":"active","title":"View"}},{"name":"search","in":"query","required":false,"schema":{"anyOf":[{"type":"string","maxLength":120},{"type":"null"}],"title":"Search"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/doctor/cases/{case_id}/plan":{"get":{"tags":["doctor"],"summary":"Get Case Plan","operationId":"get_case_plan_api_doctor_cases__case_id__plan_get","parameters":[{"name":"case_id","in":"path","required":true,"schema":{"type":"string","title":"Case Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/doctor/cases/{case_id}/plan/products":{"post":{"tags":["doctor"],"summary":"Add Plan Product","operationId":"add_plan_product_api_doctor_cases__case_id__plan_products_post","parameters":[{"name":"case_id","in":"path","required":true,"schema":{"type":"string","title":"Case Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlanProductBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/doctor/cases/{case_id}/plan/products/{product_id}":{"delete":{"tags":["doctor"],"summary":"Remove Plan Product","description":"Il medico toglie solo cio' che non e' ancora partito; il resto e' del supporto.","operationId":"remove_plan_product_api_doctor_cases__case_id__plan_products__product_id__delete","parameters":[{"name":"case_id","in":"path","required":true,"schema":{"type":"string","title":"Case Id"}},{"name":"product_id","in":"path","required":true,"schema":{"type":"string","title":"Product Id"}},{"name":"note","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Note"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/doctor/cases/{case_id}/plan/bridge":{"post":{"tags":["doctor"],"summary":"Create Plan Bridge","operationId":"create_plan_bridge_api_doctor_cases__case_id__plan_bridge_post","parameters":[{"name":"case_id","in":"path","required":true,"schema":{"type":"string","title":"Case Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BridgeBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/doctor/cases/{case_id}/plan/renew-today":{"post":{"tags":["doctor"],"summary":"Renew Plan Today","description":"Sotto i 7 giorni dal rinnovo: rinnovo anticipato a oggi con tutti i prodotti.","operationId":"renew_plan_today_api_doctor_cases__case_id__plan_renew_today_post","parameters":[{"name":"case_id","in":"path","required":true,"schema":{"type":"string","title":"Case Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/doctor/cases/{case_id}/valutazione":{"post":{"tags":["doctor"],"summary":"Mark Ready","description":"\"Pronta per ops\": the doctor's evaluation is complete; the patient receives nothing yet.","operationId":"mark_ready_api_doctor_cases__case_id__valutazione_post","parameters":[{"name":"case_id","in":"path","required":true,"schema":{"type":"string","title":"Case Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EvaluationBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/doctor/cases/{case_id}/valutazione/ritira":{"post":{"tags":["doctor"],"summary":"Withdraw Proposal","description":"\"Ritira proposta\": back to the queue, the credit voided, no message to the patient. The doctor\nthen hands a new version to ops with the same endpoint as the first.","operationId":"withdraw_proposal_api_doctor_cases__case_id__valutazione_ritira_post","parameters":[{"name":"case_id","in":"path","required":true,"schema":{"type":"string","title":"Case Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/doctor/cases/{case_id}/mantieni-ricetta":{"get":{"tags":["doctor"],"summary":"Box","operationId":"box_api_doctor_cases__case_id__mantieni_ricetta_get","parameters":[{"name":"case_id","in":"path","required":true,"schema":{"type":"string","title":"Case Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/doctor/cases/{case_id}/mantieni-ricetta/{request_id}/letto":{"post":{"tags":["doctor"],"summary":"Mark Read","operationId":"mark_read_api_doctor_cases__case_id__mantieni_ricetta__request_id__letto_post","parameters":[{"name":"case_id","in":"path","required":true,"schema":{"type":"string","title":"Case Id"}},{"name":"request_id","in":"path","required":true,"schema":{"type":"string","title":"Request Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/doctor/cases/{case_id}/mantieni-ricetta/{request_id}/foto-scartate":{"post":{"tags":["doctor"],"summary":"Reject Photos","operationId":"reject_photos_api_doctor_cases__case_id__mantieni_ricetta__request_id__foto_scartate_post","parameters":[{"name":"case_id","in":"path","required":true,"schema":{"type":"string","title":"Case Id"}},{"name":"request_id","in":"path","required":true,"schema":{"type":"string","title":"Request Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RejectBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/ops/queue/count":{"get":{"summary":"Get Ops Queue Count","description":"Il pallino della sidebar su \"Pagamenti\": da evadere + rinnovi falliti.\nLa voce e' visibile al ruolo financial: il conteggio deve esserlo anche.","operationId":"get_ops_queue_count_api_ops_queue_count_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/ops/queue":{"get":{"summary":"Get Ops Queue","description":"Fetch Ops Dashboard counters and lists.\nLegacy support for OpsDashboard frontend.","operationId":"get_ops_queue_api_ops_queue_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/ops/cases/{case_id}/capture":{"post":{"summary":"Capture Case Payment","description":"Ops triggers payment capture for an Approved case.","operationId":"capture_case_payment_api_ops_cases__case_id__capture_post","parameters":[{"name":"case_id","in":"path","required":true,"schema":{"type":"string","title":"Case Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/ops/cases/{case_id}":{"get":{"summary":"Get Ops Case Detail","operationId":"get_ops_case_detail_api_ops_cases__case_id__get","parameters":[{"name":"case_id","in":"path","required":true,"schema":{"type":"string","title":"Case Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/ops/cases/{case_id}/referto-link":{"get":{"summary":"Get Ops Referto Link","description":"Il link al referto ESATTAMENTE come lo riceve il paziente.\n\nNon costruisce un'anteprima: chiama la stessa funzione che compone il link\ndentro l'SMS della cattura. Se un giorno cambia il messaggio, cambia anche\nquesto, perche' e' lo stesso codice. Un'anteprima costruita a parte\ndiverge al primo ritocco, e allora smette di dire la verita' proprio mentre\nla stai controllando.\n\nTorna anche se il referto non e' ancora stato consegnato: in quel caso il\nlink e' valido ma la pagina risponde 404, ed e' un'informazione utile\n(dice che la cattura non e' ancora avvenuta), non un errore.","operationId":"get_ops_referto_link_api_ops_cases__case_id__referto_link_get","parameters":[{"name":"case_id","in":"path","required":true,"schema":{"type":"string","title":"Case Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/ops/cases/{case_id}/send-back":{"post":{"summary":"Send Case Back To Doctor","operationId":"send_case_back_to_doctor_api_ops_cases__case_id__send_back_post","parameters":[{"name":"case_id","in":"path","required":true,"schema":{"type":"string","title":"Case Id"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Body"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/ops/cases/{case_id}/send-pharmacy":{"post":{"summary":"Send Case To Pharmacy","operationId":"send_case_to_pharmacy_api_ops_cases__case_id__send_pharmacy_post","parameters":[{"name":"case_id","in":"path","required":true,"schema":{"type":"string","title":"Case Id"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Body"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/ops/cases/{case_id}/confirm-ineligible":{"post":{"summary":"Confirm Ineligible","description":"Support confirms a PendingIneligibleReview case:\n1. Sets case_state = 'Ineligible'\n2. Syncs eligibility to 'Ineligible'\n3. Releases Stripe pre-auth\n4. Fires patient notifications (SMS + email + push)","operationId":"confirm_ineligible_api_ops_cases__case_id__confirm_ineligible_post","parameters":[{"name":"case_id","in":"path","required":true,"schema":{"type":"string","title":"Case Id"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Body"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/ops/subscriptions/{subscription_id}/force-now":{"post":{"summary":"Renewal Force Now","description":"Force the renewal to run NOW: charge + create the refill order + clinical\ngate + downstream events (refill_success SMS/email), immediately — instead of\nonly flagging the date for the next cron run. \"Forza Ora\" now does what it says.\n\nIdempotent: execute_refill skips if a refill is already in flight for the user\n(no double charge), and Stripe uses a per-day idempotency key.","operationId":"renewal_force_now_api_ops_subscriptions__subscription_id__force_now_post","parameters":[{"name":"subscription_id","in":"path","required":true,"schema":{"type":"string","title":"Subscription Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/ops/subscriptions/{subscription_id}/retry-now":{"post":{"summary":"Renewal Retry Now","description":"\"Riprova ora\" su un rinnovo fallito (tab Rinnovi Falliti): un tentativo,\ncon la stessa prudenza del cron, e senza scrivere al paziente se rifiuta.\n\nNato dal caso Mularoni (28/09/2026): PayPal aveva rifiutato \"hard\" il 17/09,\nritentato a mano 11 giorni dopo e' passato. Un rifiuto non e' per sempre, e\nil tentativo deve stare in un bottone, non in uno script.\n\n`capture_now=False` come ogni altro ritentativo dentro un ciclo di dunning\n(cron, G+3, ripartenza dopo cambio metodo): si autorizza e basta, l'incasso\nlo fa ops da \"Approvazione pagamenti\". Con PayPal la cattura differita non\nesiste e si incassa comunque.\n\nGuardie: la subscription deve essere in PAYMENT_FAILED; l'ultimo tentativo\nnon deve risultare riuscito o in elaborazione su Stripe e nessun ordine\nrefill deve essere in volo (previous_attempt_is_settled). Se qualcosa\nesplode dopo il passaggio ad ACTIVE la riga viene rimessa in\nPAYMENT_FAILED: altrimenti uscirebbe dal ciclo di dunning in silenzio.\n\nLa risposta dice sempre lo `status` finale: \"non eseguito\" non significa\n\"la banca ha rifiutato\" (puo' essere una ricetta scaduta, un ordine in\nvolo, un timeout), e la UI deve poterli distinguere.","operationId":"renewal_retry_now_api_ops_subscriptions__subscription_id__retry_now_post","parameters":[{"name":"subscription_id","in":"path","required":true,"schema":{"type":"string","title":"Subscription Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/ops/subscriptions/{subscription_id}/postpone":{"post":{"summary":"Renewal Postpone","description":"Shift next_refill_at forward by N days. Stripe authorization untouched.","operationId":"renewal_postpone_api_ops_subscriptions__subscription_id__postpone_post","parameters":[{"name":"subscription_id","in":"path","required":true,"schema":{"type":"string","title":"Subscription Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/_PostponeBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/ops/subscriptions/{subscription_id}/pause":{"post":{"summary":"Renewal Pause","description":"Pause a subscription. Mandatory duration: either N days or 'one_cycle'.\nStripe authorization is NOT touched — off-session consent is preserved.\nAuto-resume fires via /cron/renewals when paused_until elapses.","operationId":"renewal_pause_api_ops_subscriptions__subscription_id__pause_post","parameters":[{"name":"subscription_id","in":"path","required":true,"schema":{"type":"string","title":"Subscription Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/_PauseBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/ops/subscriptions/{subscription_id}/resume":{"post":{"summary":"Renewal Resume","description":"\"Riattiva\" (case page, reached from the \"Sospesi\" tab): the patient's \"Riprendi il percorso\" pressed by ops,\ne.g. after a phone call. Nothing is charged here: the renewal runs when its date comes, at the next morning's\ncron if the date has passed (see RESUME_SQL for how the cron treats it), and the patient hears nothing until then.\n\nAs \"Riprova ora\", it refuses a card the bank said not to retry: that would be the same retry a morning later.","operationId":"renewal_resume_api_ops_subscriptions__subscription_id__resume_post","parameters":[{"name":"subscription_id","in":"path","required":true,"schema":{"type":"string","title":"Subscription Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/ops/subscriptions/{subscription_id}/send-to-doctor":{"post":{"summary":"Renewal Send To Doctor","description":"Flip the user's case to QueuedForReview with renewal_needs_doctor=TRUE so the doctor queue\nsurfaces the renewal for manual re-review. Only from a rest state (SEND_TO_DOCTOR_FROM): 409\nwith the reason otherwise.","operationId":"renewal_send_to_doctor_api_ops_subscriptions__subscription_id__send_to_doctor_post","parameters":[{"name":"subscription_id","in":"path","required":true,"schema":{"type":"string","title":"Subscription Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/cron/valutazione":{"get":{"summary":"Cron Valutazione","operationId":"cron_valutazione_api_cron_valutazione_get","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/valutazione/prezzo":{"get":{"tags":["valutazione"],"summary":"Evaluation Price","description":"Public: the evaluation price from the catalog (admin Prodotti), read by pages, quiz and emails.","operationId":"evaluation_price_api_valutazione_prezzo_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/valutazione/coupon":{"post":{"tags":["valutazione"],"summary":"Coupon","description":"Public: what the code in the visitor's link is worth on the evaluation, for the pages to show. POST: a code never\nin a URL or an access log. A bad code answers {\"ok\": false} like an unknown one, never an error: a page shows nothing.","operationId":"coupon_api_valutazione_coupon_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CouponRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/valutazione/checkout":{"post":{"tags":["valutazione"],"summary":"Fee Checkout","description":"Refusals: 403 prova_richiesta (no proof on the evaluation: not this browser's, not the patient's yet);\n409 flusso_spento, gia_in_cura, valutazione_gia_in_corso, pagamento_in_preparazione\n(another checkout of the same evaluation is running: retry), valutazione_di_un_altro_paziente,\nvalutazione_rifatta (a newer evaluation of the person replaced it);\n422 minorenne, data_nascita_mancante, data_nascita_non_valida, codice_fiscale_non_valido,\nconsenso_mancante (no C18 tick recorded), sesso_mancante, sesso_discordante, codice_fiscale_sesso (the sex is\ndecided on the server from the SESSO answer, 23/11/2026); 422 gravidanza_mancante (an admitted woman who did not answer the two pregnancy questions: back to them); 409 percorso_donne_chiuso (a woman whose evaluation the switch «Capelli lei» did not let in; was: a woman before her path\nopens). The account is resolved like checkout/init (B5), and\nlike there the email typed after the code (C36) reaches the account only with its session.","operationId":"fee_checkout_api_valutazione_checkout_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FeeCheckoutRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/valutazione/confirm":{"post":{"tags":["valutazione"],"summary":"Fee Confirm","operationId":"fee_confirm_api_valutazione_confirm_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConfirmRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/valutazione/indirizzo":{"post":{"tags":["valutazione"],"summary":"Fee Address","description":"The address typed right after the payment: \"Inizia la cura\" ships there unless the patient changes it.","operationId":"fee_address_api_valutazione_indirizzo_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddressRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/valutazione/mine":{"get":{"tags":["valutazione"],"summary":"Mine","operationId":"mine_api_valutazione_mine_get","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/valutazione/mine/indirizzo":{"post":{"tags":["valutazione"],"summary":"Live Address","description":"«Consegna a casa inclusa» on the valutazione's page: the address the start ships to, saved now (the page has\nno payment secret, which /indirizzo asks). The patient is resolved like /mine (with the strict proof: the session\nor our link's token, else 401 session_required, 403 identity_mismatch). Refusals: 404 nessuna_valutazione,\n409 cura_gia_iniziata / valutazione_chiusa, 422 indirizzo_incompleto.","operationId":"live_address_api_valutazione_mine_indirizzo_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LiveAddressRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/valutazione/codice":{"post":{"tags":["valutazione"],"summary":"Send Code","description":"Only to the phone on file and only while a proposal waits: never to a number from the request.\nThe code is never in the response (staging's debug flag included): whoever knows a user id\nwould otherwise start that patient's therapy.","operationId":"send_code_api_valutazione_codice_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CodeRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/valutazione/codice/verifica":{"post":{"tags":["valutazione"],"summary":"Check Code","description":"The right code for the patient the page shows gives the same proof as our link: a short token\nwith purpose valutazione, for /start only, valid for this visit.","operationId":"check_code_api_valutazione_codice_verifica_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CodeCheck"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/valutazione/start":{"post":{"tags":["valutazione"],"summary":"Start","operationId":"start_api_valutazione_start_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StartRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/valutazione/start/confirm":{"post":{"tags":["valutazione"],"summary":"Start Confirm","description":"Right after the card step of \"Inizia la cura\": the authorization is recorded at once (the\nwebhook does the same, idempotently). Knowing the whole client secret is the proof.","operationId":"start_confirm_api_valutazione_start_confirm_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConfirmRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/valutazione/dubbi":{"post":{"tags":["valutazione"],"summary":"Doubts","description":"\"Hai dubbi sulla proposta?\": the patient's chat goes to the team (resolved like /mine).","operationId":"doubts_api_valutazione_dubbi_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DoubtsRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/ops/valutazioni":{"get":{"tags":["ops"],"summary":"Lists","operationId":"lists_api_ops_valutazioni_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/ops/valutazioni/count":{"get":{"tags":["ops"],"summary":"Count","description":"The sidebar dot (valutazione.ops_counts): refunds due + evaluations ready to contact + the red\nrows of the other lists, red when anything is late. Polled every 15 s by every open admin tab:\nlogged only when it fails, like /ops/queue/count.","operationId":"count_api_ops_valutazioni_count_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/ops/valutazioni/archivio":{"get":{"tags":["ops"],"summary":"Archive","operationId":"archive_api_ops_valutazioni_archivio_get","parameters":[{"name":"view","in":"query","required":false,"schema":{"type":"string","default":"tutte","title":"View"}},{"name":"q","in":"query","required":false,"schema":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}],"title":"Q"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/ops/valutazioni/{review_id}/rimborso":{"post":{"tags":["ops"],"summary":"Refund","operationId":"refund_api_ops_valutazioni__review_id__rimborso_post","parameters":[{"name":"review_id","in":"path","required":true,"schema":{"type":"string","title":"Review Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/ops/valutazioni/{review_id}/contatto":{"get":{"tags":["ops"],"summary":"Contact Block","description":"The \"Da contattare\" panel: the doctor's proposal (read only), his internal note, the patient's\ncontact preference, the call log with the contact rule, ops' own choices.","operationId":"contact_block_api_ops_valutazioni__review_id__contatto_get","parameters":[{"name":"review_id","in":"path","required":true,"schema":{"type":"string","title":"Review Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["ops"],"summary":"Save Contact Plan","operationId":"save_contact_plan_api_ops_valutazioni__review_id__contatto_post","parameters":[{"name":"review_id","in":"path","required":true,"schema":{"type":"string","title":"Review Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactPlanBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/ops/valutazioni/{review_id}/chiamate":{"post":{"tags":["ops"],"summary":"Record Call","description":"A call attempt by ops (the doctor never calls, decision of 25/10): the first unanswered one sends the SMS.","operationId":"record_call_api_ops_valutazioni__review_id__chiamate_post","parameters":[{"name":"review_id","in":"path","required":true,"schema":{"type":"string","title":"Review Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OpsCallBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/ops/valutazioni/{review_id}/anteprima":{"get":{"tags":["ops"],"summary":"Preview","description":"\"Anteprima per il paziente\": the payload of the patient's /api/valutazione/mine as it will be once\n\"Invia proposta\" is clicked now. Read only: nothing is written or sent. Same guard as /invia.","operationId":"preview_api_ops_valutazioni__review_id__anteprima_get","parameters":[{"name":"review_id","in":"path","required":true,"schema":{"type":"string","title":"Review Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/ops/valutazioni/{review_id}/invia":{"post":{"tags":["ops"],"summary":"Send Proposal","description":"\"Invia proposta\": the doctor's evaluation reaches the patient (today's SMS, email and notice).","operationId":"send_proposal_api_ops_valutazioni__review_id__invia_post","parameters":[{"name":"review_id","in":"path","required":true,"schema":{"type":"string","title":"Review Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/ops/valutazioni/{review_id}/rimanda":{"post":{"tags":["ops"],"summary":"Return To Doctor","description":"\"Rimanda al medico\" with a note for him: back to his queue; from the second time, Slack.","operationId":"return_to_doctor_api_ops_valutazioni__review_id__rimanda_post","parameters":[{"name":"review_id","in":"path","required":true,"schema":{"type":"string","title":"Review Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReturnBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/ops/valutazioni/{review_id}/nota-bozza":{"post":{"tags":["ops"],"summary":"Draft Team Note","description":"«Scrivi bozza con Gemini»: a draft of the note signed \"Il team N9VE\" from the doctor's text for the\npatient. Nothing is written or sent: ops corrects it in the panel and saves it with «Salva».","operationId":"draft_team_note_api_ops_valutazioni__review_id__nota_bozza_post","parameters":[{"name":"review_id","in":"path","required":true,"schema":{"type":"string","title":"Review Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/NoteDraftBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/q4/definition":{"get":{"tags":["quiz4"],"summary":"Definition","description":"The published version of the path; with `version_id`, a version of the path patients answered (published now\nor before), the one of an evaluation taken up again after a reload (/ripresa says it): never a draft.","operationId":"definition_api_q4_definition_get","parameters":[{"name":"path","in":"query","required":true,"schema":{"enum":["A","C"],"type":"string","title":"Path"}},{"name":"version_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Version Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/q4/lei":{"post":{"tags":["quiz4"],"summary":"Lei","description":"Her path or the waiting list (switch «Capelli lei», app/services/capelli_lei.py), asked by the page when she\nanswers «Sesso: Donna». Only the browser that started the evaluation may ask; the answer is decided once and kept.\nAny doubt (not hers, not found) is the waiting list: never an error in the middle of the quiz.","operationId":"lei_api_q4_lei_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeiBody"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/q4/answers":{"post":{"tags":["quiz4"],"summary":"Answers","operationId":"answers_api_q4_answers_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnswersBody"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/q4/outcome":{"post":{"tags":["quiz4"],"summary":"Outcome","description":"The result. Computed only for the evaluation's owner (the browser that started it, the one of its code step,\nthe patient's session, or the browser of the result email's key, which becomes an owner here). Anyone else with\nthe id (the link) reads a stored one, within the 30 days of the link, and never makes one (403 prova_richiesta).","operationId":"outcome_api_q4_outcome_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OutcomeBody"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/q4/email":{"post":{"tags":["quiz4"],"summary":"Email","description":"\"Vuoi il risultato anche per email?\": called before /outcome; the result email is scheduled now if the\nresult already exists, otherwise with the outcome. After the SMS code step (C36) only the browser that typed the\ncode (the quiz 4 proof /verify-otp sets) or the patient's own session changes it, 403 codice_richiesto\notherwise: the evaluation id is in the result link. Before it, only the browser that started the\nevaluation (403 prova_richiesta otherwise), which is marked as the one that typed the address, the only\none the code step confirms.","operationId":"email_api_q4_email_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailBody"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/q4/lista-attesa":{"post":{"tags":["quiz4"],"summary":"Waiting List","operationId":"waiting_list_api_q4_lista_attesa_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WaitlistBody"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/q4/ripresa":{"get":{"tags":["quiz4"],"summary":"Resume","description":"The quiz taken up again after a reload, or after the phone closed the tab while the person read the\nSMS: the answers, the stored result and, after the code step, the person (quiz4_store.resume_view).\nOnly to the browser that started the evaluation (its q4 owner cookie), the browser of its code step\n(the q4 proof) or the patient's session, never to the id alone (403 ripresa_non_permessa). An evaluation a newer\none replaced: 410 valutazione_rifatta, as its link (the page starts the quiz again).","operationId":"resume_api_q4_ripresa_get","parameters":[{"name":"evaluation_id","in":"query","required":true,"schema":{"type":"string","maxLength":64,"title":"Evaluation Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/q4/versions":{"get":{"tags":["admin","quiz4"],"summary":"Versions","operationId":"versions_api_admin_q4_versions_get","parameters":[{"name":"path","in":"query","required":false,"schema":{"anyOf":[{"enum":["A","C"],"type":"string"},{"type":"null"}],"title":"Path"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["admin","quiz4"],"summary":"Create","operationId":"create_api_admin_q4_versions_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DraftBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/q4/versions/{version_id}":{"get":{"tags":["admin","quiz4"],"summary":"Version","operationId":"version_api_admin_q4_versions__version_id__get","parameters":[{"name":"version_id","in":"path","required":true,"schema":{"type":"string","title":"Version Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["admin","quiz4"],"summary":"Update","operationId":"update_api_admin_q4_versions__version_id__put","parameters":[{"name":"version_id","in":"path","required":true,"schema":{"type":"string","title":"Version Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/q4/lei-v9":{"get":{"tags":["admin","quiz4"],"summary":"Lei V9","description":"The published version of path C with the women's part added (app/services/quiz4_lei.py), for the page to save as\na new draft with its usual call (POST /versions): reads only. The draft is then reviewed and published like any\nother, with the doctor's yes on the clinical texts (women plan, block C).","operationId":"lei_v9_api_admin_q4_lei_v9_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/q4/versions/{version_id}/try":{"post":{"tags":["admin","quiz4"],"summary":"Try Answers","description":"Which outcome and sentences a set of answers gets with this version, and through which rule.","operationId":"try_answers_api_admin_q4_versions__version_id__try_post","parameters":[{"name":"version_id","in":"path","required":true,"schema":{"type":"string","title":"Version Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TryBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/q4/controllo":{"get":{"tags":["admin","quiz4"],"summary":"Lock State","description":"Who edits the drafts now: {chi, mio, dal, ultima_modifica, fino_a, minuti}. The page asks every half minute.","operationId":"lock_state_api_admin_q4_controllo_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}},"post":{"tags":["admin","quiz4"],"summary":"Take Over","description":"\"Prendi il controllo\": the drafts are the caller's now; the one editing them before has their next save refused.","operationId":"take_over_api_admin_q4_controllo_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/q4/versions/{version_id}/confronto":{"get":{"tags":["admin","quiz4"],"summary":"Compare","description":"The draft's test people answered by the version published now on its path and by the draft: the ones whose result\nchanges. Every person in one call (the Pubblica page asks after each save).","operationId":"compare_api_admin_q4_versions__version_id__confronto_get","parameters":[{"name":"version_id","in":"path","required":true,"schema":{"type":"string","title":"Version Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/q4/versions/{version_id}/publish":{"post":{"tags":["admin","quiz4"],"summary":"Publish","operationId":"publish_api_admin_q4_versions__version_id__publish_post","parameters":[{"name":"version_id","in":"path","required":true,"schema":{"type":"string","title":"Version Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublishBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/q4/publish":{"post":{"tags":["admin","quiz4"],"summary":"Publish Many","description":"The drafts of both paths published together: all of them or none (one refusal rolls everything back).","operationId":"publish_many_api_admin_q4_publish_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublishManyBody"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/q4/ripristina":{"post":{"tags":["admin","quiz4"],"summary":"Restore","description":"Versions published before, live again at once (the undo of a publication): all of them or none.","operationId":"restore_api_admin_q4_ripristina_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RestoreBody"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/q4/versions/{version_id}/impatto":{"post":{"tags":["admin","quiz4"],"summary":"Impact","description":"What this version (a draft) would change for the people who answered its path in the last days: how many would get\nanother result, from which to which. Counts and result codes only, never an answer or a person.","operationId":"impact_api_admin_q4_versions__version_id__impatto_post","parameters":[{"name":"version_id","in":"path","required":true,"schema":{"type":"string","title":"Version Id"}},{"name":"giorni","in":"query","required":false,"schema":{"type":"integer","maximum":90,"minimum":1,"default":30,"title":"Giorni"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/q4/risultati/conteggi":{"get":{"tags":["admin","quiz4"],"summary":"Outcome Counts","description":"How many people got each result in the last days, by path (test runs left out).","operationId":"outcome_counts_api_admin_q4_risultati_conteggi_get","parameters":[{"name":"giorni","in":"query","required":false,"schema":{"type":"integer","maximum":90,"minimum":1,"default":30,"title":"Giorni"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/q4/versions/{version_id}/export":{"get":{"tags":["admin","quiz4"],"summary":"Export","description":"The definition as a file, to import it in the other environment (staging → prod) as a draft.","operationId":"export_api_admin_q4_versions__version_id__export_get","parameters":[{"name":"version_id","in":"path","required":true,"schema":{"type":"string","title":"Version Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/q4/evaluations":{"get":{"tags":["admin","quiz4"],"summary":"Evaluations","description":"Quiz 4 evaluations, newest first, paid or not: date, path, last question, outcome, paid. Never\nthe email, the phone or the name.","operationId":"evaluations_api_admin_q4_evaluations_get","parameters":[{"name":"path","in":"query","required":false,"schema":{"anyOf":[{"enum":["A","C"],"type":"string"},{"type":"null"}],"title":"Path"}},{"name":"date_from","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Date From"}},{"name":"date_to","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Date To"}},{"name":"reached","in":"query","required":false,"schema":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Reached"}},{"name":"paid","in":"query","required":false,"schema":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Paid"}},{"name":"outcome","in":"query","required":false,"schema":{"anyOf":[{"type":"string","maxLength":40},{"type":"null"}],"title":"Outcome"}},{"name":"has_email","in":"query","required":false,"schema":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Has Email"}},{"name":"hide_tests","in":"query","required":false,"schema":{"type":"boolean","default":true,"title":"Hide Tests"}},{"name":"page","in":"query","required":false,"schema":{"type":"integer","maximum":10000,"minimum":1,"default":1,"title":"Page"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/q4/evaluations/{evaluation_id}":{"get":{"tags":["admin","quiz4"],"summary":"Evaluation","description":"One evaluation: every question of its own version with the answers in words, the \"Altro\" words,\nthe consent times, the outcome with its rule, and the doctor's case when it became a paid valutazione.","operationId":"evaluation_api_admin_q4_evaluations__evaluation_id__get","parameters":[{"name":"evaluation_id","in":"path","required":true,"schema":{"type":"string","title":"Evaluation Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/login":{"post":{"tags":["admin_auth"],"summary":"Admin Login","description":"Unified Admin Login.\nVerifies credentials against admin_users table.\nSets HttpOnly 'admin_session' cookie containing a signed JWT.\nBlocks: suspended users, force_password_change users.","operationId":"admin_login_api_admin_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"}}}}}}},"/api/admin/logout":{"post":{"tags":["admin_auth"],"summary":"Admin Logout","operationId":"admin_logout_api_admin_logout_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/me":{"get":{"tags":["admin_auth"],"summary":"Get Current Admin Me","description":"Returns the current user's role by reading the httponly admin_session JWT server-side.","operationId":"get_current_admin_me_api_admin_me_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/system/pharmacies":{"get":{"tags":["admin_system"],"summary":"List Pharmacies","operationId":"list_pharmacies_api_admin_system_pharmacies_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/PharmacyResponse"},"type":"array","title":"Response List Pharmacies Api Admin System Pharmacies Get"}}}}}},"post":{"tags":["admin_system"],"summary":"Create Pharmacy","operationId":"create_pharmacy_api_admin_system_pharmacies_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PharmacyCreate"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PharmacyResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/system/pharmacies/{pharmacy_id}":{"put":{"tags":["admin_system"],"summary":"Update Pharmacy","operationId":"update_pharmacy_api_admin_system_pharmacies__pharmacy_id__put","parameters":[{"name":"pharmacy_id","in":"path","required":true,"schema":{"type":"string","title":"Pharmacy Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PharmacyCreate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["admin_system"],"summary":"Delete Pharmacy","operationId":"delete_pharmacy_api_admin_system_pharmacies__pharmacy_id__delete","parameters":[{"name":"pharmacy_id","in":"path","required":true,"schema":{"type":"string","title":"Pharmacy Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/system/users":{"get":{"tags":["admin_system"],"summary":"List Users","operationId":"list_users_api_admin_system_users_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/UserResponse"},"type":"array","title":"Response List Users Api Admin System Users Get"}}}}}},"post":{"tags":["admin_system"],"summary":"Create User","operationId":"create_user_api_admin_system_users_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateUserRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/system/users/{user_id}":{"delete":{"tags":["admin_system"],"summary":"Deactivate User","operationId":"deactivate_user_api_admin_system_users__user_id__delete","parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"string","title":"User Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["admin_system"],"summary":"Update User","operationId":"update_user_api_admin_system_users__user_id__put","parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"string","title":"User Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateUserRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/system/users/{user_id}/reactivate":{"post":{"tags":["admin_system"],"summary":"Reactivate User","description":"Re-enable a previously deactivated user.","operationId":"reactivate_user_api_admin_system_users__user_id__reactivate_post","parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"string","title":"User Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/system/users/{user_id}/permanent":{"delete":{"tags":["admin_system"],"summary":"Delete User Permanent","description":"Hard-delete a user from admin_users.\nClears all FK-referencing child rows first (safe cascade), then removes the user.\nCannot delete yourself.","operationId":"delete_user_permanent_api_admin_system_users__user_id__permanent_delete","parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"string","title":"User Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/system/users/{user_id}/reset-password":{"post":{"tags":["admin_system"],"summary":"Reset Password","operationId":"reset_password_api_admin_system_users__user_id__reset_password_post","parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"string","title":"User Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PasswordResetRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/system/pharmacy/trigger-pickup":{"post":{"tags":["admin_system"],"summary":"Trigger Pickup Manual","description":"Manually trigger a SendCloud pickup request.\nNormally done automatically by the Tue/Fri CRON (/cron/logistics).\nUse this when you need an on-demand pickup (e.g. urgent batch).\n\nGated by SENDCLOUD_AUTO_PICKUP_ENABLED — when off (default since 2026-05-16),\nthis endpoint refuses without touching Sendcloud.","operationId":"trigger_pickup_manual_api_admin_system_pharmacy_trigger_pickup_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/system/audit":{"get":{"tags":["admin_audit"],"summary":"Get Audit Logs","description":"Fetch global audit logs.\nRestricted to Admin role.","operationId":"get_audit_logs_api_admin_system_audit_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":100,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/AuditLogEntry"},"title":"Response Get Audit Logs Api Admin System Audit Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/system/patients":{"get":{"tags":["admin_patients"],"summary":"List Patients","operationId":"list_patients_api_admin_system_patients_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":50,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","default":0,"title":"Offset"}},{"name":"query","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Query"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/PatientSummary"},"title":"Response List Patients Api Admin System Patients Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/system/patients/{user_id}/details":{"get":{"tags":["admin_patients"],"summary":"Get Patient Details","operationId":"get_patient_details_api_admin_system_patients__user_id__details_get","parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"string","title":"User Id"}},{"name":"ledger_limit","in":"query","required":false,"schema":{"type":"integer","default":50,"title":"Ledger Limit"}},{"name":"audit_limit","in":"query","required":false,"schema":{"type":"integer","default":50,"title":"Audit Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/system/patients/{user_id}":{"delete":{"tags":["admin_patients"],"summary":"Delete Patient","description":"Soft Delete / PII Scrub.\nWe delete the user record from 'users' but KEEP 'medical_audit_log' for legal reasons.","operationId":"delete_patient_api_admin_system_patients__user_id__delete","parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"string","title":"User Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/system/patients/{user_id}/communications":{"get":{"tags":["admin_patients"],"summary":"Get Patient Communications","description":"Returns the full communication audit trail for a patient (SMS + Email).\nIncludes summary stats for the frontend stats cards.\nUsed by the admin patient detail page — Tab Comunicazioni.","operationId":"get_patient_communications_api_admin_system_patients__user_id__communications_get","parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"string","title":"User Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":100,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/system/registry/counters":{"get":{"tags":["admin_patients"],"summary":"Registry Counters","description":"Tab counters for the sticky header. Single round-trip, 3 sub-queries.\nCounters do NOT respect search filter — they always show absolute totals\nso the PM has the global picture even while filtering.","operationId":"registry_counters_api_admin_system_registry_counters_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/system/registry":{"get":{"tags":["admin_patients"],"summary":"Registry List","description":"Patient Registry list endpoint (N9V-147).\n\nTabs match PM's mental model:\n- paid: chi ha comprato davvero (soldi incassati, vedi _HA_COMPRATO)\n- email: anyone with email (split by login_source chip in the FE)\n- phone: phone-only signups (SMS marketing list)\n\nSub-filters within each tab help separate customers from prospects in the\nnon-paid tabs, which is the whole point: the PM needs to see WHO bought\ninside each segment.","operationId":"registry_list_api_admin_system_registry_get","parameters":[{"name":"tab","in":"query","required":false,"schema":{"type":"string","description":"paid | email | phone","default":"paid","title":"Tab"},"description":"paid | email | phone"},{"name":"sub_filter","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"purchased | not_purchased | quiz_complete | quiz_started","title":"Sub Filter"},"description":"purchased | not_purchased | quiz_complete | quiz_started"},{"name":"search","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Search"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":500,"minimum":1,"default":100,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/system/registry/export":{"get":{"tags":["admin_patients"],"summary":"Registry Export","description":"CSV export of the current registry view — used for marketing campaigns.","operationId":"registry_export_api_admin_system_registry_export_get","parameters":[{"name":"tab","in":"query","required":false,"schema":{"type":"string","default":"paid","title":"Tab"}},{"name":"sub_filter","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sub Filter"}},{"name":"search","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Search"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/cms/list/legal":{"get":{"summary":"List Legal Pages","operationId":"list_legal_pages_api_admin_cms_list_legal_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/cms/list/safety":{"get":{"summary":"List Safety Pages","operationId":"list_safety_pages_api_admin_cms_list_safety_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/cms/list/instructions":{"get":{"summary":"List Instructions Pages","description":"Product 'come si usa' pages. Convention key: instructions_<combo_id>.\nvalue is a structured InstructionsData JSON blob (steps + clips), not markdown.","operationId":"list_instructions_pages_api_admin_cms_list_instructions_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/cms/list/product_pages":{"get":{"summary":"List Product Pages","operationId":"list_product_pages_api_admin_cms_list_product_pages_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/cms/{key}":{"get":{"summary":"Get Cms Config","operationId":"get_cms_config_api_admin_cms__key__get","parameters":[{"name":"key","in":"path","required":true,"schema":{"type":"string","title":"Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"summary":"Delete Cms Config","description":"Delete a CMS configuration entry by its key.\nRequires admin role.","operationId":"delete_cms_config_api_admin_cms__key__delete","parameters":[{"name":"key","in":"path","required":true,"schema":{"type":"string","title":"Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"summary":"Update Cms Config","operationId":"update_cms_config_api_admin_cms__key__post","parameters":[{"name":"key","in":"path","required":true,"schema":{"type":"string","title":"Key"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CMSConfig"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/articles":{"get":{"summary":"List Articles","operationId":"list_articles_api_admin_articles_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ArticleResponse"},"type":"array","title":"Response List Articles Api Admin Articles Get"}}}}}},"post":{"summary":"Create Article","operationId":"create_article_api_admin_articles_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ArticleCreate"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ArticleResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/articles/draft-count":{"get":{"summary":"Draft Count","description":"Count of unpublished (draft) articles awaiting review — feeds the sidebar badge.","operationId":"draft_count_api_admin_articles_draft_count_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/articles/{article_id}":{"get":{"summary":"Get Article","operationId":"get_article_api_admin_articles__article_id__get","parameters":[{"name":"article_id","in":"path","required":true,"schema":{"type":"string","title":"Article Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ArticleResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"summary":"Update Article","operationId":"update_article_api_admin_articles__article_id__put","parameters":[{"name":"article_id","in":"path","required":true,"schema":{"type":"string","title":"Article Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ArticleUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ArticleResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"summary":"Delete Article","operationId":"delete_article_api_admin_articles__article_id__delete","parameters":[{"name":"article_id","in":"path","required":true,"schema":{"type":"string","title":"Article Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/seo/performance":{"get":{"summary":"Seo Performance","operationId":"seo_performance_api_admin_seo_performance_get","parameters":[{"name":"days","in":"query","required":false,"schema":{"type":"integer","default":90,"title":"Days"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/financial/dashboard":{"get":{"tags":["admin","financial"],"summary":"Get Financial Dashboard","description":"Immutable P&L — Single Source of Truth.\n\nRevenue figures use:\n  - pharmacy_share_snapshot_cents (locked at checkout, never reads live catalog)\n  - stripe_fee_cents from payment_ledger (real Stripe fee, not estimated)\n  - net revenue = total_amount_cents - refunded_amount_cents\n  - disputed_lost orders fully excluded\n\nVAT:\n  N9VE is an intermediary — VAT base = platform margin only (total - pharmacy_share).\n  Rate: 22% (standard IT digital service). Stored as vat_cents on orders at capture.\n\nReturns:\n  - Gross revenue (net of refunds + disputes)\n  - Pharmacy payouts (snapshot)\n  - Stripe fees (real from balance_transaction, falls back to stored estimate)\n  - N9VE platform margin (before VAT)\n  - VAT on platform margin (22%)\n  - Net N9VE income (after VAT)\n  - Shipping COGS\n  - Order counts: total, new_order, renewal","operationId":"get_financial_dashboard_api_admin_financial_dashboard_get","parameters":[{"name":"start_date","in":"query","required":false,"schema":{"type":"string","title":"Start Date"}},{"name":"end_date","in":"query","required":false,"schema":{"type":"string","title":"End Date"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/financial/pnl/overview":{"get":{"tags":["admin_financial_pnl"],"summary":"Get Overview","description":"KPI strip for the P&L page header. Compares current period vs previous of same length.","operationId":"get_overview_api_admin_financial_pnl_overview_get","parameters":[{"name":"period","in":"query","required":false,"schema":{"type":"string","pattern":"^(month|quarter|ytd|trailing_12m)$","default":"month","title":"Period"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OverviewKPI"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/financial/pnl/categories":{"get":{"tags":["admin_financial_pnl"],"summary":"List Categories","description":"Available expense categories for the 'Add line' modal.","operationId":"list_categories_api_admin_financial_pnl_categories_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ExpenseCategory"},"type":"array","title":"Response List Categories Api Admin Financial Pnl Categories Get"}}}}}}},"/api/admin/financial/pnl/months":{"get":{"tags":["admin_financial_pnl"],"summary":"Get Months","description":"Returns the last `months` of P&L data with OPEX line items embedded.","operationId":"get_months_api_admin_financial_pnl_months_get","parameters":[{"name":"months","in":"query","required":false,"schema":{"type":"integer","maximum":36,"minimum":1,"default":12,"title":"Months"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/MonthlyPnL"},"title":"Response Get Months Api Admin Financial Pnl Months Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/financial/pnl/expense":{"post":{"tags":["admin_financial_pnl"],"summary":"Create Expense","description":"Manual-entry endpoint for any cost. Source='manual'.\n\nIf is_recurring=True, creates BOTH a template row AND a concrete row for\nthe specified month. The cron will materialize future months from the\ntemplate each 1st-of-month.","operationId":"create_expense_api_admin_financial_pnl_expense_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateExpenseBody"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExpenseEntry"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/financial/pnl/expense/{entry_id}":{"patch":{"tags":["admin_financial_pnl"],"summary":"Update Expense","operationId":"update_expense_api_admin_financial_pnl_expense__entry_id__patch","parameters":[{"name":"entry_id","in":"path","required":true,"schema":{"type":"integer","title":"Entry Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateExpenseBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExpenseEntry"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["admin_financial_pnl"],"summary":"Delete Expense","operationId":"delete_expense_api_admin_financial_pnl_expense__entry_id__delete","parameters":[{"name":"entry_id","in":"path","required":true,"schema":{"type":"integer","title":"Entry Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/financial/pnl/expense/{entry_id}/invoice":{"post":{"tags":["admin_financial_pnl"],"summary":"Upload Invoice","description":"Attach a PDF/PNG/JPG invoice file to an expense entry.\n\nFiles go to the prescription R2 bucket (private, signed URLs only) under\nkey `expense-invoices/{entry_id}/{filename}`. Replaces existing invoice\nif present (overwrites the key).","operationId":"upload_invoice_api_admin_financial_pnl_expense__entry_id__invoice_post","parameters":[{"name":"entry_id","in":"path","required":true,"schema":{"type":"integer","title":"Entry Id"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_upload_invoice_api_admin_financial_pnl_expense__entry_id__invoice_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExpenseEntry"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["admin_financial_pnl"],"summary":"Download Invoice Url","description":"Returns a short-lived signed URL to download the invoice.","operationId":"download_invoice_url_api_admin_financial_pnl_expense__entry_id__invoice_get","parameters":[{"name":"entry_id","in":"path","required":true,"schema":{"type":"integer","title":"Entry Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["admin_financial_pnl"],"summary":"Delete Invoice","description":"Detach invoice from expense entry (file stays in R2 — soft delete).","operationId":"delete_invoice_api_admin_financial_pnl_expense__entry_id__invoice_delete","parameters":[{"name":"entry_id","in":"path","required":true,"schema":{"type":"integer","title":"Entry Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/financial/pnl/recurring/materialize":{"post":{"tags":["admin_financial_pnl"],"summary":"Materialize Recurring Admin","description":"Admin-triggered materialize (e.g. PM clicks 'crea voci ricorrenti del mese').","operationId":"materialize_recurring_admin_api_admin_financial_pnl_recurring_materialize_post","parameters":[{"name":"target_month","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"YYYY-MM, default current month","title":"Target Month"},"description":"YYYY-MM, default current month"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/marketing/metrics/unit-economics":{"get":{"tags":["admin_marketing_metrics"],"summary":"Get Unit Economics","description":"LTV / CAC / payback / ratio with PM-selected windows.\n\n- CAC window: rolling 30d / 90d / MTD / last month / QTD / YTD / all time\n- LTV method: trailing 6mo (default) / trailing 12mo / all time\n- Delta: CAC for prior period of same length, for trend tracking","operationId":"get_unit_economics_api_admin_marketing_metrics_unit_economics_get","parameters":[{"name":"cac_window","in":"query","required":false,"schema":{"type":"string","pattern":"^(30d|90d|mtd|last_month|qtd|ytd|all)$","default":"mtd","title":"Cac Window"}},{"name":"ltv_method","in":"query","required":false,"schema":{"type":"string","pattern":"^(trailing_6m|trailing_12m|all_time)$","default":"trailing_6m","title":"Ltv Method"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnitEconomics"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/marketing/metrics/cohort-retention":{"get":{"tags":["admin_marketing_metrics"],"summary":"Get Cohort Retention","description":"Cohort retention matrix.\n\nFor each acquisition cohort (month of first paid order), shows what % of\nthose customers placed a paid order in M+0 (always 100%), M+1, M+2, ...\n\nReturns most recent N cohorts. Only includes cohorts old enough to have\nAT LEAST one full month after the cohort — earlier cohorts only show M+0.","operationId":"get_cohort_retention_api_admin_marketing_metrics_cohort_retention_get","parameters":[{"name":"cohort_count","in":"query","required":false,"schema":{"type":"integer","maximum":24,"minimum":1,"description":"Number of most recent cohorts","default":6,"title":"Cohort Count"},"description":"Number of most recent cohorts"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/CohortRow"},"title":"Response Get Cohort Retention Api Admin Marketing Metrics Cohort Retention Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/marketing/metrics/channels":{"get":{"tags":["admin_marketing_metrics"],"summary":"Get Channels","description":"Acquisition channel breakdown for last 6 months.\n\nChannel inferred from user_attributions first-touch utm_source / fbclid / etc.\nSpend per channel uses expense_entries marketing categories (mkt_meta/tiktok/google).","operationId":"get_channels_api_admin_marketing_metrics_channels_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ChannelStat"},"type":"array","title":"Response Get Channels Api Admin Marketing Metrics Channels Get"}}}}}}},"/api/admin/marketing/metrics/channels/meta-breakdown":{"get":{"tags":["admin_marketing_metrics"],"summary":"Get Meta Breakdown","description":"Meta channel decomposed to campaign → adset → ad (real Meta names from\nattribution_resolved), with new customers + 180d revenue. Feeds the\nexpandable Meta row.","operationId":"get_meta_breakdown_api_admin_marketing_metrics_channels_meta_breakdown_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/MetaBreakdownRow"},"type":"array","title":"Response Get Meta Breakdown Api Admin Marketing Metrics Channels Meta Breakdown Get"}}}}}}},"/api/admin/marketing/metrics/channels/ads-scorecard":{"get":{"tags":["admin_marketing_metrics"],"summary":"Get Ads Scorecard","description":"Per-adset (or per-ad) kill/keep table for [from, to]: Meta delivery\n(spend/clicks, tie-out with Ads Manager) joined to OUR conversions\n(leads/paying — what Meta is blind to under the EU health block). Read-only.\n\nDefault level='adset': utm_term already carries the numeric adset id, so this\nresolves today. level='ad' lights up once ad URLs tag utm_content={{ad.id}}.","operationId":"get_ads_scorecard_api_admin_marketing_metrics_channels_ads_scorecard_get","parameters":[{"name":"from","in":"query","required":true,"schema":{"type":"string","description":"ISO date YYYY-MM-DD (inclusive)","title":"From"},"description":"ISO date YYYY-MM-DD (inclusive)"},{"name":"to","in":"query","required":true,"schema":{"type":"string","description":"ISO date YYYY-MM-DD (inclusive)","title":"To"},"description":"ISO date YYYY-MM-DD (inclusive)"},{"name":"level","in":"query","required":false,"schema":{"type":"string","pattern":"^(adset|ad)$","description":"'adset' (works today) | 'ad' (needs utm_content={{ad.id}})","default":"adset","title":"Level"},"description":"'adset' (works today) | 'ad' (needs utm_content={{ad.id}})"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdScorecard"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/marketing/metrics/channels/ads-scorecard/refresh":{"post":{"tags":["admin_marketing_metrics"],"summary":"Refresh Ads Attribution","description":"Resolve attribution for any not-yet-resolved leads/payers on demand (the\n'Aggiorna' button). Idempotent — only touches unresolved/stale users, so\nrepeat clicks are cheap (Meta object names are cached). Failures alert via\nSlack/Sentry inside reconcile().","operationId":"refresh_ads_attribution_api_admin_marketing_metrics_channels_ads_scorecard_refresh_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RefreshResult"}}}}}}},"/api/admin/marketing/metrics/at-risk":{"get":{"tags":["admin_marketing_metrics"],"summary":"Get At Risk","description":"Customers overdue for refill — the actionable retention list.\n\nLogic: last paid order is older than (cadence_days + grace_days = 14) AND\nsubscription status is ACTIVE (so they haven't cancelled). Sorted by\nLTV desc (most valuable losses first).","operationId":"get_at_risk_api_admin_marketing_metrics_at_risk_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/AtRiskCustomer"},"title":"Response Get At Risk Api Admin Marketing Metrics At Risk Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/marketing/metrics/churn-trend":{"get":{"tags":["admin_marketing_metrics"],"summary":"Get Churn Trend","description":"Monthly new customers vs churned customers (12-month window).\n\nChurned definition: a user whose last paid order is in month M AND\nthey have no paid order after M+3 months. So data lags by 3 months.","operationId":"get_churn_trend_api_admin_marketing_metrics_churn_trend_get","parameters":[{"name":"months","in":"query","required":false,"schema":{"type":"integer","maximum":24,"minimum":3,"default":12,"title":"Months"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ChurnPoint"},"title":"Response Get Churn Trend Api Admin Marketing Metrics Churn Trend Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/partners":{"get":{"tags":["admin","partners"],"summary":"List Partners","description":"All partners with their funnel + money summary (one row each).","operationId":"list_partners_api_admin_partners_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}},"post":{"tags":["admin","partners"],"summary":"Create Partner","operationId":"create_partner_api_admin_partners_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PartnerCreate"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/partners/{partner_id}":{"get":{"tags":["admin","partners"],"summary":"Get Partner","operationId":"get_partner_api_admin_partners__partner_id__get","parameters":[{"name":"partner_id","in":"path","required":true,"schema":{"type":"string","title":"Partner Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["admin","partners"],"summary":"Update Partner","operationId":"update_partner_api_admin_partners__partner_id__patch","parameters":[{"name":"partner_id","in":"path","required":true,"schema":{"type":"string","title":"Partner Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PartnerPatch"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["admin","partners"],"summary":"Delete Partner","description":"Permanently delete a partner and everything under it (codes, referrals,\nvouchers, accrued reward ledger). IRREVERSIBLE.\n\nTwo guards make this safe to expose in the UI:\n  1. **Typed-name confirmation** — the caller must pass the partner's exact\n     current name in `confirm_name`; a mismatch is a 409. This is the\n     server-side half of the \"type the name to delete\" dialog (protects\n     against a misfired call hitting the wrong partner).\n  2. **Money-history lock** — if the partner has any *paid* payout on record\n     (real euros left the bank), we refuse: that fiscal trail must not be\n     erasable from a UI button. Archive it (metti in pausa) instead.\n\nAccrued-but-unpaid rewards are wiped with the partner — that obligation only\never existed as bookkeeping against a partner the PM is deliberately deleting.\nAll child rows cascade via FK (partners → codes/referrals/ledger/payouts);\npartner_scan_events is keyed by the code string (no FK) so we clear it first.","operationId":"delete_partner_api_admin_partners__partner_id__delete","parameters":[{"name":"partner_id","in":"path","required":true,"schema":{"type":"string","title":"Partner Id"}},{"name":"confirm_name","in":"query","required":true,"schema":{"type":"string","title":"Confirm Name"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/partners/{partner_id}/codes":{"post":{"tags":["admin","partners"],"summary":"Create Code","operationId":"create_code_api_admin_partners__partner_id__codes_post","parameters":[{"name":"partner_id","in":"path","required":true,"schema":{"type":"string","title":"Partner Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CodeCreate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/partners/{partner_id}/payout":{"post":{"tags":["admin","partners"],"summary":"Settle Payout","description":"Mark the CURRENTLY-accrued rewards as paid, as a batch.\n\nGuard against a TOCTOU underpayment: the PM sees €X, transfers €X, clicks —\nif a reward accrued in between, we must NOT silently mark €X+€20 paid. We\nlock the accrued rows, verify their sum equals what the PM saw\n(expected_cents), and settle ONLY those rows (a concurrent accrual stays\naccrued for next month). 409 on mismatch → the PM re-reads the number.","operationId":"settle_payout_api_admin_partners__partner_id__payout_post","parameters":[{"name":"partner_id","in":"path","required":true,"schema":{"type":"string","title":"Partner Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SettlePayload"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/partners/{partner_id}/referrals/{referral_id}/void":{"post":{"tags":["admin","partners"],"summary":"Void Conversion","operationId":"void_conversion_api_admin_partners__partner_id__referrals__referral_id__void_post","parameters":[{"name":"partner_id","in":"path","required":true,"schema":{"type":"string","title":"Partner Id"}},{"name":"referral_id","in":"path","required":true,"schema":{"type":"string","title":"Referral Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/partners/{partner_id}/codes/{code}":{"patch":{"tags":["admin","partners"],"summary":"Patch Code","operationId":"patch_code_api_admin_partners__partner_id__codes__code__patch","parameters":[{"name":"partner_id","in":"path","required":true,"schema":{"type":"string","title":"Partner Id"}},{"name":"code","in":"path","required":true,"schema":{"type":"string","title":"Code"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CodePatch"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["admin","partners"],"summary":"Delete Code","description":"Delete a graphic/code. Must be DEACTIVATED first — deleting an active code\nwould break the printed sticker still in the wild. Any deactivated code can\nbe deleted (its money history lives on partner_reward_ledger by partner_id).","operationId":"delete_code_api_admin_partners__partner_id__codes__code__delete","parameters":[{"name":"partner_id","in":"path","required":true,"schema":{"type":"string","title":"Partner Id"}},{"name":"code","in":"path","required":true,"schema":{"type":"string","title":"Code"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/partners/{partner_id}/artwork":{"post":{"tags":["admin","partners"],"summary":"Upload Artwork","operationId":"upload_artwork_api_admin_partners__partner_id__artwork_post","parameters":[{"name":"partner_id","in":"path","required":true,"schema":{"type":"string","title":"Partner Id"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_upload_artwork_api_admin_partners__partner_id__artwork_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/partners/{partner_id}/onboarding-link":{"post":{"tags":["admin","partners"],"summary":"Gen Onboarding Link","operationId":"gen_onboarding_link_api_admin_partners__partner_id__onboarding_link_post","parameters":[{"name":"partner_id","in":"path","required":true,"schema":{"type":"string","title":"Partner Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/promo-codes":{"get":{"tags":["admin","promo"],"summary":"List Codes","operationId":"list_codes_api_admin_promo_codes_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}},"post":{"tags":["admin","promo"],"summary":"Create Code","operationId":"create_code_api_admin_promo_codes_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/app__api__admin__promo_codes__CodeCreate"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/promo-codes/{code}":{"patch":{"tags":["admin","promo"],"summary":"Patch Code","operationId":"patch_code_api_admin_promo_codes__code__patch","parameters":[{"name":"code","in":"path","required":true,"schema":{"type":"string","title":"Code"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/app__api__admin__promo_codes__CodePatch"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/promo-codes/{code}/redemptions":{"get":{"tags":["admin","promo"],"summary":"List Redemptions","operationId":"list_redemptions_api_admin_promo_codes__code__redemptions_get","parameters":[{"name":"code","in":"path","required":true,"schema":{"type":"string","title":"Code"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/promo-codes/settings/referral":{"put":{"tags":["admin","promo"],"summary":"Update Referral Settings","operationId":"update_referral_settings_api_admin_promo_codes_settings_referral_put","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReferralSettingsPatch"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/social-dm/rules":{"get":{"tags":["admin","social-dm"],"summary":"List Rules","operationId":"list_rules_api_admin_social_dm_rules_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}},"post":{"tags":["admin","social-dm"],"summary":"Create Rule","operationId":"create_rule_api_admin_social_dm_rules_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RulePayload"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/social-dm/rules/{rule_id}":{"patch":{"tags":["admin","social-dm"],"summary":"Patch Rule","operationId":"patch_rule_api_admin_social_dm_rules__rule_id__patch","parameters":[{"name":"rule_id","in":"path","required":true,"schema":{"type":"string","title":"Rule Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RulePatch"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["admin","social-dm"],"summary":"Delete Rule","operationId":"delete_rule_api_admin_social_dm_rules__rule_id__delete","parameters":[{"name":"rule_id","in":"path","required":true,"schema":{"type":"string","title":"Rule Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/social-dm/events":{"get":{"tags":["admin","social-dm"],"summary":"List Events","operationId":"list_events_api_admin_social_dm_events_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":100,"title":"Limit"}},{"name":"rule_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Rule Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/social-dm/enabled":{"get":{"tags":["admin","social-dm"],"summary":"Enabled","description":"Feature flag for the sidebar: the entry is hidden while SOCIAL_DM_ENABLED is off.","operationId":"enabled_api_admin_social_dm_enabled_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/social-dm/status":{"get":{"tags":["admin","social-dm"],"summary":"Worker Status","description":"Heartbeat of the n9-social worker + today's counters, for the page header.","operationId":"worker_status_api_admin_social_dm_status_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/social-dm/rules":{"get":{"tags":["social-dm"],"summary":"Active Rules","operationId":"active_rules_api_social_dm_rules_get","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/social-dm/seen":{"get":{"tags":["social-dm"],"summary":"Seen Comments","operationId":"seen_comments_api_social_dm_seen_get","parameters":[{"name":"days","in":"query","required":false,"schema":{"type":"integer","default":10,"title":"Days"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/social-dm/events":{"post":{"tags":["social-dm"],"summary":"Record Events","operationId":"record_events_api_social_dm_events_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EventsBatch"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/social-dm/heartbeat":{"post":{"tags":["social-dm"],"summary":"Heartbeat","operationId":"heartbeat_api_social_dm_heartbeat_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Heartbeat"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/medical/sla-stats":{"get":{"summary":"Get Medical Sla Stats","description":"Returns SLA statistics for the medical dashboard.\n\nAll metrics computed over the last 30 days unless noted.","operationId":"get_medical_sla_stats_api_admin_medical_sla_stats_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/comms":{"get":{"tags":["admin_comms"],"summary":"List Comms","operationId":"list_comms_api_admin_comms_get","parameters":[{"name":"channel","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"sms | email","title":"Channel"},"description":"sms | email"},{"name":"template_name","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Template Name"}},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"}},{"name":"since_hours","in":"query","required":false,"schema":{"type":"integer","maximum":720,"minimum":1,"default":72,"title":"Since Hours"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":1000,"minimum":1,"default":200,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/comms/by-user/{user_id}":{"get":{"tags":["admin_comms"],"summary":"List By User","description":"Unified per-user timeline, MERGED by provider_id so each physical email shows once.\n\nA marketing email is written to BOTH tables: communication_log holds the body but a\nstatic 'sent' status; marketing_sends holds the campaign + webhook status\n(delivered/opened/clicked) but no body. Both share a non-null provider_id (Postmark\nMessageID, unique per send). We enrich the log row with the campaign/status from the\nmatching marketing_sends row and drop the duplicate, so the admin sees ONE card with\nthe real body AND the real delivery status. Rows with a null provider_id, or present\nin only one table, pass through untouched — nothing is hidden.","operationId":"list_by_user_api_admin_comms_by_user__user_id__get","parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"string","title":"User Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":500,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/comms/by-case/{case_id}":{"get":{"tags":["admin_comms"],"summary":"List By Case","operationId":"list_by_case_api_admin_comms_by_case__case_id__get","parameters":[{"name":"case_id","in":"path","required":true,"schema":{"type":"string","title":"Case Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":500,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/comms/failed":{"get":{"tags":["admin_comms"],"summary":"List Failed","operationId":"list_failed_api_admin_comms_failed_get","parameters":[{"name":"since_hours","in":"query","required":false,"schema":{"type":"integer","maximum":168,"minimum":1,"default":24,"title":"Since Hours"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/comms/flood":{"get":{"tags":["admin_comms"],"summary":"Flood Check","description":"Users who received >= threshold messages of same template in window.","operationId":"flood_check_api_admin_comms_flood_get","parameters":[{"name":"threshold","in":"query","required":false,"schema":{"type":"integer","maximum":20,"minimum":2,"default":3,"title":"Threshold"}},{"name":"since_hours","in":"query","required":false,"schema":{"type":"integer","maximum":168,"minimum":1,"default":72,"title":"Since Hours"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/comms/stats":{"get":{"tags":["admin_comms"],"summary":"Stats","description":"Aggregate counts by channel + template over the window.","operationId":"stats_api_admin_comms_stats_get","parameters":[{"name":"since_hours","in":"query","required":false,"schema":{"type":"integer","maximum":168,"minimum":1,"default":24,"title":"Since Hours"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/comms/simulator/{user_id}":{"get":{"tags":["admin_comms"],"summary":"Simulator","description":"Returns: already-sent comms (last 30d) + projected upcoming sends (next 7d).","operationId":"simulator_api_admin_comms_simulator__user_id__get","parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"string","title":"User Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/comms/users":{"get":{"tags":["admin_comms"],"summary":"List Comm Users","description":"Master pane for the comms-log refactor (N9V-146).\n\nReturns the list of users that have *any* communication on file, sorted by\nmost-recent activity, with aggregated counters per channel for the window.\nUsers whose `email_bounced_at` is set surface a flag so the FE can render\nthe warning banner + unblock CTA.","operationId":"list_comm_users_api_admin_comms_users_get","parameters":[{"name":"search","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Match email/phone/first_name/last_name (ILIKE)","title":"Search"},"description":"Match email/phone/first_name/last_name (ILIKE)"},{"name":"since_days","in":"query","required":false,"schema":{"type":"integer","maximum":365,"minimum":1,"description":"Window for aggregated counts","default":30,"title":"Since Days"},"description":"Window for aggregated counts"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":500,"minimum":1,"default":100,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/comms/users/{user_id}/unblock-email":{"post":{"tags":["admin_comms"],"summary":"Unblock User Email","description":"Reset `users.email_bounced_at = NULL` so future EmailService.send_email()\nstops being suppressed for this user.\n\nUsed by the FE warning banner in the comms-log refactor (N9V-146) when an\nadmin verifies a bounce was transient or a temporary block was set\nintentionally (e.g. during testing) and now needs to be cleared.\n\nIdempotent: calling on a user already unblocked returns ok.\nAudit-logged via medical_audit_log so the action is traceable.","operationId":"unblock_user_email_api_admin_comms_users__user_id__unblock_email_post","parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"string","title":"User Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/comms/marketing":{"get":{"tags":["admin_comms"],"summary":"List Marketing Sends","description":"Marketing recovery sends timeline. Mirror of /comms but reads marketing_sends.\n\nSurfaces broadcast/T+2h/D1/D3/D7 campaigns alongside Postmark/Twilio\ndelivery state. Used by the Comms Log \"Marketing\" tab.","operationId":"list_marketing_sends_api_admin_comms_marketing_get","parameters":[{"name":"since_days","in":"query","required":false,"schema":{"type":"integer","maximum":90,"minimum":1,"default":7,"title":"Since Days"}},{"name":"channel","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"email | sms","title":"Channel"},"description":"email | sms"},{"name":"campaign_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Campaign Id"}},{"name":"only_errors","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Only Errors"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":1000,"minimum":1,"default":200,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/comms/catalog":{"get":{"tags":["admin_comms_catalog"],"summary":"Comms Catalog","description":"Return the full, auto-discovered catalog grouped into curated sections.","operationId":"comms_catalog_api_admin_comms_catalog_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Comms Catalog Api Admin Comms Catalog Get"}}}}}}},"/api/admin/recovery/create-order":{"post":{"tags":["admin_recovery"],"summary":"Create Recovery Order","description":"Create a pending_payment order + magic link so the patient can pay without\nre-doing quiz or shipping. Reuses CheckoutService.process_checkout so the\nStripe customer/intent path is identical to the regular funnel — including\n`setup_future_usage: off_session` for card and PayPal billing-agreement\nvia /checkout/paypal-setup once the patient lands on /checkout.\n\nShipping is intentionally a placeholder marked `recovery_placeholder=true`;\nthe admin sets the real address (collected out-of-band, e.g. WhatsApp) after\nthe payment, before it ships, from the ops order page (\"Correggi indirizzo\":\nPOST /api/admin/ops/orders/{order_id}/shipping-address, audited).\n/checkout/update-shipping refuses a paid order (B5).","operationId":"create_recovery_order_api_admin_recovery_create_order_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateRecoveryOrderRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/marketing/counters":{"get":{"tags":["admin_marketing"],"summary":"Export Counters","description":"Quick counter ELIGIBLE per ogni segmento. Usato da U1 dashboard.\n\nRitorna il numero di utenti CONTATTABILI (= con first_name + contatto\nparsabile), non il totale grezzo del segmento. Per il breakdown\nesclusi-vs-eligible usa /counters/breakdown.","operationId":"export_counters_api_admin_marketing_counters_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/marketing/counters/breakdown":{"get":{"tags":["admin_marketing"],"summary":"Export Counters Breakdown","description":"Counter dettagliato per segmento: eligible + esclusi con motivo.\n\nRisposta per ogni segmento:\n    total           — match del segmento grezzo (no filtri eligibility)\n    eligible        — contatto + nome OK → sendable\n    missing_name    — contatto OK, first_name vuoto/NULL\n    missing_contact — solo per email_recoverable: nome OK ma email non\n                      parsabile dal quiz JSON\n    missing_both    — né nome né contatto parsabile (solo email_recoverable)\n\nGaranzia: total = eligible + missing_name + missing_contact + missing_both.","operationId":"export_counters_breakdown_api_admin_marketing_counters_breakdown_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/marketing/excluded":{"get":{"tags":["admin_marketing"],"summary":"List Excluded","description":"Lista utenti esclusi da un segmento per uno specifico motivo.\n\nUsato dal modal \"Vedi esclusi\" nel builder per triage manuale (es:\ncompletare nome via admin user edit, e poi rientrano nell'audience).","operationId":"list_excluded_api_admin_marketing_excluded_get","parameters":[{"name":"segment","in":"query","required":true,"schema":{"type":"string","description":"email_full|email_recoverable|phone_stub","title":"Segment"},"description":"email_full|email_recoverable|phone_stub"},{"name":"reason","in":"query","required":true,"schema":{"type":"string","description":"missing_name|missing_contact|missing_both","title":"Reason"},"description":"missing_name|missing_contact|missing_both"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":1000,"minimum":1,"default":200,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/marketing/export":{"get":{"tags":["admin_marketing"],"summary":"Export Segment","description":"Lista utenti del segmento + dati di arricchimento.\n\nDefault JSON (FE consume); format=csv per download manuale.","operationId":"export_segment_api_admin_marketing_export_get","parameters":[{"name":"segment","in":"query","required":false,"schema":{"type":"string","description":"paid|email_full|email_recoverable|phone_stub","default":"email_full","title":"Segment"},"description":"paid|email_full|email_recoverable|phone_stub"},{"name":"format","in":"query","required":false,"schema":{"type":"string","description":"json|csv","default":"json","title":"Format"},"description":"json|csv"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":10000,"minimum":1,"default":5000,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/marketing/preview":{"get":{"tags":["admin_marketing"],"summary":"Preview Recipient Email","description":"Render preview email Luna per uno specifico destinatario.\n\nUsato da U2 builder + U3 side-panel: vedi esattamente cosa riceverà\nquel utente prima del send. Genera anche un magic link reale (tagged\n'preview') che il PM può cliccare per testare il flow end-to-end.","operationId":"preview_recipient_email_api_admin_marketing_preview_get","parameters":[{"name":"user_id","in":"query","required":true,"schema":{"type":"string","minLength":4,"title":"User Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/marketing/send":{"post":{"tags":["admin_marketing"],"summary":"Send Bulk","description":"N9V-168 [M8] — bulk send recovery campaign.\n\nWorkflow:\n1. Resolve segment → list[user_id, ...]\n2. Insert/upsert marketing_campaigns row\n3. Build recipients (with product_name_hint, evaluation_id from latest)\n4. send_bulk_recovery() → suppression check + idempotent INSERT + render + send\n\nDefault `dry_run=true` — caller must explicit set False per real send.\n`is_smoke=true` overrides recipients with `smoke_recipients` (3 nostre).","operationId":"send_bulk_api_admin_marketing_send_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkSendBody"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/marketing/campaigns/{campaign_id}":{"get":{"tags":["admin_marketing"],"summary":"Get Campaign Detail","description":"Detail per campagna: KPI + lista marketing_sends per drill-down U5.","operationId":"get_campaign_detail_api_admin_marketing_campaigns__campaign_id__get","parameters":[{"name":"campaign_id","in":"path","required":true,"schema":{"type":"string","title":"Campaign Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":5000,"minimum":1,"default":500,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/marketing/campaigns":{"get":{"tags":["admin_marketing"],"summary":"List Campaigns","description":"List campagne marketing (per dashboard U1).","operationId":"list_campaigns_api_admin_marketing_campaigns_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/marketing/suppressions":{"get":{"tags":["admin_marketing"],"summary":"List Suppressions","description":"List marketing_suppressions con filtri (per U6 page).","operationId":"list_suppressions_api_admin_marketing_suppressions_get","parameters":[{"name":"reason","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reason"}},{"name":"channel","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Channel"}},{"name":"search","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Search"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":1000,"minimum":1,"default":200,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["admin_marketing"],"summary":"Add Suppression","description":"Manually add a marketing suppression (admin-initiated block).\n\nN9V-196 [U6.3] follow-up — implements the \"Aggiungi blocco manuale\" flow.\nAt least one of user_id/email/phone must be present. Idempotent: if an\nidentical (user_id|email|phone, channel) suppression already exists,\nreturns the existing row instead of creating a duplicate.","operationId":"add_suppression_api_admin_marketing_suppressions_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/_AddSuppressionBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/marketing/suppressions/{suppression_id}":{"delete":{"tags":["admin_marketing"],"summary":"Remove Suppression","description":"Remove a marketing suppression (re-enable a user for recovery campaigns).\n\nN9V-196 [U6.2] follow-up — implements the \"Rimuovi blocco\" action that was\npreviously stubbed in the admin UI. Audit-logged via communication_log with\ntemplate_name='suppression_removed' so the action is traceable.\n\nSafety:\n- Returns 404 if the row doesn't exist (or already removed).\n- admin_id is recorded in communication_log so we know who unblocked whom.\n- Optional `note` (e.g. \"user called support requesting reactivation\") is\n  stored in metadata for context.\n- Slack notification to #ops-audit on every remove (best-effort).","operationId":"remove_suppression_api_admin_marketing_suppressions__suppression_id__delete","parameters":[{"name":"suppression_id","in":"path","required":true,"schema":{"type":"integer","title":"Suppression Id"}},{"name":"note","in":"query","required":false,"schema":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}],"title":"Note"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/marketing/audit/summary":{"get":{"tags":["admin_marketing_audit"],"summary":"Audit Summary","description":"Counters delivered/bounced/opened/clicked per channel nel range.","operationId":"audit_summary_api_admin_marketing_audit_summary_get","parameters":[{"name":"from_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"description":"Default: 7 giorni fa","title":"From Date"},"description":"Default: 7 giorni fa"},{"name":"to_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"description":"Default: oggi","title":"To Date"},"description":"Default: oggi"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SummaryResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/marketing/audit/recent":{"get":{"tags":["admin_marketing_audit"],"summary":"Audit Recent","description":"Ultimi N invii marketing, ordinati per sent_at DESC (NULL last).\n\nFiltri:\n- channel: email/sms\n- status: bounced (error_message LIKE bounce), errored (other), delivered, pending (sent_at NULL)\n- include_smoke: di default le righe virtual (is_smoke=true) sono nascoste","operationId":"audit_recent_api_admin_marketing_audit_recent_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":500,"minimum":1,"default":50,"title":"Limit"}},{"name":"channel","in":"query","required":false,"schema":{"anyOf":[{"enum":["email","sms"],"type":"string"},{"type":"null"}],"title":"Channel"}},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"enum":["all","delivered","bounced","errored","pending"],"type":"string"},{"type":"null"}],"default":"all","title":"Status"}},{"name":"include_smoke","in":"query","required":false,"schema":{"type":"boolean","description":"Default false: nascondi virtual/smoke rows","default":false,"title":"Include Smoke"},"description":"Default false: nascondi virtual/smoke rows"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/RecentTouchRow"},"title":"Response Audit Recent Api Admin Marketing Audit Recent Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/marketing/audit/preview":{"get":{"tags":["admin_marketing_audit"],"summary":"Audit Preview","description":"Anteprima LIVE del messaggio recovery per un utente reale.\n\nRenderizza ESATTAMENTE i template correnti (unica fonte di verità:\napp/services/notifications/{email,sms}_templates.py) così l'anteprima non\npuò driftare rispetto a ciò che il cron invia davvero. Usa il vero\nfirst_name dell'utente e un link SEGNAPOSTO (nessun token reale generato).\n\nRouting canali per step (mirror dei cron reali):\n  - d0 (recovery_luna_v1): email + sms\n  - d1 (recovery_quiz_t24h): SOLO email\n  - d3 (recovery_quiz_t72h / _sms): email + sms\n  - d7 (recovery_quiz_d7): SOLO email","operationId":"audit_preview_api_admin_marketing_audit_preview_get","parameters":[{"name":"step","in":"query","required":true,"schema":{"enum":["d0","d1","d3","d7"],"type":"string","title":"Step"}},{"name":"channel","in":"query","required":true,"schema":{"enum":["email","sms"],"type":"string","title":"Channel"}},{"name":"user_id","in":"query","required":true,"schema":{"type":"string","minLength":1,"title":"User Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PreviewResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/marketing/audit/upcoming":{"get":{"tags":["admin_marketing_audit"],"summary":"Audit Upcoming","description":"Command center: proiezione dei prossimi touch recovery nei prossimi 7 giorni.\n\nPer ogni utente ancora nel flusso (con email o phone, non convertito, non\nsoppresso, con quiz-abandon o freeze) calcoliamo il PROSSIMO touch reale in\nbase a quanti touch ha già ricevuto e quando è stato l'ultimo, usando gli\norari REALI dei cron (GHA workflows cron-recovery-*.yml):\n\n  - D0 (T+2h): eval_started + 2h → prossimo run T+2h (ogni ~2h, 08-18 UTC)\n  - D1 (T+24h): last_touch + 24h → run giornaliero 09:30 UTC (SOLO email)\n  - D3 (T+72h): last_touch + 48h → email 09:30 UTC + SMS 13:00 UTC\n  - D7 (ultimo): last_touch + 96h → run giornaliero 10:00 UTC (SOLO email)\n\nOgni utente contribuisce UN solo touch (il suo prossimo). D3 conta sia email\nche SMS se l'utente ha un telefono. È una proiezione (\"conta stimata\"): scende\nse gli utenti pagano/si sopprimono prima del fire.","operationId":"audit_upcoming_api_admin_marketing_audit_upcoming_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpcomingResponse"}}}}}}},"/api/admin/marketing/audit/pipeline":{"get":{"tags":["admin_marketing_audit"],"summary":"Audit Pipeline","description":"Conta utenti in ciascuno stage del flow recovery D0/D1/D3/D7.\n\nLogica: ogni utente \"marketing-eligible\" (ha email, non escluso, non convertito,\nnon admin) viene buckettizzato per numero di touch reali ricevuti (is_smoke=false,\nsent_at non null). Gli utenti freezati per il broadcast Monday rientrano nel\nbucket D0 perché non hanno ancora ricevuto touch reali.","operationId":"audit_pipeline_api_admin_marketing_audit_pipeline_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PipelineSummary"}}}}}}},"/api/admin/marketing/audit/segment/{kind}":{"get":{"tags":["admin_marketing_audit"],"summary":"Audit Segment","description":"Dettaglio utenti in ciascuno step del flow recovery (D0/D1/D3/D7).\n\nBucket = numero di touch reali (is_smoke=false, sent_at non null) ricevuti.\n- d0 = 0 touch reali (in attesa del primo invio: broadcast Monday o T+2h)\n- d1 = 1 touch reale (prossimo D1 a T+24h)\n- d3 = 2 touch reali (prossimo D3 a T+72h)\n- d7 = 3 touch reali (prossimo D7 a +7gg, last touch)","operationId":"audit_segment_api_admin_marketing_audit_segment__kind__get","parameters":[{"name":"kind","in":"path","required":true,"schema":{"enum":["d0","d1","d3","d7"],"type":"string","title":"Kind"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SegmentResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/marketing/users/{user_id}/timeline":{"get":{"tags":["admin_marketing_audit"],"summary":"User Timeline","description":"Drill-down singolo utente: profilo + tutte le touch marketing in ordine cronologico.","operationId":"user_timeline_api_admin_marketing_users__user_id__timeline_get","parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"string","title":"User Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserTimelineResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/ops/orders":{"get":{"tags":["admin","ops","orders"],"summary":"List Orders","description":"Flat list of orders, newest first. One row per order — see app/api/admin/orders.py docstring.\n\nStatus vs shipped_at: orders.status moves abandoned → authorized → approved → paid.\nShipping is recorded by TWO paths that disagree on status:\n  - manual pharmacy ship (app/api/pharmacy/case_actions.py) stamps shipped_at and\n    leaves status='paid';\n  - the Sendcloud webhook (app/api/sendcloud_webhook.py) sets status='shipped' AND\n    stamps shipped_at, then flips it to 'delivered' on the delivery event.\nSo a fulfilled order may be status 'paid', 'shipped' OR 'delivered'. \"Pagati\" must\ntherefore include all of them (callers pass paid,approved,shipped,delivered) — otherwise\ndelivered orders silently vanish from the surface — and \"shipped vs not\" must split on\nshipped_at presence, never on status alone (delivered orders keep their shipped_at).","operationId":"list_orders_api_admin_ops_orders_get","parameters":[{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by orders.status (comma-separated allowed)","title":"Status"},"description":"Filter by orders.status (comma-separated allowed)"},{"name":"payment_type","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by orders.payment_type","title":"Payment Type"},"description":"Filter by orders.payment_type"},{"name":"q","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Search patient email/name OR order_number","title":"Q"},"description":"Search patient email/name OR order_number"},{"name":"days","in":"query","required":false,"schema":{"anyOf":[{"type":"integer","maximum":365,"minimum":1},{"type":"null"}],"description":"Limit to last N days (applied on shipped_at when shipping=shipped, else on created_at)","title":"Days"},"description":"Limit to last N days (applied on shipped_at when shipping=shipped, else on created_at)"},{"name":"shipping","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"shipped|not_shipped — filter by orders.shipped_at presence","title":"Shipping"},"description":"shipped|not_shipped — filter by orders.shipped_at presence"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response List Orders Api Admin Ops Orders Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/ops/orders/{order_id}":{"get":{"tags":["admin","ops","orders"],"summary":"Get Order Detail","description":"Single-order detail with patient context (other orders + active case) and trail.","operationId":"get_order_detail_api_admin_ops_orders__order_id__get","parameters":[{"name":"order_id","in":"path","required":true,"schema":{"type":"string","title":"Order Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Get Order Detail Api Admin Ops Orders  Order Id  Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/ops/orders/{order_id}/notify-shipped":{"post":{"tags":["admin","ops","orders"],"summary":"Notify Shipped","description":"Fire the 'spedito' email+SMS for an order, at most once per order.\n\nIdempotent via orders.shipped_notified_at: a second call is a no-op. The\ntracking link is included only if known (an order whose webhook never\narrived has no tracking_url — we still notify, just without the link).\nSets the marker so the webhook path won't later double-send.","operationId":"notify_shipped_api_admin_ops_orders__order_id__notify_shipped_post","parameters":[{"name":"order_id","in":"path","required":true,"schema":{"type":"string","title":"Order Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Notify Shipped Api Admin Ops Orders  Order Id  Notify Shipped Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/ops/orders/{order_id}/shipping-address":{"post":{"tags":["admin","ops","orders"],"summary":"Set Shipping Address","description":"Refusals: 404 order_not_found; 422 cap_non_valido; 409 ordine_gia_spedito (shipped, booked\nwith Sendcloud or a parcel made), ordine_non_pagato (before the payment the patient edits it at\nthe checkout), ritiro_in_farmacia (nothing ships), caso_mancante (no case to audit on).\nRenewals copy the address of the latest order, so they inherit the correction.","operationId":"set_shipping_address_api_admin_ops_orders__order_id__shipping_address_post","parameters":[{"name":"order_id","in":"path","required":true,"schema":{"type":"string","title":"Order Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ShippingAddressBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Set Shipping Address Api Admin Ops Orders  Order Id  Shipping Address Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/marketing/experiments":{"get":{"tags":["admin","experiments"],"summary":"Overview","operationId":"overview_api_admin_marketing_experiments_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}},"post":{"tags":["admin","experiments"],"summary":"Create","operationId":"create_api_admin_marketing_experiments_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExperimentPayload"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/marketing/experiments/summary":{"get":{"tags":["admin","experiments"],"summary":"Summary","description":"Everything in one document for principalg: definitions, sources, freshness, numbers.","operationId":"summary_api_admin_marketing_experiments_summary_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/marketing/experiments/archive":{"get":{"tags":["admin","experiments"],"summary":"Archive","description":"Closed experiments and the decisions taken before this page existed, newest first.","operationId":"archive_api_admin_marketing_experiments_archive_get","parameters":[{"name":"q","in":"query","required":false,"schema":{"anyOf":[{"type":"string","maxLength":80},{"type":"null"}],"title":"Q"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/marketing/experiments/{experiment_id}":{"get":{"tags":["admin","experiments"],"summary":"Detail","operationId":"detail_api_admin_marketing_experiments__experiment_id__get","parameters":[{"name":"experiment_id","in":"path","required":true,"schema":{"type":"string","title":"Experiment Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["admin","experiments"],"summary":"Update","operationId":"update_api_admin_marketing_experiments__experiment_id__patch","parameters":[{"name":"experiment_id","in":"path","required":true,"schema":{"type":"string","title":"Experiment Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExperimentPayload"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/marketing/experiments/{experiment_id}/launch":{"post":{"tags":["admin","experiments"],"summary":"Launch","operationId":"launch_api_admin_marketing_experiments__experiment_id__launch_post","parameters":[{"name":"experiment_id","in":"path","required":true,"schema":{"type":"string","title":"Experiment Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/marketing/experiments/{experiment_id}/inputs":{"post":{"tags":["admin","experiments"],"summary":"Add Input","operationId":"add_input_api_admin_marketing_experiments__experiment_id__inputs_post","parameters":[{"name":"experiment_id","in":"path","required":true,"schema":{"type":"string","title":"Experiment Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InputPayload"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/marketing/experiments/{experiment_id}/ack":{"post":{"tags":["admin","experiments"],"summary":"Acknowledge","description":"\"Visto, continuo perché...\": the alert stays quiet for 48 hours, the reason goes in the register.","operationId":"acknowledge_api_admin_marketing_experiments__experiment_id__ack_post","parameters":[{"name":"experiment_id","in":"path","required":true,"schema":{"type":"string","title":"Experiment Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AckPayload"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/marketing/experiments/{experiment_id}/notes":{"post":{"tags":["admin","experiments"],"summary":"Add Note","operationId":"add_note_api_admin_marketing_experiments__experiment_id__notes_post","parameters":[{"name":"experiment_id","in":"path","required":true,"schema":{"type":"string","title":"Experiment Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotePayload"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/marketing/experiments/{experiment_id}/decide":{"post":{"tags":["admin","experiments"],"summary":"Decide","description":"Close an experiment with the outcome its rule gives, or another one with a written reason.\n\nStep 1 (data check) and step 2 (the rule) are recomputed here, never trusted from the page.","operationId":"decide_api_admin_marketing_experiments__experiment_id__decide_post","parameters":[{"name":"experiment_id","in":"path","required":true,"schema":{"type":"string","title":"Experiment Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DecisionPayload"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/marketing/experiments/recompute":{"post":{"tags":["admin","experiments"],"summary":"Recompute","description":"The \"Ricalcola\" button: the same run as the morning one, alerts included, after the\nresponse (Meta and PostHog can take a minute). The page waits for a new run to appear.","operationId":"recompute_api_admin_marketing_experiments_recompute_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/marketing/switches":{"get":{"tags":["admin","switches"],"summary":"List Switches","operationId":"list_switches_api_admin_marketing_switches_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/marketing/switches/{switch_key}":{"patch":{"tags":["admin","switches"],"summary":"Change Switch","operationId":"change_switch_api_admin_marketing_switches__switch_key__patch","parameters":[{"name":"switch_key","in":"path","required":true,"schema":{"type":"string","title":"Switch Key"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SwitchChange"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/marketing/switches/{switch_key}/members":{"post":{"tags":["admin","switches"],"summary":"Add Member","description":"Mantieni attiva la ricetta: put a patient in the list of \"Solo noi\" (always in, at any percentage).","operationId":"add_member_api_admin_marketing_switches__switch_key__members_post","parameters":[{"name":"switch_key","in":"path","required":true,"schema":{"type":"string","title":"Switch Key"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MemberAdd"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/marketing/switches/{switch_key}/members/{user_id}":{"delete":{"tags":["admin","switches"],"summary":"Remove Member","operationId":"remove_member_api_admin_marketing_switches__switch_key__members__user_id__delete","parameters":[{"name":"switch_key","in":"path","required":true,"schema":{"type":"string","title":"Switch Key"}},{"name":"user_id","in":"path","required":true,"schema":{"type":"string","title":"User Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/invitations":{"post":{"tags":["invitations"],"summary":"Create Invitation","description":"Admin creates an invitation for a new backoffice user.\nSends a Postmark email with a 72h JWT link.","operationId":"create_invitation_api_admin_invitations_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateInviteRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/invitations/validate":{"get":{"tags":["invitations"],"summary":"Validate Invite Token","description":"Frontend calls this to check a token before showing the password form.\nReturns the email and role encoded in the token.","operationId":"validate_invite_token_api_admin_invitations_validate_get","parameters":[{"name":"token","in":"query","required":true,"schema":{"type":"string","title":"Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/invitations/claim":{"post":{"tags":["invitations"],"summary":"Claim Invite","description":"User sets their password and completes account creation.\nImmediately issues a session cookie (gated by status='registered').","operationId":"claim_invite_api_admin_invitations_claim_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClaimInviteRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/auth/forgot-password":{"post":{"tags":["password_reset"],"summary":"Forgot Password","description":"Issues a 1h reset link via Postmark (silent no-op if email not found — anti-enumeration).","operationId":"forgot_password_api_auth_forgot_password_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForgotPasswordRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/auth/reset-password":{"post":{"tags":["password_reset"],"summary":"Reset Password","description":"Validates reset token and sets new password. Token is single-use.","operationId":"reset_password_api_auth_reset_password_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResetPasswordRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/users/{user_id}/force-reset-password":{"post":{"tags":["password_reset"],"summary":"Admin Force Reset","description":"Admin triggers a reset email for any user.","operationId":"admin_force_reset_api_admin_users__user_id__force_reset_password_post","parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"string","title":"User Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/onboarding/complete":{"post":{"tags":["password_reset"],"summary":"Complete Onboarding","description":"Called by the user themselves at the end of the Onboarding Wizard.\nPromotes their own status from 'registered' → 'active', unlocking all routes.\nUses RequireRoleOnboarding to bypass the 'registered' status gate that\nrequire_*_role would enforce (chicken-and-egg).","operationId":"complete_onboarding_api_admin_onboarding_complete_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/users/create":{"post":{"tags":["password_reset"],"summary":"Create Manual User","description":"Admin creates a user manually with a temp password.\nSets force_password_change=TRUE so the user must reset on first login.","operationId":"create_manual_user_api_admin_users_create_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateManualUserRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/doctor/onboarding/status":{"get":{"tags":["doctor_onboarding"],"summary":"Get Onboarding Status","operationId":"get_onboarding_status_api_doctor_onboarding_status_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/doctor/onboarding/kyc":{"post":{"tags":["doctor_onboarding"],"summary":"Submit Kyc","operationId":"submit_kyc_api_doctor_onboarding_kyc_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/KYCData"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/doctor/onboarding/upload":{"post":{"tags":["doctor_onboarding"],"summary":"Upload Document","description":"Browser POSTs the file here (multipart/form-data).\nBackend streams it directly to R2 server-side — no browser→R2 CORS needed.","operationId":"upload_document_api_doctor_onboarding_upload_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_upload_document_api_doctor_onboarding_upload_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/doctor/onboarding/upload-url":{"post":{"tags":["doctor_onboarding"],"summary":"Get Upload Url","description":"Deprecated: use /upload instead. Kept so old clients don't 404.","operationId":"get_upload_url_api_doctor_onboarding_upload_url_post","parameters":[{"name":"upload_type","in":"query","required":true,"schema":{"type":"string","title":"Upload Type"}},{"name":"filename","in":"query","required":true,"schema":{"type":"string","title":"Filename"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/doctor/onboarding/confirm-upload":{"post":{"tags":["doctor_onboarding"],"summary":"Confirm Upload","description":"Deprecated: use /upload instead.","operationId":"confirm_upload_api_doctor_onboarding_confirm_upload_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConfirmUploadRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/doctor/onboarding/contract/{contract_type}":{"get":{"tags":["doctor_onboarding"],"summary":"Get Contract","operationId":"get_contract_api_doctor_onboarding_contract__contract_type__get","parameters":[{"name":"contract_type","in":"path","required":true,"schema":{"type":"string","title":"Contract Type"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/doctor/onboarding/accept-contract":{"post":{"tags":["doctor_onboarding"],"summary":"Accept Contract","operationId":"accept_contract_api_doctor_onboarding_accept_contract_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AcceptContractRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/doctor/onboarding/stripe-connect":{"post":{"tags":["doctor_onboarding"],"summary":"Create Stripe Connect","description":"Create or retrieve Stripe Express account and return onboarding link.","operationId":"create_stripe_connect_api_doctor_onboarding_stripe_connect_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/doctor/onboarding/stripe-status":{"get":{"tags":["doctor_onboarding"],"summary":"Check Stripe Status","description":"Poll whether Stripe Connect has been completed.","operationId":"check_stripe_status_api_doctor_onboarding_stripe_status_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/doctor/onboarding/payment-info":{"post":{"tags":["doctor_onboarding"],"summary":"Save Payment Info","description":"Save IBAN + business info. Admin will create the Stripe Express account manually.","operationId":"save_payment_info_api_doctor_onboarding_payment_info_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentInfoRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/doctor/onboarding/complete-training":{"post":{"tags":["doctor_onboarding"],"summary":"Complete Training","operationId":"complete_training_api_doctor_onboarding_complete_training_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TrainingCompletionRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/doctors/pending":{"get":{"tags":["doctor_admin"],"summary":"List Pending Doctors","description":"List all doctors awaiting FNOMCeO verification, with KYC details.","operationId":"list_pending_doctors_api_admin_doctors_pending_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/doctors/approved":{"get":{"tags":["doctor_admin"],"summary":"List Approved Doctors","description":"List all approved (active) doctors with full KYC + payment details.","operationId":"list_approved_doctors_api_admin_doctors_approved_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/doctors/{user_id}/file/{file_type}":{"get":{"tags":["doctor_admin"],"summary":"Proxy Doctor File","description":"Generate a short-lived presigned GET URL for a doctor document and redirect to it.","operationId":"proxy_doctor_file_api_admin_doctors__user_id__file__file_type__get","parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"string","title":"User Id"}},{"name":"file_type","in":"path","required":true,"schema":{"type":"string","title":"File Type"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/doctors/{user_id}/verify":{"post":{"tags":["doctor_admin"],"summary":"Verify Doctor","description":"Approve or reject a doctor after FNOMCeO manual check.","operationId":"verify_doctor_api_admin_doctors__user_id__verify_post","parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"string","title":"User Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VerifyDoctorRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/contract-links":{"post":{"tags":["contracts","contracts"],"summary":"Generate Contract Link","description":"Admin-only. Freezes each contract's SHA-256 in the token payload, revokes any\nprior outstanding link for this user (regeneration safety), mints a short link,\nand returns it. It does NOT send an email — sending is a separate, deliberate step.","operationId":"generate_contract_link_api_admin_contract_links_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenerateLinkRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/contracts/status/{user_id}":{"get":{"tags":["contracts","contracts"],"summary":"Contract Status","description":"Admin-only: derived contract state(s) for a person + full signature history.","operationId":"contract_status_api_admin_contracts_status__user_id__get","parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"string","title":"User Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/contracts/overview":{"get":{"tags":["contracts","contracts"],"summary":"Contracts Overview","description":"Admin-only: per contract type, the applicable people, their derived state, and counters.","operationId":"contracts_overview_api_admin_contracts_overview_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/contracts/{contract_type}/{version}":{"get":{"tags":["contracts","contracts"],"summary":"Read Contract Text","description":"Admin-only: return the canonical text of a contract, so it can be read in the panel.","operationId":"read_contract_text_api_admin_contracts__contract_type___version__get","parameters":[{"name":"contract_type","in":"path","required":true,"schema":{"type":"string","title":"Contract Type"}},{"name":"version","in":"path","required":true,"schema":{"type":"string","title":"Version"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/contracts/accept/{token}":{"get":{"tags":["contracts","contracts"],"summary":"View Contract Link","operationId":"view_contract_link_api_contracts_accept__token__get","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["contracts","contracts"],"summary":"Accept Contract Link","operationId":"accept_contract_link_api_contracts_accept__token__post","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AcceptRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/creator-contracts":{"get":{"tags":["contracts","contracts"],"summary":"Elenco Contratti","description":"Admin-only: every creator contract, newest first, with its state (no signatures, no personal data).","operationId":"elenco_contratti_api_admin_creator_contracts_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}},"post":{"tags":["contracts","contracts"],"summary":"Crea Contratto","description":"Admin-only: freeze the template hash, store N9VE's terms and signature, return the creator's link.","operationId":"crea_contratto_api_admin_creator_contracts_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreaContrattoRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/creator-contracts/{contract_id}/annulla":{"post":{"tags":["contracts","contracts"],"summary":"Annulla Contratto","description":"Admin-only: switch off a link that has not been signed yet (a wrong amount, a wrong person).","operationId":"annulla_contratto_api_admin_creator_contracts__contract_id__annulla_post","parameters":[{"name":"contract_id","in":"path","required":true,"schema":{"type":"string","title":"Contract Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/creator-contracts/{contract_id}/pdf":{"get":{"tags":["contracts","contracts"],"summary":"Pdf Admin","operationId":"pdf_admin_api_admin_creator_contracts__contract_id__pdf_get","parameters":[{"name":"contract_id","in":"path","required":true,"schema":{"type":"string","title":"Contract Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/contracts/creator/{token}":{"get":{"tags":["contracts","contracts"],"summary":"Vedi Contratto","description":"What the creator sees. Side-effect-free.","operationId":"vedi_contratto_api_contracts_creator__token__get","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["contracts","contracts"],"summary":"Firma Contratto","description":"The creator signs. The only public endpoint that writes, and it writes once.","operationId":"firma_contratto_api_contracts_creator__token__post","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FirmaRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/contracts/creator/{token}/pdf":{"get":{"tags":["contracts","contracts"],"summary":"Pdf Creator","description":"The creator's own copy, for COPY_DAYS after signing.","operationId":"pdf_creator_api_contracts_creator__token__pdf_get","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/users/{target_user_id}/avatar":{"post":{"tags":["avatar"],"summary":"Upload Avatar","description":"Admin uploads a photo for any staff member.\nAlso called from the doctor onboarding wizard where caller_id == target_user_id.","operationId":"upload_avatar_api_admin_users__target_user_id__avatar_post","parameters":[{"name":"target_user_id","in":"path","required":true,"schema":{"type":"string","title":"Target User Id"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_upload_avatar_api_admin_users__target_user_id__avatar_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/me/avatar":{"post":{"tags":["avatar"],"summary":"Upload My Avatar","description":"Doctor/staff uploads their own avatar during onboarding or profile edit.\nDelegates to the main endpoint with self as target.","operationId":"upload_my_avatar_api_admin_me_avatar_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_upload_my_avatar_api_admin_me_avatar_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/subscriptions/process_refills":{"post":{"tags":["subscriptions"],"summary":"Trigger Process Due Refills","description":"Admin/cron: trigger processing of all due refills in background.\n\nThe nightly cron does NOT come through here — it calls process_due_refills()\nin-process from app/api/cron_renewals.py, so the admin gate costs it nothing.","operationId":"trigger_process_due_refills_api_subscriptions_process_refills_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/subscriptions/{subscription_id}/trigger_refill":{"post":{"tags":["subscriptions"],"summary":"Manual Trigger Refill","description":"Admin: manually trigger a refill, bypassing next_refill_at check.","operationId":"manual_trigger_refill_api_subscriptions__subscription_id__trigger_refill_post","parameters":[{"name":"subscription_id","in":"path","required":true,"schema":{"type":"string","title":"Subscription Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/subscriptions/update-payment-method":{"post":{"tags":["subscriptions"],"summary":"Update Payment Method","description":"Create a Stripe SetupIntent for updating the patient's card.","operationId":"update_payment_method_api_subscriptions_update_payment_method_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentUpdateRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/subscriptions/patient/{user_id}":{"get":{"tags":["subscriptions"],"summary":"Get Patient Subscriptions","description":"Fetch all subscriptions and current version details for a patient dashboard.\n\nIncludes the *next refill amount* and the saved card (brand/last4) so\nops can preview what would actually be charged before pressing Forza Ora.\nPricing matches refill_service: pending_amount_cents > version.amount_cents\n> combo.price_monthly_cents (the per-cycle full charge).","operationId":"get_patient_subscriptions_api_subscriptions_patient__user_id__get","parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"string","title":"User Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/subscriptions/mine":{"get":{"tags":["subscriptions"],"summary":"Get My Subscriptions And Cases","description":"Authenticated patient: fetch subscriptions + pending cases.","operationId":"get_my_subscriptions_and_cases_api_subscriptions_mine_get","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/subscriptions/percorso":{"get":{"tags":["subscriptions"],"summary":"Get Percorso","description":"Authenticated patient: the FULL \"Il tuo Percorso\" payload for their\ncurrent case + subscription, wired to real DB state.\n\nEvery field maps to a real column/computation — no invented dates/states:\n  * adesso / stations  ← case_state (+ tracking_status) via percorso_status\n  * refill charge date == subscriptions.next_refill_at (the cron charges\n    off-session the day next_refill_at <= now; there is NO lead-time offset)\n  * prescribed product ← orders→order_items→molecule_combinations (the REAL\n    therapy, not the quiz-goals string the old /mine derived)\n  * ricetta            ← cases.nre_code (NRE) | cases.prescription_pdf_key (PDF)\n  * check-in           ← check_in_schedules.next_check_in_at\nA patient can only ever read their OWN data (user_id scopes every query).","operationId":"get_percorso_api_subscriptions_percorso_get","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/subscriptions/{subscription_id}/pause":{"post":{"tags":["subscriptions"],"summary":"Pause Subscription","description":"Pause an active subscription — prevents cron from processing it.\n\nOwnership check identical to resume() below: the subscription must belong\nto the requesting user. Without it, knowing a subscription_id was enough to\nstop someone else's therapy. Ops pauses go through\n/api/ops/subscriptions/{id}/pause, which carries its own admin gate.","operationId":"pause_subscription_api_subscriptions__subscription_id__pause_post","parameters":[{"name":"subscription_id","in":"path","required":true,"schema":{"type":"string","title":"Subscription Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/subscriptions/{subscription_id}/resume":{"post":{"tags":["subscriptions"],"summary":"Resume Subscription","description":"Resume a PAUSED (or payment-failed) subscription back to ACTIVE.\n\nPatient-facing: the \"Riprendi il percorso\" button on /dashboard/percorso.\nSafe by construction:\n  * ownership check — the subscription must belong to the requesting user;\n  * only PAUSED / PAYMENT_FAILED flip to ACTIVE (never reactivates a\n    terminal subscription like Cancelled);\n  * paused_until is cleared, in sync with the auto-resume cron;\n  * NO prescription gate here on purpose: resuming only re-enters the sub\n    into the refill pipeline, whose existing gate routes an expired\n    prescription to the doctor (QueuedForReview) BEFORE any charge.\nAny unexpected failure posts to Slack #incidents (never silent).","operationId":"resume_subscription_api_subscriptions__subscription_id__resume_post","parameters":[{"name":"subscription_id","in":"path","required":true,"schema":{"type":"string","title":"Subscription Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/subscriptions/{subscription_id}/mutate":{"post":{"tags":["subscriptions"],"summary":"Mutate Subscription","description":"Doctor/admin: modify the product protocol of an active subscription.\n\nChange is DEFERRED — applied at the next refill cycle.\nImmediately after saving, a SCA dry-run probes the bank and an SMS\nis sent to the patient (informational or action-required).\n\nValidation:\n- Any added Rx product must include nre_code\n- Blocked if next_refill_at < NOW() + 24h (freeze window)\n- At least one of add/remove must be non-empty","operationId":"mutate_subscription_api_subscriptions__subscription_id__mutate_post","parameters":[{"name":"subscription_id","in":"path","required":true,"schema":{"type":"string","title":"Subscription Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MutationRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/identity/autocomplete":{"get":{"tags":["Identity"],"summary":"Autocomplete Place","description":"Returns up to 20 matching places of birth (Comuni or Foreign States).","operationId":"autocomplete_place_api_identity_autocomplete_get","parameters":[{"name":"q","in":"query","required":true,"schema":{"type":"string","minLength":2,"title":"Q"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/identity/derive-cf":{"post":{"tags":["Identity"],"summary":"Derive Cf","description":"Computes the Codice Fiscale using the provided identity data.","operationId":"derive_cf_api_identity_derive_cf_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeriveCFRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/identity/verify-cf":{"post":{"tags":["Identity"],"summary":"Verify Cf","description":"Synchronously verifies the CF via OpenApiService.\nReturns the status: 'valid', 'invalid', 'pending'.","operationId":"verify_cf_api_identity_verify_cf_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VerifyCFRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/patient/magic-link/verify":{"get":{"tags":["Patient Magic Links"],"summary":"Verify Magic Link","description":"Verifies a magic link token and returns basic patient data\nto populate the Codice Fiscale update micro-view.\n\nThe form sends the token in the X-Link-Token header, out of the access log (25/10/2026);\n?token= still answers as before.","operationId":"verify_magic_link_api_patient_magic_link_verify_get","parameters":[{"name":"token","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Token"}},{"name":"X-Link-Token","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Link-Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/patient/magic-link/update-cf":{"post":{"tags":["Patient Magic Links"],"summary":"Update Cf Via Magic Link","description":"Takes the submitted CF, re-verifies it against OpenAPI,\nand if valid, unlocks the case from MissingData/Invalid states.","operationId":"update_cf_via_magic_link_api_patient_magic_link_update_cf_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateCFRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/patient/magic-link/debug-insert":{"get":{"tags":["Patient Magic Links"],"summary":"Debug Insert","description":"STAGING-ONLY: creates a fake user + case and returns a 7-day magic-link\nshort token. Caller must pass `Authorization: Bearer <CRON_SECRET>` AND\nthe env flag `RETURN_MAGIC_LINK_IN_RESPONSE` must be on.","operationId":"debug_insert_api_patient_magic_link_debug_insert_get","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/patient/magic-link/debug-db":{"get":{"tags":["Patient Magic Links"],"summary":"Debug Db","description":"STAGING-ONLY DB connectivity probe. See _require_debug_enabled.","operationId":"debug_db_api_patient_magic_link_debug_db_get","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/stripe/webhook":{"post":{"tags":["stripe"],"summary":"Stripe Webhook","description":"Single entry point for all Stripe webhook events.\nVerifies signature, then dispatches to the appropriate handler module.","operationId":"stripe_webhook_stripe_webhook_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/webhooks/stripe-connect":{"post":{"tags":["stripe_connect","stripe_connect"],"summary":"Stripe Connect Webhook","operationId":"stripe_connect_webhook_api_webhooks_stripe_connect_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/patient/notifications":{"get":{"tags":["patient"],"summary":"Get Notifications","operationId":"get_notifications_api_patient_notifications_get","parameters":[{"name":"user_id","in":"query","required":true,"schema":{"type":"string","title":"User Id"}},{"name":"skip","in":"query","required":false,"schema":{"type":"integer","default":0,"title":"Skip"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":20,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/NotificationRead"},"title":"Response Get Notifications Api Patient Notifications Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/patient/notifications/{notif_id}/read":{"post":{"tags":["patient"],"summary":"Mark Notification Read","operationId":"mark_notification_read_api_patient_notifications__notif_id__read_post","parameters":[{"name":"notif_id","in":"path","required":true,"schema":{"type":"string","title":"Notif Id"}},{"name":"user_id","in":"query","required":true,"schema":{"type":"string","title":"User Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/patient/check-in/status":{"get":{"tags":["patient"],"summary":"Get Check In Status","operationId":"get_check_in_status_api_patient_check_in_status_get","parameters":[{"name":"user_id","in":"query","required":true,"schema":{"type":"string","title":"User Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckInStatus"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/patient/check-in":{"post":{"tags":["patient"],"summary":"Submit Check In","description":"RETIRED (2026-07-05). The legacy v0.5 questionnaire that POSTed here stored\nno kind/number/adherence and had no photo step, producing check-ins the doctor\nreview panel can't render (see Marco Mennini, 2026-07-05). All check-in submits\nnow go through /api/patient/check-in/v2/submit. The tokenless /check-in page is\na redirector into the v2 runner, so nothing should reach this endpoint anymore.\nWe return 410 (Gone) rather than silently creating a degraded row.","operationId":"submit_check_in_api_patient_check_in_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckInSubmit"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/patient/referral":{"get":{"tags":["patient"],"summary":"Get Referral","description":"\"Invita un amico\" card in the portal: the patient's code, the share link,\nhow many friends activated (a count, never a name) and the credits.\nOnly for patients with an ACTIVE plan: without one, {\"eligible\": false} and no\ncode (a state of the patient, not a refusal: a 403 was an error in the console\nof every dashboard without a therapy, collaudo V3A 01/11); 404 when the feature\nis off. The FE hides the card either way. Same identity idiom as /percorso.","operationId":"get_referral_api_patient_referral_get","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/patient/orders/latest":{"get":{"tags":["patient"],"summary":"Get Latest Order","description":"Temporary override: Returns found: False since timeline is driven by cases.","operationId":"get_latest_order_api_patient_orders_latest_get","parameters":[{"name":"user_id","in":"query","required":true,"schema":{"type":"string","title":"User Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/patient/referto/{case_id}":{"get":{"tags":["patient"],"summary":"Get Referto","description":"Patient-only read of their OWN signed referto for a case.\n\nAuth mirrors /api/subscriptions/mine: the caller's user_id comes from the\nquery param or the n9ve_user_id cookie, and MUST match the case owner — a\npatient can never read another user's referto (403). 404 if the case has no\nsigned report yet (nothing to show).","operationId":"get_referto_api_patient_referto__case_id__get","parameters":[{"name":"case_id","in":"path","required":true,"schema":{"type":"string","title":"Case Id"}},{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RefertoResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/patient/check-in/v2/status":{"get":{"tags":["checkin_v2","checkin_v2"],"summary":"Get Status","description":"Schedule state for the dashboard CTA card. Read-only.","operationId":"get_status_api_patient_check_in_v2_status_get","parameters":[{"name":"user_id","in":"query","required":true,"schema":{"type":"string","minLength":1,"title":"User Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/app__api__patient__checkin_v2__CheckInStatus"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/patient/check-in/v2/photo-url":{"post":{"tags":["checkin_v2","checkin_v2"],"summary":"Request Photo Upload Url","description":"Issue a presigned PUT URL for a single photo slot.\n\nReuses the existing R2 helper from s3.py (same bucket, different prefix\nthan guided-sweep). Returns the URL + canonical key — FE PUTs the blob\ndirectly to R2, then includes the key in the /v2/submit payload.","operationId":"request_photo_upload_url_api_patient_check_in_v2_photo_url_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckInPhotoUrlRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckInPhotoUrlResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/patient/check-in/v2/photo-url/{check_in_id}":{"get":{"tags":["checkin_v2","checkin_v2"],"summary":"Get Photo Signed Url","description":"Issue a presigned GET URL for an already-uploaded photo (backoffice). TTL 15 min.\n\n`user_id` is a plain query parameter that builds the S3 key, so before this\ngate any user_id yielded a signed link to another patient's scalp photos.\nThe admin review panel does not use this route (it gets its presigned URLs\nfrom /api/admin/checkins/{id}), and the patient app only uses the POST\nsibling above, so nothing patient-facing depends on it.","operationId":"get_photo_signed_url_api_patient_check_in_v2_photo_url__check_in_id__get","parameters":[{"name":"check_in_id","in":"path","required":true,"schema":{"type":"string","title":"Check In Id"}},{"name":"slot","in":"query","required":true,"schema":{"type":"string","title":"Slot"}},{"name":"user_id","in":"query","required":true,"schema":{"type":"string","title":"User Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/patient/check-in/v2/submit":{"post":{"tags":["checkin_v2","checkin_v2"],"summary":"Submit Checkin","description":"Final submit. Persists answers + photo_keys + advances schedule.\n\nNever writes case_state: see the comment at the escalation site below.","operationId":"submit_checkin_api_patient_check_in_v2_submit_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckInSubmitV2"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/patient/check-in/v2/self-start":{"post":{"tags":["checkin_v2","checkin_v2"],"summary":"Self Start Checkin","description":"Mint a check-in token for the logged-in patient (dashboard entry point).\n\nReads the schedule to derive the next cycle (kind + number) exactly like the\nscheduler does at send-time, mints a short token, and returns it. The FE\nredirects to /check-in/{token} — the same destination as the SMS/email link.\n404 if the user has no schedule (nothing to check in on).","operationId":"self_start_checkin_api_patient_check_in_v2_self_start_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SelfStartRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SelfStartResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/patient/check-in/v2/resolve":{"get":{"tags":["checkin_v2","checkin_v2"],"summary":"Resolve Checkin Token","description":"Resolve a short-token from SMS/email check-in link → returns context the\nFE runner needs (user info, kind, baseline photos URLs).\n\nMirrors marketing/recovery/resolve. Token TTL = 14 days (set at mint time).\n\nOn invalid/expired → 410 (gone), FE redirects to /check-in/expired.","operationId":"resolve_checkin_token_api_patient_check_in_v2_resolve_get","parameters":[{"name":"token","in":"query","required":true,"schema":{"type":"string","minLength":4,"maxLength":32,"title":"Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckInResolvedContext"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/cron/checkin/weekly-collect":{"post":{"tags":["cron_checkin","cron_checkin"],"summary":"Weekly Collect","description":"Mon 03:00 UTC. Populates checkin_send_queue from check_in_schedules.","operationId":"weekly_collect_api_cron_checkin_weekly_collect_post","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":2000,"minimum":1,"default":500,"title":"Limit"}},{"name":"X-Cron-Secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Cron-Secret"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/cron/checkin/daily-send":{"post":{"tags":["cron_checkin","cron_checkin"],"summary":"Daily Send","description":"Tue-Sat ~11:00 ITA. Reads pending queue, applies pre-send eligibility\nchecks, fires SMS + email, updates queue status.","operationId":"daily_send_api_cron_checkin_daily_send_post","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":1000,"minimum":1,"default":200,"title":"Limit"}},{"name":"X-Cron-Secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Cron-Secret"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/cron/checkin/reminder":{"post":{"tags":["cron_checkin","cron_checkin"],"summary":"Reminder Send","description":"Tue-Sat ~12:00 ITA. Emails T+4d nudge for queue entries notified-but-not-submitted.","operationId":"reminder_send_api_cron_checkin_reminder_post","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":1000,"minimum":1,"default":200,"title":"Limit"}},{"name":"X-Cron-Secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Cron-Secret"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/cron/checkin/review-request":{"post":{"tags":["cron_checkin","cron_checkin"],"summary":"Review Request Send","description":"Mon-Fri 12:00 ITA. The Trustpilot review ask, T+7d after the FIRST\ncheck-in invitation. Its own daytime slot (PM's choice, 17/09), away from\nthe 11:00 check-in send and the 10:00 reminder. No-op without\nTRUSTPILOT_REVIEW_URL (the #metriche kill switch).","operationId":"review_request_send_api_cron_checkin_review_request_post","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":1000,"minimum":1,"default":200,"title":"Limit"}},{"name":"X-Cron-Secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Cron-Secret"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/cron/attribution/reconcile":{"post":{"tags":["cron_attribution","cron_attribution"],"summary":"Reconcile Attribution","description":"Resolve missing/stale customer attribution. Idempotent; safe to re-run.","operationId":"reconcile_attribution_api_cron_attribution_reconcile_post","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":5000,"minimum":1,"default":500,"title":"Limit"}},{"name":"max_age_days","in":"query","required":false,"schema":{"type":"integer","maximum":3650,"minimum":0,"default":7,"title":"Max Age Days"}},{"name":"X-Cron-Secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Cron-Secret"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/checkins":{"get":{"tags":["admin_checkins","admin_checkins"],"summary":"List Checkins","description":"List check-ins (recent first), filterable.","operationId":"list_checkins_api_admin_checkins_get","parameters":[{"name":"q","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by patient name (ILIKE)","title":"Q"},"description":"Filter by patient name (ILIKE)"},{"name":"kind","in":"query","required":false,"schema":{"anyOf":[{"type":"string","pattern":"^(onboarding_30d|periodic_90d)$"},{"type":"null"}],"title":"Kind"}},{"name":"has_red_flag","in":"query","required":false,"schema":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Has Red Flag"}},{"name":"has_provider_request","in":"query","required":false,"schema":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Has Provider Request"}},{"name":"days_back","in":"query","required":false,"schema":{"type":"integer","maximum":365,"minimum":1,"default":90,"title":"Days Back"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/CheckinListRow"},"title":"Response List Checkins Api Admin Checkins Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/checkins/unreviewed-count":{"get":{"tags":["admin_checkins","admin_checkins"],"summary":"Unreviewed Count","description":"Count of check-ins not yet marked reviewed by a doctor — feeds the sidebar\n'Check-in' badge so the doctor knows there's something to review.","operationId":"unreviewed_count_api_admin_checkins_unreviewed_count_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/checkins/outstanding":{"get":{"tags":["admin_checkins","admin_checkins"],"summary":"List Outstanding","description":"Check-ins we invited the patient to (via the scheduler) that are NOT\ncompleted yet — the 'Da completare' tab. Shows the contact touchpoints\n(SMS + email invite, reminder email) so staff see who was reached and how\noften. A cycle is 'completed' when a check_ins row exists for the same\n(user_id, checkin_number).","operationId":"list_outstanding_api_admin_checkins_outstanding_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":300,"minimum":1,"default":100,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/CheckinOutstandingRow"},"title":"Response List Outstanding Api Admin Checkins Outstanding Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/checkins/upcoming":{"get":{"tags":["admin_checkins","admin_checkins"],"summary":"List Upcoming","description":"The next scheduled check-ins, soonest first — the 'Prossimi' tab.\nOnly non-paused schedules whose subscription is still active are shown,\nso churned/abandoned users (whose schedule is never auto-paused — pause()\nis wired at send-time skip, not on cancellation) don't appear as 'about\nto fire'.","operationId":"list_upcoming_api_admin_checkins_upcoming_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":500,"minimum":1,"default":200,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/CheckinUpcomingRow"},"title":"Response List Upcoming Api Admin Checkins Upcoming Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/checkins/flusso-nuovo":{"get":{"tags":["admin_checkins","admin_checkins"],"summary":"List New Flow Controls","description":"Every control of «Mantieni attiva la ricetta» a patient completed (recent first), also when\nthere is nothing to do — the 'Flusso nuovo' tab. Read-only: no review action, and the\nunreviewed-count badge keeps counting check_ins only. Never the answers: the outcome only.","operationId":"list_new_flow_controls_api_admin_checkins_flusso_nuovo_get","parameters":[{"name":"q","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by patient name or email (ILIKE)","title":"Q"},"description":"Filter by patient name or email (ILIKE)"},{"name":"kind","in":"query","required":false,"schema":{"anyOf":[{"type":"string","pattern":"^(primo_mese|foto|rinnovo_breve)$"},{"type":"null"}],"title":"Kind"}},{"name":"days_back","in":"query","required":false,"schema":{"type":"integer","maximum":365,"minimum":1,"default":90,"title":"Days Back"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":500,"minimum":1,"default":100,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/NewFlowControlRow"},"title":"Response List New Flow Controls Api Admin Checkins Flusso Nuovo Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/checkins/by-case/{case_id}":{"get":{"tags":["admin_checkins","admin_checkins"],"summary":"Case Checkin Status","description":"Check-in status for one case — feeds the box on the doctor case page.\nResolves the patient from the case, then summarises the schedule, the\nlatest sent cycle (awaiting response?) and the latest completed check-in.","operationId":"case_checkin_status_api_admin_checkins_by_case__case_id__get","parameters":[{"name":"case_id","in":"path","required":true,"schema":{"type":"string","title":"Case Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseCheckinStatus"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/checkins/{check_in_id}":{"get":{"tags":["admin_checkins","admin_checkins"],"summary":"Get Checkin Detail","description":"Detail page — answers + current photos + baseline side-by-side + review state.","operationId":"get_checkin_detail_api_admin_checkins__check_in_id__get","parameters":[{"name":"check_in_id","in":"path","required":true,"schema":{"type":"string","title":"Check In Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckinDetail"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/checkins/{check_in_id}/review":{"post":{"tags":["admin_checkins","admin_checkins"],"summary":"Mark Checkin Reviewed","description":"Doctor/admin reviews a check-in ONCE: records the internal note in the\ncase timeline and (optionally) sends a message to the patient in chat. A\ncheck-in can be reviewed only once — re-review is rejected (409).","operationId":"mark_checkin_reviewed_api_admin_checkins__check_in_id__review_post","parameters":[{"name":"check_in_id","in":"path","required":true,"schema":{"type":"string","title":"Check In Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckinReviewRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/checkins/{check_in_id}/review-draft":{"put":{"tags":["admin_checkins","admin_checkins"],"summary":"Save Checkin Review Draft","description":"Autosave the SHARED review draft (doctor + ops write at different moments).\n\nPersists across sessions so whoever opens the check-in finds what the other\nalready wrote. Whoever sends the review (mark-reviewed) ships everything in the\ndraft. The draft is cleared automatically on review. Last-write-wins per save\n(the two roles edit in different moments, so no real conflict).","operationId":"save_checkin_review_draft_api_admin_checkins__check_in_id__review_draft_put","parameters":[{"name":"check_in_id","in":"path","required":true,"schema":{"type":"string","title":"Check In Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckinDraftRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/patient/ricetta/self-start":{"post":{"tags":["ricetta","ricetta"],"summary":"Self Start","operationId":"self_start_api_patient_ricetta_self_start_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SelfStart"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/patient/ricetta/resolve":{"get":{"tags":["ricetta","ricetta"],"summary":"Resolve","operationId":"resolve_api_patient_ricetta_resolve_get","parameters":[{"name":"token","in":"query","required":true,"schema":{"type":"string","title":"Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/patient/ricetta/photo-url":{"post":{"tags":["ricetta","ricetta"],"summary":"Photo Url","operationId":"photo_url_api_patient_ricetta_photo_url_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PhotoUrl"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/patient/ricetta/submit":{"post":{"tags":["ricetta","ricetta"],"summary":"Submit","operationId":"submit_api_patient_ricetta_submit_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Submit"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/cron/mantieni-ricetta":{"post":{"tags":["cron_mantieni_ricetta","cron_mantieni_ricetta"],"summary":"Mantieni Ricetta Cron","operationId":"mantieni_ricetta_cron_api_cron_mantieni_ricetta_post","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":5000,"minimum":1,"default":1000,"title":"Limit"}},{"name":"X-Cron-Secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Cron-Secret"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/mantieni-ricetta":{"get":{"tags":["admin_mantieni_ricetta","admin","mantieni_ricetta"],"summary":"Lists","operationId":"lists_api_admin_mantieni_ricetta_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/mantieni-ricetta/{request_id}/invia":{"post":{"tags":["admin_mantieni_ricetta","admin","mantieni_ricetta"],"summary":"Send Renewed","operationId":"send_renewed_api_admin_mantieni_ricetta__request_id__invia_post","parameters":[{"name":"request_id","in":"path","required":true,"schema":{"type":"string","title":"Request Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/mantieni-ricetta/{request_id}/chiamata":{"post":{"tags":["admin_mantieni_ricetta","admin","mantieni_ricetta"],"summary":"Call Done","operationId":"call_done_api_admin_mantieni_ricetta__request_id__chiamata_post","parameters":[{"name":"request_id","in":"path","required":true,"schema":{"type":"string","title":"Request Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/mantieni-ricetta/{request_id}/sblocca-addebito":{"post":{"tags":["admin_mantieni_ricetta","admin","mantieni_ricetta"],"summary":"Unblock Charge","operationId":"unblock_charge_api_admin_mantieni_ricetta__request_id__sblocca_addebito_post","parameters":[{"name":"request_id","in":"path","required":true,"schema":{"type":"string","title":"Request Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Unblock"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/mantieni-ricetta/rispedizione":{"post":{"tags":["admin_mantieni_ricetta","admin","mantieni_ricetta"],"summary":"Reshipment","operationId":"reshipment_api_admin_mantieni_ricetta_rispedizione_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Reshipment"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/cron/google-ads-oci/sweep":{"post":{"tags":["cron_google_ads_oci","cron_google_ads_oci"],"summary":"Sweep","description":"Retry stuck OCI conversions. Idempotent; safe to re-run and safe empty.","operationId":"sweep_api_cron_google_ads_oci_sweep_post","parameters":[{"name":"max_age_minutes","in":"query","required":false,"schema":{"type":"integer","maximum":43200,"minimum":1,"default":10080,"title":"Max Age Minutes"}},{"name":"max_attempts","in":"query","required":false,"schema":{"type":"integer","maximum":50,"minimum":1,"default":6,"title":"Max Attempts"}},{"name":"stale_after_minutes","in":"query","required":false,"schema":{"type":"integer","maximum":43200,"minimum":1,"default":120,"title":"Stale After Minutes"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":2000,"minimum":1,"default":200,"title":"Limit"}},{"name":"X-Cron-Secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Cron-Secret"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/gravidanza/{user_id}":{"get":{"tags":["gravidanza"],"summary":"Storia","description":"The patient's statements, newest first (the first is the state the guard reads).","operationId":"storia_api_admin_gravidanza__user_id__get","parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"string","title":"User Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Storia Api Admin Gravidanza  User Id  Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["gravidanza"],"summary":"Registra Ops","operationId":"registra_ops_api_admin_gravidanza__user_id__post","parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"string","title":"User Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Dichiarazione"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Registra Ops Api Admin Gravidanza  User Id  Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/doctor/gravidanza/{user_id}":{"post":{"tags":["gravidanza"],"summary":"Registra Medico","operationId":"registra_medico_api_doctor_gravidanza__user_id__post","parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"string","title":"User Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Dichiarazione"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Registra Medico Api Doctor Gravidanza  User Id  Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"AcceptContractRequest":{"properties":{"contract_type":{"type":"string","title":"Contract Type"},"client_hash":{"type":"string","title":"Client Hash"}},"type":"object","required":["contract_type","client_hash"],"title":"AcceptContractRequest"},"AcceptRequest":{"properties":{"typed_name":{"type":"string","title":"Typed Name"},"accepted_types":{"items":{"type":"string"},"type":"array","title":"Accepted Types"},"vexatious_ack":{"type":"boolean","title":"Vexatious Ack","default":false}},"type":"object","required":["typed_name","accepted_types"],"title":"AcceptRequest"},"AckPayload":{"properties":{"code":{"type":"string","maxLength":40,"title":"Code"},"reason":{"type":"string","maxLength":500,"minLength":3,"title":"Reason"}},"type":"object","required":["code","reason"],"title":"AckPayload"},"AdScorecard":{"properties":{"level":{"type":"string","title":"Level"},"meta_ok":{"type":"boolean","title":"Meta Ok"},"date_from":{"type":"string","title":"Date From"},"date_to":{"type":"string","title":"Date To"},"rows":{"items":{"$ref":"#/components/schemas/AdScorecardRow"},"type":"array","title":"Rows"},"total_leads":{"type":"integer","title":"Total Leads"},"attributed_leads":{"type":"integer","title":"Attributed Leads"},"attributed_lead_pct":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Attributed Lead Pct"},"total_spend_cents":{"type":"integer","title":"Total Spend Cents"},"total_paying":{"type":"integer","title":"Total Paying"}},"type":"object","required":["level","meta_ok","date_from","date_to","rows","total_leads","attributed_leads","attributed_lead_pct","total_spend_cents","total_paying"],"title":"AdScorecard"},"AdScorecardRow":{"properties":{"unit_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Unit Id"},"campaign":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Campaign"},"adset":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Adset"},"ad":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ad"},"active":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Active"},"meta_link":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Meta Link"},"spend_cents":{"type":"integer","title":"Spend Cents"},"impressions":{"type":"integer","title":"Impressions"},"link_clicks":{"type":"integer","title":"Link Clicks"},"ctr":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Ctr"},"cpm_cents":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Cpm Cents"},"leads":{"type":"integer","title":"Leads"},"paying":{"type":"integer","title":"Paying"},"cpl_cents":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Cpl Cents"},"cac_cents":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Cac Cents"},"click_to_lead":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Click To Lead"},"lead_to_paid":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Lead To Paid"},"days_live":{"type":"integer","title":"Days Live"}},"type":"object","required":["unit_id","campaign","adset","ad","active","meta_link","spend_cents","impressions","link_clicks","ctr","cpm_cents","leads","paying","cpl_cents","cac_cents","click_to_lead","lead_to_paid","days_live"],"title":"AdScorecardRow","description":"One unit (adset or ad) in the kill/keep scorecard for a date range.\n\nDelivery metrics (spend/impressions/link_clicks/ctr/cpm) come straight from\nthe Meta /insights endpoint → they tie out 1:1 with Ads Manager for the same\ndates (account timezone). Conversion metrics (leads/paying) come from OUR DB\n(meta_capi_events 'Lead' + paid orders) → these are the numbers Meta is blind\nto because of the EU health-data block. That asymmetry is the whole point.\n\n`level` is 'adset' (works today: utm_term carries the numeric adset id) or\n'ad' (lights up once ad URLs tag utm_content={{ad.id}}). `unit_id` is the\nadset_id or ad_id accordingly — the key Meta spend joins on."},"Addon":{"properties":{"id":{"type":"string","title":"Id"},"name":{"type":"string","title":"Name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"image_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Image Url"},"price_cents":{"type":"integer","title":"Price Cents"},"billing_interval_months":{"type":"integer","title":"Billing Interval Months","default":1},"currency":{"type":"string","title":"Currency","default":"EUR"},"features":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Features","default":[]},"recommended_for":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Recommended For","default":[]},"medical_input_type":{"type":"string","title":"Medical Input Type","default":"REQUIRE_APPROVAL"},"type":{"type":"string","title":"Type","default":"integrator"}},"type":"object","required":["id","name","price_cents"],"title":"Addon"},"AddressRequest":{"properties":{"order_id":{"type":"string","maxLength":64,"title":"Order Id"},"client_secret":{"type":"string","maxLength":300,"title":"Client Secret"},"shipping_address":{"$ref":"#/components/schemas/ShippingAddress"}},"type":"object","required":["order_id","client_secret","shipping_address"],"title":"AddressRequest"},"AnswerSnapshot":{"properties":{"step_id":{"type":"string","title":"Step Id"},"question_text":{"type":"string","title":"Question Text"},"answer_value":{"title":"Answer Value"},"answer_label":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Answer Label"}},"type":"object","required":["step_id","question_text","answer_value"],"title":"AnswerSnapshot"},"AnswersBody":{"properties":{"evaluation_id":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Evaluation Id"},"path":{"type":"string","enum":["A","C"],"title":"Path"},"answers":{"additionalProperties":true,"type":"object","maxProperties":60,"title":"Answers"},"attribution":{"title":"Attribution"},"consenso_telemedicina":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Consenso Telemedicina"},"testi":{"anyOf":[{"additionalProperties":{"anyOf":[{"type":"string"},{"type":"null"}]},"type":"object","maxProperties":10},{"type":"null"}],"title":"Testi"},"origine":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Origine"},"sostituisce":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Sostituisce"}},"type":"object","required":["path","answers"],"title":"AnswersBody"},"ArticleCreate":{"properties":{"title":{"type":"string","title":"Title"},"slug":{"type":"string","title":"Slug"},"excerpt":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Excerpt"},"content":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Content"},"cover_image":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cover Image"},"author":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Author"},"is_published":{"type":"boolean","title":"Is Published","default":false},"section":{"type":"string","enum":["capelli","pelle","denti","salute-sessuale","sudore-rasatura","prevenzione","sonno-alimentazione"],"title":"Section","default":"capelli"}},"type":"object","required":["title","slug"],"title":"ArticleCreate"},"ArticleResponse":{"properties":{"article_id":{"type":"string","title":"Article Id"},"slug":{"type":"string","title":"Slug"},"title":{"type":"string","title":"Title"},"excerpt":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Excerpt"},"content":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Content"},"cover_image":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cover Image"},"author":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Author"},"published_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Published At"},"created_at":{"type":"string","title":"Created At"},"updated_at":{"type":"string","title":"Updated At"},"is_published":{"type":"boolean","title":"Is Published"},"section":{"type":"string","title":"Section","default":"capelli"}},"type":"object","required":["article_id","slug","title","excerpt","content","cover_image","author","published_at","created_at","updated_at","is_published"],"title":"ArticleResponse"},"ArticleUpdate":{"properties":{"title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Title"},"slug":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Slug"},"excerpt":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Excerpt"},"content":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Content"},"cover_image":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cover Image"},"author":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Author"},"is_published":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Is Published"},"section":{"anyOf":[{"type":"string","enum":["capelli","pelle","denti","salute-sessuale","sudore-rasatura","prevenzione","sonno-alimentazione"]},{"type":"null"}],"title":"Section"}},"type":"object","title":"ArticleUpdate"},"AtRiskCustomer":{"properties":{"user_id":{"type":"string","title":"User Id"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email"},"phone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Phone"},"last_paid_at":{"type":"string","title":"Last Paid At"},"days_overdue":{"type":"integer","title":"Days Overdue"},"cadence":{"type":"string","title":"Cadence"},"last_order_value_cents":{"type":"integer","title":"Last Order Value Cents"},"estimated_ltv_cents":{"type":"integer","title":"Estimated Ltv Cents"},"risk_tier":{"type":"string","title":"Risk Tier"}},"type":"object","required":["user_id","name","email","phone","last_paid_at","days_overdue","cadence","last_order_value_cents","estimated_ltv_cents","risk_tier"],"title":"AtRiskCustomer"},"AuditLogEntry":{"properties":{"audit_id":{"type":"string","title":"Audit Id"},"case_id":{"type":"string","title":"Case Id"},"user_id":{"type":"string","title":"User Id"},"event_type":{"type":"string","title":"Event Type"},"actor_type":{"type":"string","title":"Actor Type"},"actor_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Actor Id"},"payload_json":{"type":"string","title":"Payload Json"},"created_at":{"type":"string","title":"Created At"}},"type":"object","required":["audit_id","case_id","user_id","event_type","actor_type","actor_id","payload_json","created_at"],"title":"AuditLogEntry"},"BatchRequest":{"properties":{"case_ids":{"items":{"type":"string"},"type":"array","title":"Case Ids"},"pickup_date":{"type":"string","title":"Pickup Date"}},"type":"object","required":["case_ids"],"title":"BatchRequest"},"Body_process_guided_sweep_video_api_upload_guided_sweep_video_process_post":{"properties":{"video":{"type":"string","format":"binary","title":"Video"},"evaluation_id":{"type":"string","title":"Evaluation Id"}},"type":"object","required":["video"],"title":"Body_process_guided_sweep_video_api_upload_guided_sweep_video_process_post"},"Body_send_conversation_attachment_api_admin_chat_conversations__conversation_id__messages_attachments_post":{"properties":{"file":{"type":"string","format":"binary","title":"File"},"content":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Content","default":""},"private":{"type":"boolean","title":"Private","default":false}},"type":"object","required":["file"],"title":"Body_send_conversation_attachment_api_admin_chat_conversations__conversation_id__messages_attachments_post"},"Body_send_native_attachment_api_admin_chat_conversations__conversation_id__native_attachment_post":{"properties":{"file":{"anyOf":[{"type":"string","format":"binary"},{"type":"null"}],"title":"File"},"files":{"anyOf":[{"items":{"type":"string","format":"binary"},"type":"array"},{"type":"null"}],"title":"Files"},"content":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Content","default":""},"private":{"type":"boolean","title":"Private","default":false}},"type":"object","title":"Body_send_native_attachment_api_admin_chat_conversations__conversation_id__native_attachment_post"},"Body_send_unified_message_api_chat_message_post":{"properties":{"content":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Content"},"file":{"anyOf":[{"type":"string","format":"binary"},{"type":"null"}],"title":"File"},"files":{"anyOf":[{"items":{"type":"string","format":"binary"},"type":"array"},{"type":"null"}],"title":"Files"}},"type":"object","title":"Body_send_unified_message_api_chat_message_post"},"Body_twilio_inbound_sms_api_webhooks_twilio_inbound_post":{"properties":{"From":{"type":"string","title":"From","default":""},"Body":{"type":"string","title":"Body","default":""},"MessageSid":{"type":"string","title":"Messagesid","default":""}},"type":"object","title":"Body_twilio_inbound_sms_api_webhooks_twilio_inbound_post"},"Body_twilio_status_callback_api_webhooks_twilio_status_post":{"properties":{"MessageSid":{"type":"string","title":"Messagesid","default":""},"MessageStatus":{"type":"string","title":"Messagestatus","default":""},"ErrorCode":{"type":"string","title":"Errorcode"},"ErrorMessage":{"type":"string","title":"Errormessage"}},"type":"object","title":"Body_twilio_status_callback_api_webhooks_twilio_status_post"},"Body_upload_artwork_api_admin_partners__partner_id__artwork_post":{"properties":{"file":{"type":"string","format":"binary","title":"File"}},"type":"object","required":["file"],"title":"Body_upload_artwork_api_admin_partners__partner_id__artwork_post"},"Body_upload_avatar_api_admin_users__target_user_id__avatar_post":{"properties":{"file":{"type":"string","format":"binary","title":"File"}},"type":"object","required":["file"],"title":"Body_upload_avatar_api_admin_users__target_user_id__avatar_post"},"Body_upload_document_api_doctor_onboarding_upload_post":{"properties":{"file":{"type":"string","format":"binary","title":"File"},"upload_type":{"type":"string","title":"Upload Type"}},"type":"object","required":["file","upload_type"],"title":"Body_upload_document_api_doctor_onboarding_upload_post"},"Body_upload_guided_sweep_api_upload_guided_sweep_post":{"properties":{"front":{"type":"string","format":"binary","title":"Front"},"left":{"type":"string","format":"binary","title":"Left"},"right":{"type":"string","format":"binary","title":"Right"},"vertex":{"type":"string","format":"binary","title":"Vertex"},"evaluation_id":{"type":"string","title":"Evaluation Id"}},"type":"object","required":["front","left","right","vertex"],"title":"Body_upload_guided_sweep_api_upload_guided_sweep_post"},"Body_upload_invoice_api_admin_financial_pnl_expense__entry_id__invoice_post":{"properties":{"file":{"type":"string","format":"binary","title":"File"}},"type":"object","required":["file"],"title":"Body_upload_invoice_api_admin_financial_pnl_expense__entry_id__invoice_post"},"Body_upload_my_avatar_api_admin_me_avatar_post":{"properties":{"file":{"type":"string","format":"binary","title":"File"}},"type":"object","required":["file"],"title":"Body_upload_my_avatar_api_admin_me_avatar_post"},"Body_upload_onboarding_logo_api_partner_onboarding__token__logo_post":{"properties":{"file":{"type":"string","format":"binary","title":"File"}},"type":"object","required":["file"],"title":"Body_upload_onboarding_logo_api_partner_onboarding__token__logo_post"},"Body_upload_patient_photos_api_upload_patient_photos_post":{"properties":{"order_id":{"type":"string","title":"Order Id"},"user_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"},"file_0":{"type":"string","format":"binary","title":"File 0"},"file_1":{"type":"string","format":"binary","title":"File 1"},"file_2":{"type":"string","format":"binary","title":"File 2"}},"type":"object","required":["order_id"],"title":"Body_upload_patient_photos_api_upload_patient_photos_post"},"BridgeBody":{"properties":{"product_id":{"type":"string","title":"Product Id"}},"type":"object","required":["product_id"],"title":"BridgeBody"},"BulkSendBody":{"properties":{"campaign_id":{"type":"string","maxLength":80,"minLength":3,"title":"Campaign Id"},"segment":{"type":"string","title":"Segment","default":"email_full"},"channel":{"type":"string","title":"Channel","default":"email"},"dry_run":{"type":"boolean","title":"Dry Run","description":"Default TRUE per safety. Set False per send live.","default":true},"is_smoke":{"type":"boolean","title":"Is Smoke","description":"True per smoke test (3 nostre email).","default":false},"smoke_recipients":{"items":{"type":"string"},"type":"array","title":"Smoke Recipients","description":"Override email list per smoke test."},"throttle_per_minute":{"type":"integer","maximum":120.0,"minimum":1.0,"title":"Throttle Per Minute","default":20},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"limit":{"type":"integer","maximum":5000.0,"minimum":1.0,"title":"Limit","default":500}},"type":"object","required":["campaign_id"],"title":"BulkSendBody"},"CMSConfig":{"properties":{"key":{"type":"string","title":"Key"},"value":{"additionalProperties":true,"type":"object","title":"Value"},"requires_reacceptance":{"type":"boolean","title":"Requires Reacceptance","default":false}},"type":"object","required":["key","value"],"title":"CMSConfig"},"CaseCheckinStatus":{"properties":{"has_schedule":{"type":"boolean","title":"Has Schedule"},"next_check_in_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Check In At"},"kind_next":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Kind Next"},"checkin_count":{"type":"integer","title":"Checkin Count","default":0},"awaiting_response":{"type":"boolean","title":"Awaiting Response","default":false},"last_sent_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Sent At"},"last_reminder_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Reminder At"},"last_completed_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Completed At"},"last_check_in_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Check In Id"}},"type":"object","required":["has_schedule"],"title":"CaseCheckinStatus","description":"Check-in status for one case — the persistent box on the doctor case\npage. Tells the doctor when the next check-in is and where the current\none stands."},"ChannelCounts":{"properties":{"total":{"type":"integer","title":"Total"},"delivered":{"type":"integer","title":"Delivered"},"bounced":{"type":"integer","title":"Bounced"},"opened":{"type":"integer","title":"Opened"},"clicked":{"type":"integer","title":"Clicked"},"failed":{"type":"integer","title":"Failed"},"pending":{"type":"integer","title":"Pending"}},"type":"object","required":["total","delivered","bounced","opened","clicked","failed","pending"],"title":"ChannelCounts"},"ChannelStat":{"properties":{"channel":{"type":"string","title":"Channel"},"new_customers":{"type":"integer","title":"New Customers"},"spend_cents":{"type":"integer","title":"Spend Cents"},"cac_cents":{"type":"integer","title":"Cac Cents"},"revenue_180d_cents":{"type":"integer","title":"Revenue 180D Cents"},"ltv_cac_ratio":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Ltv Cac Ratio"}},"type":"object","required":["channel","new_customers","spend_cents","cac_cents","revenue_180d_cents","ltv_cac_ratio"],"title":"ChannelStat"},"ChargeApproveBody":{"properties":{"charge_state":{"type":"string","enum":["ApprovedForCharge","Blocked"],"title":"Charge State"},"reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reason"}},"type":"object","required":["charge_state"],"title":"ChargeApproveBody"},"ChatMessageBody":{"properties":{"content":{"type":"string","title":"Content"},"private":{"type":"boolean","title":"Private","default":false}},"type":"object","required":["content"],"title":"ChatMessageBody"},"CheckInBaselinePhoto":{"properties":{"slot":{"type":"string","title":"Slot"},"url":{"type":"string","title":"Url"},"source":{"type":"string","title":"Source"},"captured_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Captured At"}},"type":"object","required":["slot","url","source"],"title":"CheckInBaselinePhoto","description":"A previously uploaded photo (initial quiz OR earlier check-in) shown\nas visual reference in the photos step so patient can match the angle."},"CheckInPhotoUrlRequest":{"properties":{"user_id":{"type":"string","title":"User Id"},"token":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Token"},"check_in_id":{"type":"string","title":"Check In Id"},"slot":{"type":"string","title":"Slot"}},"type":"object","required":["user_id","check_in_id","slot"],"title":"CheckInPhotoUrlRequest"},"CheckInPhotoUrlResponse":{"properties":{"url":{"type":"string","title":"Url"},"key":{"type":"string","title":"Key"},"expires_in":{"type":"integer","title":"Expires In"}},"type":"object","required":["url","key","expires_in"],"title":"CheckInPhotoUrlResponse"},"CheckInResolvedContext":{"properties":{"user_id":{"type":"string","title":"User Id"},"first_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"First Name"},"kind":{"type":"string","title":"Kind"},"checkin_number":{"type":"integer","title":"Checkin Number"},"schedule_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Schedule Id"},"already_completed":{"type":"boolean","title":"Already Completed","default":false},"baseline_photos":{"items":{"$ref":"#/components/schemas/CheckInBaselinePhoto"},"type":"array","title":"Baseline Photos"},"sesso":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sesso"},"chiusura":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Chiusura"}},"type":"object","required":["user_id","first_name","kind","checkin_number"],"title":"CheckInResolvedContext","description":"Returned by /resolve — feeds the FE runner with everything it needs."},"CheckInStatus":{"properties":{"is_due":{"type":"boolean","title":"Is Due"},"status":{"type":"string","title":"Status"},"next_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next At"},"days_remaining":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Days Remaining"}},"type":"object","required":["is_due","status"],"title":"CheckInStatus"},"CheckInSubmit":{"properties":{"user_id":{"type":"string","title":"User Id"},"answers":{"additionalProperties":true,"type":"object","title":"Answers"},"provider_request":{"type":"boolean","title":"Provider Request","default":false}},"type":"object","required":["user_id","answers"],"title":"CheckInSubmit"},"CheckInSubmitV2":{"properties":{"user_id":{"type":"string","title":"User Id"},"token":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Token"},"checkin_number":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Checkin Number"},"kind":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Kind"},"adherence":{"type":"string","title":"Adherence"},"side_effects":{"items":{"type":"string"},"type":"array","title":"Side Effects"},"questions_for_doctor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Questions For Doctor"},"perceived_change":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Perceived Change"},"photo_keys":{"items":{"$ref":"#/components/schemas/PhotoKeyEntry"},"type":"array","title":"Photo Keys"},"note":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Note"},"provider_request":{"type":"boolean","title":"Provider Request","default":false},"gravidanza":{"anyOf":[{},{"type":"null"}],"title":"Gravidanza"}},"type":"object","required":["user_id","adherence"],"title":"CheckInSubmitV2"},"CheckinDetail":{"properties":{"check_in_id":{"type":"string","title":"Check In Id"},"user_id":{"type":"string","title":"User Id"},"case_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Case Id"},"patient_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Patient Name"},"patient_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Patient Email"},"patient_phone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Patient Phone"},"kind":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Kind"},"checkin_number":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Checkin Number"},"created_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Created At"},"completed_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Completed At"},"adherence":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Adherence"},"side_effects":{"items":{"type":"string"},"type":"array","title":"Side Effects"},"questions_for_doctor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Questions For Doctor"},"perceived_change":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Perceived Change"},"note":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Note"},"provider_request":{"type":"boolean","title":"Provider Request","default":false},"pregnancy":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Pregnancy"},"photos":{"items":{"$ref":"#/components/schemas/PhotoForReview"},"type":"array","title":"Photos"},"baseline_photos":{"items":{"$ref":"#/components/schemas/PhotoForReview"},"type":"array","title":"Baseline Photos"},"baseline_source":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Baseline Source"},"reviewed_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reviewed At"},"reviewed_by_admin_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reviewed By Admin Id"},"review_note":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Review Note"},"review_patient_message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Review Patient Message"},"review_service_message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Review Service Message"},"review_draft":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Review Draft"}},"type":"object","required":["check_in_id","user_id","case_id","patient_name","patient_email","patient_phone","kind","checkin_number","created_at","completed_at","adherence"],"title":"CheckinDetail"},"CheckinDraftRequest":{"properties":{"patient_message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Patient Message"},"service_message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Service Message"},"note":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Note"}},"type":"object","title":"CheckinDraftRequest","description":"Shared autosave draft (doctor + ops). Persists across sessions; cleared on review."},"CheckinListRow":{"properties":{"check_in_id":{"type":"string","title":"Check In Id"},"user_id":{"type":"string","title":"User Id"},"patient_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Patient Name"},"patient_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Patient Email"},"kind":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Kind"},"checkin_number":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Checkin Number"},"adherence":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Adherence"},"has_red_flag":{"type":"boolean","title":"Has Red Flag"},"has_provider_request":{"type":"boolean","title":"Has Provider Request"},"photo_count":{"type":"integer","title":"Photo Count"},"reviewed_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reviewed At"},"created_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Created At"}},"type":"object","required":["check_in_id","user_id","patient_name","patient_email","kind","checkin_number","adherence","has_red_flag","has_provider_request","photo_count"],"title":"CheckinListRow"},"CheckinOutstandingRow":{"properties":{"queue_id":{"type":"integer","title":"Queue Id"},"user_id":{"type":"string","title":"User Id"},"patient_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Patient Name"},"patient_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Patient Email"},"kind":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Kind"},"checkin_number":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Checkin Number"},"status":{"type":"string","title":"Status"},"scheduled_for":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Scheduled For"},"notified_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Notified At"},"reminder_sent_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reminder Sent At"},"sms_count":{"type":"integer","title":"Sms Count"},"email_count":{"type":"integer","title":"Email Count"}},"type":"object","required":["queue_id","user_id","patient_name","patient_email","kind","checkin_number","status","sms_count","email_count"],"title":"CheckinOutstandingRow","description":"A check-in we invited the patient to but that isn't completed yet —\nthe 'Da completare' tab. Sourced from checkin_send_queue, not check_ins."},"CheckinReviewRequest":{"properties":{"note":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Note"},"patient_message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Patient Message"},"service_message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Service Message"}},"type":"object","title":"CheckinReviewRequest"},"CheckinUpcomingRow":{"properties":{"user_id":{"type":"string","title":"User Id"},"patient_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Patient Name"},"patient_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Patient Email"},"kind":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Kind"},"checkin_number":{"type":"integer","title":"Checkin Number"},"next_check_in_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Check In At"},"sub_status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sub Status"}},"type":"object","required":["user_id","patient_name","patient_email","kind","checkin_number"],"title":"CheckinUpcomingRow","description":"A scheduled future check-in that WILL fire — the 'Prossimi' tab.\nSourced from check_in_schedules, restricted to active (non-churned),\nnon-paused users so it reflects what the scheduler will actually send."},"CheckoutInitRequest":{"properties":{"flow_id":{"type":"string","title":"Flow Id"},"evaluation_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Evaluation Id"},"user_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"},"email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email"},"phone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Phone"},"first_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"First Name"},"last_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Name"},"dob":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Dob"},"codice_fiscale":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Codice Fiscale"},"codice_fiscale_source":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Codice Fiscale Source"},"place_of_birth_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Place Of Birth Type"},"place_of_birth_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Place Of Birth Code"},"place_of_birth_display":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Place Of Birth Display"},"sex_at_birth":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sex At Birth"},"shipping_address":{"additionalProperties":true,"type":"object","title":"Shipping Address"},"product_id":{"type":"string","title":"Product Id"},"addon_ids":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Addon Ids","default":[]},"cadence":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cadence","default":"quarterly"},"promo_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Promo Code"}},"type":"object","required":["flow_id","shipping_address","product_id"],"title":"CheckoutInitRequest"},"ChurnPoint":{"properties":{"month":{"type":"string","title":"Month"},"new_customers":{"type":"integer","title":"New Customers"},"churned_customers":{"type":"integer","title":"Churned Customers"},"net_growth":{"type":"integer","title":"Net Growth"}},"type":"object","required":["month","new_customers","churned_customers","net_growth"],"title":"ChurnPoint"},"ClaimInviteRequest":{"properties":{"token":{"type":"string","title":"Token"},"password":{"type":"string","title":"Password"},"full_name":{"type":"string","title":"Full Name"}},"type":"object","required":["token","password","full_name"],"title":"ClaimInviteRequest"},"CodeCheck":{"properties":{"user_id":{"type":"string","maxLength":200,"title":"User Id"},"code":{"type":"string","pattern":"^[0-9]{6}$","title":"Code"}},"type":"object","required":["user_id","code"],"title":"CodeCheck"},"CodeCreate":{"properties":{"code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Code"},"label":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Label"}},"type":"object","title":"CodeCreate"},"CodePatch":{"properties":{"active":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Active"},"label":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Label"},"artwork_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Artwork Url"},"sticker_format":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sticker Format"}},"type":"object","title":"CodePatch"},"CodeRequest":{"properties":{"user_id":{"type":"string","maxLength":200,"title":"User Id"}},"type":"object","required":["user_id"],"title":"CodeRequest"},"CohortRow":{"properties":{"cohort_month":{"type":"string","title":"Cohort Month"},"cohort_size":{"type":"integer","title":"Cohort Size"},"retention_by_month":{"additionalProperties":{"anyOf":[{"type":"number"},{"type":"null"}]},"type":"object","title":"Retention By Month"}},"type":"object","required":["cohort_month","cohort_size","retention_by_month"],"title":"CohortRow","description":"One cohort row in the retention matrix.\n\ncohort_month: ISO date (e.g. 2026-04-01) — the month customers were acquired\ncohort_size: number of customers in this cohort\nretention_by_month: dict mapping offset 'M+0', 'M+1', etc. to retention %.\n                   'M+0' is always 100% by definition."},"ConfirmCheckoutRequest":{"properties":{"order_id":{"type":"string","title":"Order Id"},"client_secret":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Client Secret"}},"type":"object","required":["order_id"],"title":"ConfirmCheckoutRequest"},"ConfirmRenewalBody":{"properties":{"note":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Note"}},"type":"object","title":"ConfirmRenewalBody"},"ConfirmRequest":{"properties":{"order_id":{"type":"string","title":"Order Id"},"client_secret":{"type":"string","title":"Client Secret"}},"type":"object","required":["order_id","client_secret"],"title":"ConfirmRequest"},"ConfirmUploadRequest":{"properties":{"upload_type":{"type":"string","title":"Upload Type"},"key":{"type":"string","title":"Key"}},"type":"object","required":["upload_type","key"],"title":"ConfirmUploadRequest"},"ContactPlanBody":{"properties":{"preferred_combo_id":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}],"title":"Preferred Combo Id"},"default_cadence":{"anyOf":[{"type":"string","enum":["monthly","quarterly"]},{"type":"null"}],"title":"Default Cadence"},"contact_channel":{"anyOf":[{"type":"string","enum":["call","messages"]},{"type":"null"}],"title":"Contact Channel"},"contact_slot":{"anyOf":[{"type":"string","enum":["morning","afternoon","evening","any"]},{"type":"null"}],"title":"Contact Slot"},"team_message":{"anyOf":[{"type":"string","maxLength":1000},{"type":"null"}],"title":"Team Message"}},"type":"object","title":"ContactPlanBody"},"ContractRef":{"properties":{"type":{"type":"string","title":"Type"},"version":{"type":"string","title":"Version"},"vexatious":{"type":"boolean","title":"Vexatious","default":false}},"type":"object","required":["type","version"],"title":"ContractRef"},"CouponRequest":{"properties":{"code":{"type":"string","maxLength":40,"title":"Code"}},"type":"object","required":["code"],"title":"CouponRequest"},"CoversheetRequest":{"properties":{"case_ids":{"items":{"type":"string"},"type":"array","title":"Case Ids"},"batch_date":{"type":"string","title":"Batch Date"}},"type":"object","required":["case_ids"],"title":"CoversheetRequest"},"CreaContrattoRequest":{"properties":{"riferimento":{"type":"string","maxLength":500,"title":"Riferimento"},"ruolo":{"type":"string","enum":["creator","medico"],"title":"Ruolo"},"contenuti":{"type":"string","maxLength":2000,"title":"Contenuti"},"pubblicazione":{"type":"string","enum":["no","si"],"title":"Pubblicazione"},"termine":{"type":"string","maxLength":500,"title":"Termine"},"compenso":{"type":"string","maxLength":40,"title":"Compenso"},"consenso_salute":{"type":"boolean","title":"Consenso Salute","default":false},"firma_n9ve":{"type":"string","maxLength":533358,"title":"Firma N9Ve"},"giorni":{"type":"integer","title":"Giorni","default":30}},"type":"object","required":["riferimento","ruolo","contenuti","pubblicazione","termine","compenso","firma_n9ve"],"title":"CreaContrattoRequest"},"CreateExpenseBody":{"properties":{"category_id":{"type":"string","title":"Category Id"},"month":{"type":"string","title":"Month"},"amount_cents":{"type":"integer","exclusiveMinimum":0.0,"title":"Amount Cents"},"currency":{"type":"string","title":"Currency","default":"EUR"},"vendor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Vendor"},"notes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Notes"},"is_recurring":{"type":"boolean","title":"Is Recurring","default":false},"recurrence_end_date":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Recurrence End Date"}},"type":"object","required":["category_id","month","amount_cents"],"title":"CreateExpenseBody"},"CreateInviteRequest":{"properties":{"email":{"type":"string","title":"Email"},"role":{"type":"string","title":"Role"},"pharmacy_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Pharmacy Id"}},"type":"object","required":["email","role"],"title":"CreateInviteRequest"},"CreateManualUserRequest":{"properties":{"email":{"type":"string","title":"Email"},"temp_password":{"type":"string","title":"Temp Password"},"role":{"type":"string","title":"Role"},"full_name":{"type":"string","title":"Full Name"}},"type":"object","required":["email","temp_password","role","full_name"],"title":"CreateManualUserRequest"},"CreateRecoveryOrderRequest":{"properties":{"user_id":{"type":"string","title":"User Id","description":"Existing user_id whose checkout is being recovered."},"product_id":{"type":"string","title":"Product Id","description":"molecule_combinations.id (e.g. orale Combined SKU)."},"cadence":{"type":"string","enum":["monthly","quarterly"],"title":"Cadence","description":"Subscription cadence; drives both charge price and renewal interval.","default":"quarterly"},"addon_ids":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Addon Ids"},"reason":{"type":"string","minLength":3,"title":"Reason","description":"Audit reason (e.g. 'marco_address_recovery'). Logged with admin_id."},"evaluation_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Evaluation Id","description":"Optional: link to existing evaluation. If absent, a placeholder eval is created."}},"type":"object","required":["user_id","product_id","reason"],"title":"CreateRecoveryOrderRequest"},"CreateUserRequest":{"properties":{"email":{"type":"string","title":"Email"},"password":{"type":"string","title":"Password"},"full_name":{"type":"string","title":"Full Name"},"role":{"type":"string","title":"Role"},"chat_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Chat Name"},"chat_role":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Chat Role"},"chat_avatar_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Chat Avatar Url"},"pharmacy_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Pharmacy Id"}},"type":"object","required":["email","password","full_name","role"],"title":"CreateUserRequest"},"DaySchedule":{"properties":{"date_iso":{"type":"string","title":"Date Iso"},"weekday_it":{"type":"string","title":"Weekday It"},"firings":{"items":{"$ref":"#/components/schemas/ScheduledFiring"},"type":"array","title":"Firings"}},"type":"object","required":["date_iso","weekday_it","firings"],"title":"DaySchedule"},"DecisionPayload":{"properties":{"outcome_key":{"type":"string","maxLength":60,"title":"Outcome Key"},"deroga_reason":{"anyOf":[{"type":"string","maxLength":1000},{"type":"null"}],"title":"Deroga Reason"},"learned":{"type":"string","maxLength":2000,"minLength":3,"title":"Learned"},"not_visible":{"anyOf":[{"type":"string","maxLength":1000},{"type":"null"}],"title":"Not Visible"},"next_step":{"anyOf":[{"type":"string","maxLength":1000},{"type":"null"}],"title":"Next Step"},"next_draft":{"type":"boolean","title":"Next Draft","default":false},"stage":{"type":"string","pattern":"^(tappa|finale)$","title":"Stage","default":"finale"}},"type":"object","required":["outcome_key","learned"],"title":"DecisionPayload"},"DeliveryNoteBody":{"properties":{"note":{"type":"string","title":"Note","default":""}},"type":"object","title":"DeliveryNoteBody"},"DeriveCFRequest":{"properties":{"first_name":{"type":"string","title":"First Name"},"last_name":{"type":"string","title":"Last Name"},"dob":{"type":"string","title":"Dob"},"sex_assigned_at_birth":{"type":"string","title":"Sex Assigned At Birth"},"place_of_birth_code":{"type":"string","title":"Place Of Birth Code"}},"type":"object","required":["first_name","last_name","dob","sex_assigned_at_birth","place_of_birth_code"],"title":"DeriveCFRequest"},"Dichiarazione":{"properties":{"status":{"type":"string","title":"Status","description":"gravidanza, allattamento, cerca, non_possibile, contraccettivo, nessun_contraccettivo, non_noto"},"note":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}],"title":"Note"}},"type":"object","required":["status"],"title":"Dichiarazione"},"DoctorDecisionBody":{"properties":{"decision":{"type":"string","enum":["Eligible","Ineligible","NeedsMoreInfo"],"title":"Decision"},"reason_code":{"type":"string","title":"Reason Code"},"note":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Note"},"requested_items":{"anyOf":[{"items":{"additionalProperties":true,"type":"object"},"type":"array"},{"type":"null"}],"title":"Requested Items"},"approval_type":{"anyOf":[{"type":"string","enum":["nre","white_recipe","non_rx"]},{"type":"null"}],"title":"Approval Type"},"nre_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Nre Code"},"white_recipe_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"White Recipe Id"},"message_to_patient":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Message To Patient"},"items":{"anyOf":[{"items":{"additionalProperties":true,"type":"object"},"type":"array"},{"type":"null"}],"title":"Items"},"doctor_report":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Doctor Report"},"prescription_pdf_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Prescription Pdf Key"},"prescription_valid_until":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Prescription Valid Until"},"recommended_integrators":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Recommended Integrators"}},"type":"object","required":["decision","reason_code"],"title":"DoctorDecisionBody"},"DoubtsRequest":{"properties":{"user_id":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"User Id"}},"type":"object","title":"DoubtsRequest"},"DraftBody":{"properties":{"path":{"type":"string","enum":["A","C"],"title":"Path"},"definition":{"additionalProperties":true,"type":"object","title":"Definition"},"note":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}],"title":"Note"},"refuse_if_draft":{"type":"boolean","title":"Refuse If Draft","default":false},"authors_from":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Authors From"}},"type":"object","required":["path","definition"],"title":"DraftBody"},"EmailBody":{"properties":{"evaluation_id":{"type":"string","maxLength":64,"title":"Evaluation Id"},"email":{"type":"string","maxLength":254,"title":"Email"}},"type":"object","required":["evaluation_id","email"],"title":"EmailBody"},"EvaluationBody":{"properties":{"outcome":{"type":"string","enum":["therapy","no_therapy"],"title":"Outcome"},"options":{"items":{"$ref":"#/components/schemas/ProposedTherapy"},"type":"array","title":"Options","default":[]},"message":{"type":"string","maxLength":4000,"title":"Message"},"doctor_pick":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}],"title":"Doctor Pick"},"internal_note":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Internal Note"}},"type":"object","required":["outcome","message"],"title":"EvaluationBody"},"EventIn":{"properties":{"platform":{"type":"string","maxLength":20,"title":"Platform"},"comment_id":{"type":"string","maxLength":200,"title":"Comment Id"},"post_id":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Post Id"},"post_url":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}],"title":"Post Url"},"author_handle":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Author Handle"},"comment_text":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Comment Text"},"commented_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Commented At"},"rule_id":{"anyOf":[{"type":"string","maxLength":50},{"type":"null"}],"title":"Rule Id"},"matched_keyword":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Matched Keyword"},"action":{"type":"string","maxLength":40,"title":"Action"},"detail":{"anyOf":[{"type":"string","maxLength":1000},{"type":"null"}],"title":"Detail"},"mode":{"anyOf":[{"type":"string","maxLength":20},{"type":"null"}],"title":"Mode"}},"type":"object","required":["platform","comment_id","action"],"title":"EventIn"},"EventsBatch":{"properties":{"events":{"items":{"$ref":"#/components/schemas/EventIn"},"type":"array","title":"Events"}},"type":"object","required":["events"],"title":"EventsBatch"},"ExpenseCategory":{"properties":{"id":{"type":"string","title":"Id"},"name":{"type":"string","title":"Name"},"kind":{"type":"string","title":"Kind"},"sort_order":{"type":"integer","title":"Sort Order"},"auto_source":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Auto Source"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"}},"type":"object","required":["id","name","kind","sort_order"],"title":"ExpenseCategory"},"ExpenseEntry":{"properties":{"id":{"type":"integer","title":"Id"},"category_id":{"type":"string","title":"Category Id"},"category_name":{"type":"string","title":"Category Name"},"category_kind":{"type":"string","title":"Category Kind"},"month":{"type":"string","title":"Month"},"amount_cents":{"type":"integer","title":"Amount Cents"},"currency":{"type":"string","title":"Currency"},"amount_eur_cents":{"type":"integer","title":"Amount Eur Cents"},"vendor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Vendor"},"source":{"type":"string","title":"Source"},"notes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Notes"},"created_at":{"type":"string","title":"Created At"},"is_recurring":{"type":"boolean","title":"Is Recurring","default":false},"recurrence_end_date":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Recurrence End Date"},"recurrence_origin_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Recurrence Origin Id"},"invoice_filename":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Invoice Filename"},"invoice_uploaded_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Invoice Uploaded At"},"has_invoice":{"type":"boolean","title":"Has Invoice","default":false}},"type":"object","required":["id","category_id","category_name","category_kind","month","amount_cents","currency","amount_eur_cents","source","created_at"],"title":"ExpenseEntry"},"ExperimentPayload":{"properties":{"experiment_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Experiment Id"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"lane":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Lane"},"kind":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Kind"},"brief":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Brief"},"rule":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Rule"},"tracking":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Tracking"},"budget_cents":{"anyOf":[{"type":"integer","maximum":10000000.0,"minimum":0.0},{"type":"null"}],"title":"Budget Cents"},"start_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Start Date"},"read_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Read Date"},"decision_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Decision Date"}},"type":"object","title":"ExperimentPayload"},"FaqIn":{"properties":{"question":{"type":"string","maxLength":200,"minLength":1,"title":"Question"},"answer":{"type":"string","maxLength":2000,"minLength":1,"title":"Answer"},"category":{"type":"string","maxLength":60,"title":"Category","default":""},"is_active":{"type":"boolean","title":"Is Active","default":true},"ads_safe":{"type":"boolean","title":"Ads Safe","default":false},"sort_order":{"type":"integer","maximum":9999.0,"minimum":0.0,"title":"Sort Order","default":0}},"type":"object","required":["question","answer"],"title":"FaqIn"},"FeeCheckoutRequest":{"properties":{"flow_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Flow Id","default":"q4"},"evaluation_id":{"type":"string","title":"Evaluation Id"},"user_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"},"email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email"},"phone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Phone"},"first_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"First Name"},"last_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Name"},"dob":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Dob"},"codice_fiscale":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Codice Fiscale"},"codice_fiscale_source":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Codice Fiscale Source"},"place_of_birth_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Place Of Birth Type"},"place_of_birth_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Place Of Birth Code"},"place_of_birth_display":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Place Of Birth Display"},"sex_at_birth":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sex At Birth"},"promo_code":{"anyOf":[{"type":"string","maxLength":40},{"type":"null"}],"title":"Promo Code"},"shipping_address":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Shipping Address"},"esito_mostrato":{"anyOf":[{"type":"string","maxLength":40},{"type":"null"}],"title":"Esito Mostrato"}},"type":"object","required":["evaluation_id"],"title":"FeeCheckoutRequest"},"FirmaRequest":{"properties":{"nome":{"type":"string","maxLength":500,"title":"Nome"},"indirizzo":{"type":"string","maxLength":500,"title":"Indirizzo"},"codice":{"type":"string","maxLength":100,"title":"Codice"},"handle":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}],"title":"Handle"},"luogo":{"type":"string","maxLength":300,"title":"Luogo"},"ordine_provincia":{"anyOf":[{"type":"string","maxLength":300},{"type":"null"}],"title":"Ordine Provincia"},"ordine_numero":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}],"title":"Ordine Numero"},"firma":{"type":"string","maxLength":533358,"title":"Firma"},"firma_approvazione":{"type":"string","maxLength":533358,"title":"Firma Approvazione"},"consenso_salute":{"anyOf":[{"type":"string","enum":["acconsento","non_acconsento"]},{"type":"null"}],"title":"Consenso Salute"},"firma_consenso":{"anyOf":[{"type":"string","maxLength":533358},{"type":"null"}],"title":"Firma Consenso"},"versione":{"anyOf":[{"type":"string","maxLength":20},{"type":"null"}],"title":"Versione"}},"type":"object","required":["nome","indirizzo","codice","luogo","firma","firma_approvazione"],"title":"FirmaRequest"},"FlowCreate":{"properties":{"name":{"type":"string","title":"Name"},"version":{"type":"string","title":"Version"},"description":{"type":"string","title":"Description"},"steps":{"items":{"$ref":"#/components/schemas/StepCreate"},"type":"array","title":"Steps"}},"type":"object","required":["name","version","steps"],"title":"FlowCreate"},"FlowUpdate":{"properties":{"name":{"type":"string","title":"Name"},"description":{"type":"string","title":"Description"},"is_active":{"type":"boolean","title":"Is Active"},"steps":{"items":{"$ref":"#/components/schemas/StepCreate"},"type":"array","title":"Steps"}},"type":"object","required":["steps"],"title":"FlowUpdate"},"ForgotPasswordRequest":{"properties":{"email":{"type":"string","title":"Email"}},"type":"object","required":["email"],"title":"ForgotPasswordRequest"},"GenerateLinkRequest":{"properties":{"user_id":{"type":"string","title":"User Id"},"contracts":{"items":{"$ref":"#/components/schemas/ContractRef"},"type":"array","title":"Contracts"},"expires_days":{"type":"integer","title":"Expires Days","default":14}},"type":"object","required":["user_id","contracts"],"title":"GenerateLinkRequest"},"GeocodeRequest":{"properties":{"address":{"type":"string","title":"Address"}},"type":"object","required":["address"],"title":"GeocodeRequest"},"GeocodeResponse":{"properties":{"postal_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Postal Code"},"formatted_address":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Formatted Address"}},"type":"object","title":"GeocodeResponse"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"Heartbeat":{"properties":{"mode":{"type":"string","maxLength":20,"title":"Mode"},"host":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Host"},"last_error":{"anyOf":[{"type":"string","maxLength":1000},{"type":"null"}],"title":"Last Error"}},"type":"object","required":["mode"],"title":"Heartbeat"},"InputPayload":{"properties":{"metric":{"type":"string","title":"Metric"},"value":{"type":"integer","maximum":1000000.0,"minimum":0.0,"title":"Value"},"as_of":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"As Of"},"note":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}],"title":"Note"}},"type":"object","required":["metric","value"],"title":"InputPayload"},"KYCData":{"properties":{"ordine_numero":{"type":"string","title":"Ordine Numero"},"ordine_provincia":{"type":"string","title":"Ordine Provincia"},"rc_insurance_expiry":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Rc Insurance Expiry"},"ts_codice_fiscale":{"type":"string","title":"Ts Codice Fiscale"},"ts_confirmed":{"type":"boolean","title":"Ts Confirmed"}},"type":"object","required":["ordine_numero","ordine_provincia","ts_codice_fiscale","ts_confirmed"],"title":"KYCData"},"LeiBody":{"properties":{"evaluation_id":{"type":"string","maxLength":64,"title":"Evaluation Id"},"anteprima":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Anteprima"}},"type":"object","required":["evaluation_id"],"title":"LeiBody"},"LinkNuovoPayload":{"properties":{"token":{"type":"string","maxLength":64,"minLength":1,"title":"Token"},"redirect":{"anyOf":[{"type":"string","maxLength":512},{"type":"null"}],"title":"Redirect"}},"type":"object","required":["token"],"title":"LinkNuovoPayload"},"LiveAddressRequest":{"properties":{"user_id":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"User Id"},"shipping_address":{"$ref":"#/components/schemas/ShippingAddress"}},"type":"object","required":["shipping_address"],"title":"LiveAddressRequest"},"LoginRequest":{"properties":{"email":{"type":"string","title":"Email"},"password":{"type":"string","title":"Password"}},"type":"object","required":["email","password"],"title":"LoginRequest"},"MedicalApproval":{"properties":{"name":{"type":"string","maxLength":120,"minLength":3,"title":"Name"},"date":{"type":"string","format":"date","title":"Date"}},"type":"object","required":["name","date"],"title":"MedicalApproval","description":"Who approved the clinical texts (quiz4.clinical_changes), and when: required to publish a change to them."},"MemberAdd":{"properties":{"who":{"type":"string","maxLength":200,"minLength":3,"title":"Who"}},"type":"object","required":["who"],"title":"MemberAdd"},"MetaBreakdownRow":{"properties":{"campaign":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Campaign"},"adset":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Adset"},"ad":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ad"},"new_customers":{"type":"integer","title":"New Customers"},"revenue_180d_cents":{"type":"integer","title":"Revenue 180D Cents"}},"type":"object","required":["campaign","adset","ad","new_customers","revenue_180d_cents"],"title":"MetaBreakdownRow","description":"One campaign→adset→ad path within the Meta channel — real Meta names from\nattribution_resolved. Powers the expandable Meta row in the dashboard."},"MonthlyPnL":{"properties":{"month":{"type":"string","title":"Month"},"gross_revenue_cents":{"type":"integer","title":"Gross Revenue Cents"},"refunds_cents":{"type":"integer","title":"Refunds Cents"},"chargebacks_cents":{"type":"integer","title":"Chargebacks Cents"},"net_revenue_cents":{"type":"integer","title":"Net Revenue Cents"},"cogs_pharmacy_cents":{"type":"integer","title":"Cogs Pharmacy Cents"},"gross_profit_cents":{"type":"integer","title":"Gross Profit Cents"},"gross_margin_pct":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Gross Margin Pct"},"stripe_fees_cents":{"type":"integer","title":"Stripe Fees Cents"},"shipping_cents":{"type":"integer","title":"Shipping Cents"},"sms_cents":{"type":"integer","title":"Sms Cents"},"email_cents":{"type":"integer","title":"Email Cents"},"contribution_margin_cents":{"type":"integer","title":"Contribution Margin Cents"},"contribution_margin_pct":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Contribution Margin Pct"},"marketing_meta_cents":{"type":"integer","title":"Marketing Meta Cents"},"marketing_tiktok_cents":{"type":"integer","title":"Marketing Tiktok Cents"},"marketing_google_cents":{"type":"integer","title":"Marketing Google Cents"},"marketing_freelancers_cents":{"type":"integer","title":"Marketing Freelancers Cents"},"marketing_agency_cents":{"type":"integer","title":"Marketing Agency Cents"},"marketing_creative_cents":{"type":"integer","title":"Marketing Creative Cents"},"marketing_total_cents":{"type":"integer","title":"Marketing Total Cents"},"opex_total_cents":{"type":"integer","title":"Opex Total Cents"},"opex_entries":{"items":{"$ref":"#/components/schemas/ExpenseEntry"},"type":"array","title":"Opex Entries"},"ebitda_cents":{"type":"integer","title":"Ebitda Cents"},"ebitda_margin_pct":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Ebitda Margin Pct"},"vat_cents":{"type":"integer","title":"Vat Cents","default":0},"platform_margin_cents":{"type":"integer","title":"Platform Margin Cents","default":0},"net_income_cents":{"type":"integer","title":"Net Income Cents","default":0},"paid_orders_count":{"type":"integer","title":"Paid Orders Count"},"new_customers_count":{"type":"integer","title":"New Customers Count"},"renewal_orders_count":{"type":"integer","title":"Renewal Orders Count"},"refunded_orders_count":{"type":"integer","title":"Refunded Orders Count","default":0},"disputed_lost_count":{"type":"integer","title":"Disputed Lost Count","default":0},"aov_cents":{"type":"integer","title":"Aov Cents","default":0},"evaluation_count":{"type":"integer","title":"Evaluation Count","default":0},"evaluation_revenue_cents":{"type":"integer","title":"Evaluation Revenue Cents","default":0},"evaluation_refunds_cents":{"type":"integer","title":"Evaluation Refunds Cents","default":0},"evaluation_refunded_count":{"type":"integer","title":"Evaluation Refunded Count","default":0},"snapshot_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Snapshot At"}},"type":"object","required":["month","gross_revenue_cents","refunds_cents","chargebacks_cents","net_revenue_cents","cogs_pharmacy_cents","gross_profit_cents","gross_margin_pct","stripe_fees_cents","shipping_cents","sms_cents","email_cents","contribution_margin_cents","contribution_margin_pct","marketing_meta_cents","marketing_tiktok_cents","marketing_google_cents","marketing_freelancers_cents","marketing_agency_cents","marketing_creative_cents","marketing_total_cents","opex_total_cents","opex_entries","ebitda_cents","ebitda_margin_pct","paid_orders_count","new_customers_count","renewal_orders_count"],"title":"MonthlyPnL","description":"Single month VP-grade P&L row."},"MutationAddItem":{"properties":{"product_id":{"type":"string","title":"Product Id"},"nre_code":{"type":"string","title":"Nre Code"}},"type":"object","required":["product_id"],"title":"MutationAddItem"},"MutationRequest":{"properties":{"add":{"items":{"$ref":"#/components/schemas/MutationAddItem"},"type":"array","title":"Add","default":[]},"remove":{"items":{"type":"string"},"type":"array","title":"Remove","default":[]},"reason":{"type":"string","title":"Reason"},"doctor_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Doctor Id"}},"type":"object","required":["reason"],"title":"MutationRequest"},"NewFlowControlRow":{"properties":{"request_id":{"type":"string","title":"Request Id"},"user_id":{"type":"string","title":"User Id"},"case_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Case Id"},"patient_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Patient Name"},"patient_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Patient Email"},"kind":{"type":"string","title":"Kind"},"completed_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Completed At"},"outcomes":{"items":{"type":"string"},"type":"array","title":"Outcomes"},"signal_read_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Signal Read At"}},"type":"object","required":["request_id","user_id","case_id","patient_name","patient_email","kind"],"title":"NewFlowControlRow","description":"A control of «Mantieni attiva la ricetta» the patient completed — the 'Flusso nuovo' tab.\nSourced from ricetta_requests, never written to check_ins: read-only here, no review, no badge.\nThe answers stay on the case page (RicettaBox); the list says only where they went."},"NewPrescriptionBody":{"properties":{"source":{"type":"string","enum":["renewal","product_change","correction"],"title":"Source","default":"renewal"},"pdf_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Pdf Key"},"nre_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Nre Code"},"valid_until":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Valid Until"},"note":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Note"},"product_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Product Id"},"un_ciclo":{"type":"boolean","title":"Un Ciclo","default":false}},"type":"object","title":"NewPrescriptionBody"},"NoteDraftBody":{"properties":{"preferred_combo_id":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}],"title":"Preferred Combo Id"}},"type":"object","title":"NoteDraftBody"},"NotePayload":{"properties":{"text":{"type":"string","maxLength":2000,"minLength":3,"title":"Text"}},"type":"object","required":["text"],"title":"NotePayload"},"NotificationRead":{"properties":{"id":{"type":"string","title":"Id"},"category":{"type":"string","title":"Category"},"title":{"type":"string","title":"Title"},"body":{"type":"string","title":"Body"},"action_link":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Action Link"},"is_read":{"type":"boolean","title":"Is Read"},"created_at":{"type":"string","title":"Created At"}},"type":"object","required":["id","category","title","body","action_link","is_read","created_at"],"title":"NotificationRead"},"OnboardingSubmit":{"properties":{"legal_name":{"type":"string","title":"Legal Name"},"brand_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Brand Name"},"contact_name":{"type":"string","title":"Contact Name"},"contact_phone":{"type":"string","title":"Contact Phone"},"iban":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Iban"},"account_holder":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Account Holder"},"payout_method":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Payout Method"},"fiscal_regime":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Fiscal Regime"},"paypal_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Paypal Email"},"tax_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tax Id"},"address":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Address"},"shipping_address":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Shipping Address"},"contact_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Contact Email"},"logo_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Logo Url"},"accepted":{"type":"boolean","title":"Accepted","default":false},"accepted_clauses":{"type":"boolean","title":"Accepted Clauses","default":false},"accepted_by_name":{"type":"string","title":"Accepted By Name","default":""}},"type":"object","required":["legal_name","contact_name","contact_phone"],"title":"OnboardingSubmit"},"OpsCallBody":{"properties":{"outcome":{"type":"string","enum":["answered","no_answer","call_back"],"title":"Outcome"},"called_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Called At"},"note":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Note"}},"type":"object","required":["outcome"],"title":"OpsCallBody"},"OutcomeBody":{"properties":{"evaluation_id":{"type":"string","maxLength":64,"title":"Evaluation Id"},"origine":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Origine"},"dal_link":{"type":"boolean","title":"Dal Link","default":false},"chiave":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Chiave"},"da_recupero":{"type":"boolean","title":"Da Recupero","default":false}},"type":"object","required":["evaluation_id"],"title":"OutcomeBody"},"OverviewKPI":{"properties":{"current_month":{"type":"string","title":"Current Month"},"period":{"type":"string","title":"Period","default":"month"},"period_label":{"type":"string","title":"Period Label","default":""},"net_revenue_cents":{"type":"integer","title":"Net Revenue Cents"},"net_revenue_delta_pct":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Net Revenue Delta Pct"},"total_spent_cents":{"type":"integer","title":"Total Spent Cents"},"total_spent_delta_pct":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Total Spent Delta Pct"},"cogs_pharmacy_cents":{"type":"integer","title":"Cogs Pharmacy Cents"},"cogs_pharmacy_delta_pct":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Cogs Pharmacy Delta Pct"},"meta_spend_cents":{"type":"integer","title":"Meta Spend Cents"},"meta_spend_delta_pct":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Meta Spend Delta Pct"},"ebitda_cents":{"type":"integer","title":"Ebitda Cents"},"ebitda_margin_pct":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Ebitda Margin Pct"},"median_lifetime_months":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Median Lifetime Months"},"trailing_12m_churn_pct":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Trailing 12M Churn Pct"},"gross_revenue_cents":{"type":"integer","title":"Gross Revenue Cents"},"refunds_cents":{"type":"integer","title":"Refunds Cents"},"stripe_fees_cents":{"type":"integer","title":"Stripe Fees Cents"},"shipping_cents":{"type":"integer","title":"Shipping Cents"},"platform_margin_cents":{"type":"integer","title":"Platform Margin Cents"},"vat_cents":{"type":"integer","title":"Vat Cents"},"net_income_cents":{"type":"integer","title":"Net Income Cents"},"paid_orders_count":{"type":"integer","title":"Paid Orders Count"},"new_orders_count":{"type":"integer","title":"New Orders Count"},"renewal_orders_count":{"type":"integer","title":"Renewal Orders Count"},"refunded_orders_count":{"type":"integer","title":"Refunded Orders Count"},"disputed_lost_count":{"type":"integer","title":"Disputed Lost Count"},"aov_cents":{"type":"integer","title":"Aov Cents"},"evaluation_count":{"type":"integer","title":"Evaluation Count","default":0},"evaluation_revenue_cents":{"type":"integer","title":"Evaluation Revenue Cents","default":0},"evaluation_refunds_cents":{"type":"integer","title":"Evaluation Refunds Cents","default":0},"evaluation_refunded_count":{"type":"integer","title":"Evaluation Refunded Count","default":0}},"type":"object","required":["current_month","net_revenue_cents","net_revenue_delta_pct","total_spent_cents","total_spent_delta_pct","cogs_pharmacy_cents","cogs_pharmacy_delta_pct","meta_spend_cents","meta_spend_delta_pct","ebitda_cents","ebitda_margin_pct","median_lifetime_months","trailing_12m_churn_pct","gross_revenue_cents","refunds_cents","stripe_fees_cents","shipping_cents","platform_margin_cents","vat_cents","net_income_cents","paid_orders_count","new_orders_count","renewal_orders_count","refunded_orders_count","disputed_lost_count","aov_cents"],"title":"OverviewKPI","description":"Top-of-page strip: current period vs previous period of same length."},"PartnerCreate":{"properties":{"name":{"type":"string","title":"Name"},"type":{"type":"string","title":"Type","default":"barbershop"},"brand_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Brand Name"},"contact_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Contact Name"},"contact_phone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Contact Phone"},"iban":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Iban"},"account_holder":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Account Holder"},"payout_method":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Payout Method"},"paypal_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Paypal Email"},"fiscal_regime":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Fiscal Regime"},"logo_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Logo Url"},"acquisition_reward_cents":{"type":"integer","title":"Acquisition Reward Cents","default":3000},"redemption_reward_cents":{"type":"integer","title":"Redemption Reward Cents","default":2000},"patient_discount_cents":{"type":"integer","title":"Patient Discount Cents","default":2000},"discount_expiry_days":{"type":"integer","title":"Discount Expiry Days","default":90},"initial_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Initial Code"}},"type":"object","required":["name"],"title":"PartnerCreate"},"PartnerPatch":{"properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Type"},"status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"},"brand_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Brand Name"},"legal_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Legal Name"},"tax_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tax Id"},"address":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Address"},"shipping_address":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Shipping Address"},"contact_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Contact Email"},"contact_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Contact Name"},"contact_phone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Contact Phone"},"iban":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Iban"},"account_holder":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Account Holder"},"payout_method":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Payout Method"},"paypal_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Paypal Email"},"fiscal_regime":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Fiscal Regime"},"logo_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Logo Url"},"acquisition_reward_cents":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Acquisition Reward Cents"},"redemption_reward_cents":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Redemption Reward Cents"},"patient_discount_cents":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Patient Discount Cents"},"discount_expiry_days":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Discount Expiry Days"},"stripe_connect_account_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Stripe Connect Account Id"}},"type":"object","title":"PartnerPatch"},"PasswordResetRequest":{"properties":{"password":{"type":"string","title":"Password"}},"type":"object","required":["password"],"title":"PasswordResetRequest"},"PatientInfoResponseBody":{"properties":{"responses":{"additionalProperties":true,"type":"object","title":"Responses"},"photo_keys":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Photo Keys"},"idempotency_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Idempotency Key"},"user_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},"type":"object","required":["responses"],"title":"PatientInfoResponseBody"},"PatientSummary":{"properties":{"user_id":{"type":"string","title":"User Id"},"email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email"},"phone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Phone"},"identity_state":{"type":"string","title":"Identity State"},"onboarding_state":{"type":"string","title":"Onboarding State"}},"type":"object","required":["user_id","email","phone","identity_state","onboarding_state"],"title":"PatientSummary"},"PaymentInfoRequest":{"properties":{"iban":{"type":"string","title":"Iban"},"iban_name":{"type":"string","title":"Iban Name"},"phone":{"type":"string","title":"Phone"},"biz_type":{"type":"string","title":"Biz Type"},"piva":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Piva"}},"type":"object","required":["iban","iban_name","phone","biz_type"],"title":"PaymentInfoRequest"},"PaymentUpdateRequest":{"properties":{"user_id":{"type":"string","title":"User Id"}},"type":"object","required":["user_id"],"title":"PaymentUpdateRequest"},"PaypalSetupRequest":{"properties":{"order_id":{"type":"string","title":"Order Id"}},"type":"object","required":["order_id"],"title":"PaypalSetupRequest"},"PharmacyCreate":{"properties":{"name":{"type":"string","title":"Name"},"address":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Address"},"city":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"City"},"cap":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cap"},"iban":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Iban"},"iban_intestatario":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Iban Intestatario"},"p_iva":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"P Iva"},"ragione_sociale":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ragione Sociale"},"codice_ministeriale":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Codice Ministeriale"},"direttore_nome":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Direttore Nome"},"direttore_ordine":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Direttore Ordine"},"pec":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Pec"},"codice_sdi":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Codice Sdi"}},"type":"object","required":["name"],"title":"PharmacyCreate"},"PharmacyResponse":{"properties":{"pharmacy_id":{"type":"string","title":"Pharmacy Id"},"name":{"type":"string","title":"Name"},"address":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Address"},"city":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"City"},"cap":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cap"},"iban":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Iban"},"iban_intestatario":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Iban Intestatario"},"p_iva":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"P Iva"},"ragione_sociale":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ragione Sociale"},"codice_ministeriale":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Codice Ministeriale"},"direttore_nome":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Direttore Nome"},"direttore_ordine":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Direttore Ordine"},"pec":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Pec"},"codice_sdi":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Codice Sdi"},"created_at":{"type":"string","title":"Created At"}},"type":"object","required":["pharmacy_id","name","created_at"],"title":"PharmacyResponse"},"PhotoForReview":{"properties":{"slot":{"type":"string","title":"Slot"},"url":{"type":"string","title":"Url"},"uploaded_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Uploaded At"}},"type":"object","required":["slot","url"],"title":"PhotoForReview"},"PhotoKey":{"properties":{"slot":{"type":"string","title":"Slot"},"key":{"type":"string","title":"Key"}},"type":"object","required":["slot","key"],"title":"PhotoKey"},"PhotoKeyEntry":{"properties":{"slot":{"type":"string","title":"Slot"},"key":{"type":"string","title":"Key"},"uploaded_at":{"type":"string","title":"Uploaded At"}},"type":"object","required":["slot","key","uploaded_at"],"title":"PhotoKeyEntry"},"PhotoUrl":{"properties":{"token":{"type":"string","maxLength":32,"minLength":4,"title":"Token"},"slot":{"type":"string","title":"Slot"}},"type":"object","required":["token","slot"],"title":"PhotoUrl"},"PinsIn":{"properties":{"faq_ids":{"items":{"type":"integer"},"type":"array","title":"Faq Ids"}},"type":"object","required":["faq_ids"],"title":"PinsIn"},"PipelineSummary":{"properties":{"d0":{"type":"integer","title":"D0"},"d1":{"type":"integer","title":"D1"},"d3":{"type":"integer","title":"D3"},"d7":{"type":"integer","title":"D7"},"suppressed":{"type":"integer","title":"Suppressed"}},"type":"object","required":["d0","d1","d3","d7","suppressed"],"title":"PipelineSummary"},"PlanProductBody":{"properties":{"product_id":{"type":"string","title":"Product Id"},"note":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Note"}},"type":"object","required":["product_id"],"title":"PlanProductBody"},"PostponeBody":{"properties":{"reason":{"type":"string","title":"Reason"}},"type":"object","required":["reason"],"title":"PostponeBody"},"PrescriptionPresignedRequest":{"properties":{"case_id":{"type":"string","title":"Case Id"},"file_type":{"type":"string","title":"File Type","default":"application/pdf"}},"type":"object","required":["case_id"],"title":"PrescriptionPresignedRequest"},"PresignedUrlRequest":{"properties":{"file_type":{"type":"string","title":"File Type"},"section":{"type":"string","title":"Section"}},"type":"object","required":["file_type","section"],"title":"PresignedUrlRequest"},"PreviewResponse":{"properties":{"step":{"type":"string","title":"Step"},"channel":{"type":"string","title":"Channel"},"available":{"type":"boolean","title":"Available"},"subject":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Subject"},"body":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Body"},"reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reason"},"first_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"First Name"}},"type":"object","required":["step","channel","available"],"title":"PreviewResponse"},"Product":{"properties":{"id":{"type":"string","title":"Id"},"name":{"type":"string","title":"Name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"image_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Image Url"},"price_cents":{"type":"integer","title":"Price Cents"},"billing_interval_months":{"type":"integer","title":"Billing Interval Months","default":3},"currency":{"type":"string","title":"Currency","default":"EUR"},"features":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Features","default":[]},"side_effects":{"anyOf":[{"items":{"additionalProperties":true,"type":"object"},"type":"array"},{"type":"null"}],"title":"Side Effects","default":[]},"is_default":{"type":"boolean","title":"Is Default","default":false},"category":{"type":"string","title":"Category","default":"hair_loss"},"requires_codice_fiscale":{"type":"boolean","title":"Requires Codice Fiscale","default":false},"requires_photos":{"type":"boolean","title":"Requires Photos","default":true},"medical_input_type":{"type":"string","title":"Medical Input Type","default":"REQUIRE_NRBE"},"type":{"type":"string","title":"Type","default":"molecule_combo"},"monthly_price_cents":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Monthly Price Cents"},"recommended_integrator_ids":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Recommended Integrator Ids","default":[]},"unit_form":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Unit Form"}},"type":"object","required":["id","name","price_cents"],"title":"Product"},"ProgressRequest":{"properties":{"evaluation_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Evaluation Id"},"flow_id":{"type":"string","title":"Flow Id"},"answers":{"items":{"$ref":"#/components/schemas/AnswerSnapshot"},"type":"array","title":"Answers"},"attribution":{"anyOf":[{},{"type":"null"}],"title":"Attribution"}},"type":"object","required":["flow_id","answers"],"title":"ProgressRequest"},"PromoValidateRequest":{"properties":{"code":{"type":"string","title":"Code"},"product_id":{"type":"string","title":"Product Id"},"cadence":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cadence","default":"quarterly"},"is_local_pharmacy":{"type":"boolean","title":"Is Local Pharmacy","default":false},"user_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},"type":"object","required":["code","product_id"],"title":"PromoValidateRequest"},"ProposedTherapy":{"properties":{"combo_id":{"type":"string","maxLength":100,"title":"Combo Id"},"prescription_pdf_key":{"anyOf":[{"type":"string","maxLength":300},{"type":"null"}],"title":"Prescription Pdf Key"},"prescription_file_name":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Prescription File Name"}},"type":"object","required":["combo_id"],"title":"ProposedTherapy","description":"A product: the patient chooses the cadence (both are priced by the server)."},"PublishBody":{"properties":{"note":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}],"title":"Note"},"accept_failures":{"type":"boolean","title":"Accept Failures","default":false},"base_hash":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Base Hash"},"medical_approval":{"anyOf":[{"$ref":"#/components/schemas/MedicalApproval"},{"type":"null"}]}},"type":"object","title":"PublishBody"},"PublishItem":{"properties":{"version_id":{"type":"string","maxLength":64,"title":"Version Id"},"base_hash":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Base Hash"}},"type":"object","required":["version_id"],"title":"PublishItem"},"PublishManyBody":{"properties":{"versions":{"items":{"$ref":"#/components/schemas/PublishItem"},"type":"array","maxItems":2,"minItems":1,"title":"Versions"},"note":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}],"title":"Note"},"accept_failures":{"type":"boolean","title":"Accept Failures","default":false},"medical_approval":{"anyOf":[{"$ref":"#/components/schemas/MedicalApproval"},{"type":"null"}]},"refuse_stale":{"type":"boolean","title":"Refuse Stale","default":false},"changes_count":{"anyOf":[{"type":"integer","maximum":100000.0,"minimum":0.0},{"type":"null"}],"title":"Changes Count"}},"type":"object","required":["versions"],"title":"PublishManyBody"},"QuizFlowResponse":{"properties":{"flow_id":{"type":"string","title":"Flow Id"},"version":{"type":"string","title":"Version"},"steps":{"items":{"$ref":"#/components/schemas/QuizStepConfig"},"type":"array","title":"Steps"}},"type":"object","required":["flow_id","version","steps"],"title":"QuizFlowResponse"},"QuizStepConfig":{"properties":{"step_id":{"type":"string","title":"Step Id"},"type":{"type":"string","title":"Type"},"config":{"additionalProperties":true,"type":"object","title":"Config"}},"type":"object","required":["step_id","type","config"],"title":"QuizStepConfig"},"ReassignBody":{"properties":{"to":{"type":"string","title":"To"}},"type":"object","required":["to"],"title":"ReassignBody"},"RecentTouchRow":{"properties":{"id":{"type":"integer","title":"Id"},"campaign_id":{"type":"string","title":"Campaign Id"},"user_id":{"type":"string","title":"User Id"},"first_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"First Name"},"email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email"},"phone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Phone"},"channel":{"type":"string","title":"Channel"},"recipient":{"type":"string","title":"Recipient"},"template_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Template Name"},"sent_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sent At"},"delivered_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Delivered At"},"opened_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Opened At"},"clicked_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Clicked At"},"error_message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error Message"},"is_smoke":{"type":"boolean","title":"Is Smoke"}},"type":"object","required":["id","campaign_id","user_id","first_name","email","phone","channel","recipient","template_name","sent_at","delivered_at","opened_at","clicked_at","error_message","is_smoke"],"title":"RecentTouchRow"},"RecoverOrderRequest":{"properties":{"user_id":{"type":"string","title":"User Id"}},"type":"object","required":["user_id"],"title":"RecoverOrderRequest"},"RecoveryInitRequest":{"properties":{"token":{"type":"string","title":"Token"},"cadence":{"type":"string","title":"Cadence"},"phone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Phone"},"shipping_address":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Shipping Address"}},"type":"object","required":["token","cadence"],"title":"RecoveryInitRequest"},"RedeemPayload":{"properties":{"code":{"type":"string","title":"Code"}},"type":"object","required":["code"],"title":"RedeemPayload"},"ReferralSettingsPatch":{"properties":{"friend_amount_cents":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Friend Amount Cents"},"referrer_amount_cents":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Referrer Amount Cents"},"cap_per_year":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Cap Per Year"},"credit_expiry_days":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Credit Expiry Days"}},"type":"object","title":"ReferralSettingsPatch"},"RefertoAreas":{"properties":{"tempie":{"type":"boolean","title":"Tempie"},"vertice":{"type":"boolean","title":"Vertice"}},"type":"object","required":["tempie","vertice"],"title":"RefertoAreas"},"RefertoPhoto":{"properties":{"url":{"type":"string","title":"Url"},"uploaded_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Uploaded At"}},"type":"object","required":["url"],"title":"RefertoPhoto"},"RefertoRecapCard":{"properties":{"q":{"type":"string","title":"Q"},"a":{"type":"string","title":"A"}},"type":"object","required":["q","a"],"title":"RefertoRecapCard"},"RefertoRecommendedItem":{"properties":{"id":{"type":"string","title":"Id"},"name":{"type":"string","title":"Name"},"benefit":{"type":"string","title":"Benefit"},"price_cents":{"type":"integer","title":"Price Cents"}},"type":"object","required":["id","name","benefit","price_cents"],"title":"RefertoRecommendedItem"},"RefertoResponse":{"properties":{"status":{"type":"string","title":"Status"},"case_id":{"type":"string","title":"Case Id"},"anteprima_staff":{"type":"boolean","title":"Anteprima Staff","default":false},"first_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"First Name"},"doctor_report":{"type":"string","title":"Doctor Report"},"referto_sent_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Referto Sent At"},"therapy_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Therapy Name"},"therapy_dose":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Therapy Dose"},"therapy_form":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Therapy Form"},"therapy_composition":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Therapy Composition"},"therapy_ingredients":{"items":{"type":"string"},"type":"array","title":"Therapy Ingredients","default":[]},"therapy_image":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Therapy Image"},"is_local_pharmacy":{"type":"boolean","title":"Is Local Pharmacy","default":false},"shipping_state":{"type":"string","title":"Shipping State","default":"not_shipped"},"doctor_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Doctor Name"},"doctor_registration":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Doctor Registration"},"doctor_gender":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Doctor Gender"},"doctor_avatar_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Doctor Avatar Url"},"recap_cards":{"items":{"$ref":"#/components/schemas/RefertoRecapCard"},"type":"array","title":"Recap Cards","default":[]},"areas":{"anyOf":[{"$ref":"#/components/schemas/RefertoAreas"},{"type":"null"}]},"duration_label":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Duration Label"},"areas_heading":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Areas Heading"},"safety_link":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Safety Link"},"instructions_link":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Instructions Link"},"foglio_link":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Foglio Link"},"ricetta":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Ricetta"},"recommended_items":{"items":{"$ref":"#/components/schemas/RefertoRecommendedItem"},"type":"array","title":"Recommended Items","default":[]},"photos":{"items":{"$ref":"#/components/schemas/RefertoPhoto"},"type":"array","title":"Photos","default":[]}},"type":"object","required":["status","case_id","doctor_report"],"title":"RefertoResponse"},"RefreshResult":{"properties":{"candidates":{"type":"integer","title":"Candidates"},"resolved":{"type":"integer","title":"Resolved"},"failed":{"type":"integer","title":"Failed"}},"type":"object","required":["candidates","resolved","failed"],"title":"RefreshResult"},"RejectBody":{"properties":{"motivo":{"type":"string","maxLength":500,"minLength":3,"title":"Motivo"}},"type":"object","required":["motivo"],"title":"RejectBody"},"RequestInfoBody":{"properties":{"info_type":{"type":"string","title":"Info Type"}},"type":"object","required":["info_type"],"title":"RequestInfoBody"},"RequestOtpPayload":{"properties":{"phone":{"type":"string","title":"Phone"},"sso_user_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sso User Id"}},"type":"object","required":["phone"],"title":"RequestOtpPayload"},"ResetPasswordRequest":{"properties":{"token":{"type":"string","title":"Token"},"new_password":{"type":"string","title":"New Password"}},"type":"object","required":["token","new_password"],"title":"ResetPasswordRequest"},"Reshipment":{"properties":{"order_number":{"type":"string","maxLength":40,"minLength":3,"title":"Order Number"}},"type":"object","required":["order_number"],"title":"Reshipment"},"RestoreBody":{"properties":{"versions":{"items":{"type":"string"},"type":"array","maxItems":2,"minItems":1,"title":"Versions"},"note":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}],"title":"Note"}},"type":"object","required":["versions"],"title":"RestoreBody"},"ReturnBody":{"properties":{"note":{"type":"string","maxLength":2000,"minLength":1,"title":"Note"}},"type":"object","required":["note"],"title":"ReturnBody"},"RulePatch":{"properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"slug":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Slug"},"active":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Active"},"platforms":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Platforms"},"post_ids":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Post Ids"},"keywords":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Keywords"},"match_mode":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Match Mode"},"dm_text":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Dm Text"},"public_reply_text":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Public Reply Text"},"youtube_reply_text":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Youtube Reply Text"},"link_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Link Url"}},"type":"object","title":"RulePatch"},"RulePayload":{"properties":{"name":{"type":"string","title":"Name"},"slug":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Slug"},"active":{"type":"boolean","title":"Active","default":true},"platforms":{"items":{"type":"string"},"type":"array","title":"Platforms","default":["instagram"]},"post_ids":{"items":{"type":"string"},"type":"array","title":"Post Ids","default":[]},"keywords":{"items":{"type":"string"},"type":"array","title":"Keywords","default":[]},"match_mode":{"type":"string","title":"Match Mode","default":"word"},"dm_text":{"type":"string","title":"Dm Text","default":""},"public_reply_text":{"type":"string","title":"Public Reply Text","default":""},"youtube_reply_text":{"type":"string","title":"Youtube Reply Text","default":""},"link_url":{"type":"string","title":"Link Url","default":""}},"type":"object","required":["name"],"title":"RulePayload"},"ScheduledFiring":{"properties":{"fire_at_iso":{"type":"string","title":"Fire At Iso"},"label":{"type":"string","title":"Label"},"cron_kind":{"type":"string","title":"Cron Kind"},"count":{"type":"integer","title":"Count"},"note":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Note"}},"type":"object","required":["fire_at_iso","label","cron_kind","count"],"title":"ScheduledFiring"},"SegmentResponse":{"properties":{"kind":{"type":"string","title":"Kind"},"label":{"type":"string","title":"Label"},"description":{"type":"string","title":"Description"},"total":{"type":"integer","title":"Total"},"users":{"items":{"$ref":"#/components/schemas/SegmentUserRow"},"type":"array","title":"Users"}},"type":"object","required":["kind","label","description","total","users"],"title":"SegmentResponse"},"SegmentUserRow":{"properties":{"user_id":{"type":"string","title":"User Id"},"first_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"First Name"},"email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email"},"phone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Phone"},"cohort":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cohort"},"product_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Product Name"},"last_touch_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Touch At"},"next_action":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Action"},"next_send_at_iso":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Send At Iso"},"email_count":{"type":"integer","title":"Email Count","default":0},"sms_count":{"type":"integer","title":"Sms Count","default":0},"has_error":{"type":"boolean","title":"Has Error","default":false}},"type":"object","required":["user_id","first_name","email","phone","cohort","product_name","last_touch_at","next_action"],"title":"SegmentUserRow"},"SelfStart":{"properties":{"user_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},"type":"object","title":"SelfStart"},"SelfStartRequest":{"properties":{"user_id":{"type":"string","title":"User Id"}},"type":"object","required":["user_id"],"title":"SelfStartRequest"},"SelfStartResponse":{"properties":{"token":{"type":"string","title":"Token"},"kind":{"type":"string","title":"Kind"},"checkin_number":{"type":"integer","title":"Checkin Number"}},"type":"object","required":["token","kind","checkin_number"],"title":"SelfStartResponse"},"SessionResponse":{"properties":{"evaluation_id":{"type":"string","title":"Evaluation Id"},"current_step_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Current Step Id"},"answers":{"additionalProperties":true,"type":"object","title":"Answers"}},"type":"object","required":["evaluation_id","current_step_id","answers"],"title":"SessionResponse"},"SettlePayload":{"properties":{"expected_cents":{"type":"integer","title":"Expected Cents"},"month_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Month Key"},"proof_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Proof Url"},"note":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Note"},"paid_on":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Paid On"}},"type":"object","required":["expected_cents"],"title":"SettlePayload"},"ShipConfirmBody":{"properties":{"pickup_date":{"type":"string","title":"Pickup Date"}},"type":"object","required":["pickup_date"],"title":"ShipConfirmBody"},"ShippingAddress":{"properties":{"address1":{"anyOf":[{"type":"string","maxLength":120},{"type":"null"}],"title":"Address1"},"civic":{"anyOf":[{"type":"string","maxLength":20},{"type":"null"}],"title":"Civic"},"city":{"anyOf":[{"type":"string","maxLength":80},{"type":"null"}],"title":"City"},"zip":{"anyOf":[{"type":"string","pattern":"^[0-9]{5}$"},{"type":"null"}],"title":"Zip"},"province":{"anyOf":[{"type":"string","maxLength":30},{"type":"null"}],"title":"Province"},"country":{"anyOf":[{"type":"string","maxLength":30},{"type":"null"}],"title":"Country"},"notes":{"anyOf":[{"type":"string","maxLength":300},{"type":"null"}],"title":"Notes"},"firstName":{"anyOf":[{"type":"string","maxLength":80},{"type":"null"}],"title":"Firstname"},"lastName":{"anyOf":[{"type":"string","maxLength":80},{"type":"null"}],"title":"Lastname"}},"type":"object","title":"ShippingAddress","description":"Only what the shipping label reads (pharmacy/shipping.py _recipient): any other key a page\nsends is dropped, so a patient input never flags a pickup or blocks the label. Required fields\nand the CAP are checked by valutazione.save_address / start_therapy (their 422 codes)."},"ShippingAddressBody":{"properties":{"address1":{"type":"string","maxLength":120,"minLength":2,"title":"Address1"},"civic":{"type":"string","maxLength":20,"title":"Civic","default":""},"zip":{"type":"string","title":"Zip"},"city":{"type":"string","maxLength":80,"minLength":2,"title":"City"},"province":{"type":"string","maxLength":4,"title":"Province","default":""},"notes":{"type":"string","maxLength":35,"title":"Notes","default":""},"firstName":{"type":"string","maxLength":60,"title":"Firstname","default":""},"lastName":{"type":"string","maxLength":60,"title":"Lastname","default":""},"reason":{"type":"string","maxLength":300,"minLength":3,"title":"Reason"}},"type":"object","required":["address1","zip","city","reason"],"title":"ShippingAddressBody","description":"The checkout's shape (address1 + civic, zip), the one Sendcloud's recipient reads."},"ShippingAddressPatch":{"properties":{"updates":{"additionalProperties":true,"type":"object","title":"Updates"}},"type":"object","required":["updates"],"title":"ShippingAddressPatch"},"StartRequest":{"properties":{"option_id":{"type":"string","maxLength":200,"title":"Option Id"},"shipping_address":{"anyOf":[{"$ref":"#/components/schemas/ShippingAddress"},{"type":"null"}]},"token":{"anyOf":[{"type":"string","maxLength":600},{"type":"null"}],"title":"Token"},"user_id":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"User Id"},"side_effects_acknowledged":{"type":"boolean","title":"Side Effects Acknowledged","default":false}},"type":"object","required":["option_id"],"title":"StartRequest"},"StepCreate":{"properties":{"step_id":{"type":"string","title":"Step Id"},"step_type":{"type":"string","title":"Step Type"},"internal_name":{"type":"string","title":"Internal Name"},"config":{"additionalProperties":true,"type":"object","title":"Config"},"position_x":{"type":"integer","title":"Position X","default":0},"position_y":{"type":"integer","title":"Position Y","default":0},"is_active":{"type":"boolean","title":"Is Active","default":true},"ref_question_id":{"type":"string","title":"Ref Question Id"}},"type":"object","required":["step_id","step_type","internal_name","config"],"title":"StepCreate"},"StopBody":{"properties":{"token":{"type":"string","title":"Token"}},"type":"object","required":["token"],"title":"StopBody","description":"Web-stop confirmation body (POST /api/marketing/stop)."},"Submit":{"properties":{"token":{"type":"string","maxLength":32,"minLength":4,"title":"Token"},"worry":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Worry"},"worry_items":{"items":{"type":"string"},"type":"array","title":"Worry Items","default":[]},"worry_text":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Worry Text"},"feeling":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Feeling"},"question_text":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Question Text"},"fatica_items":{"items":{"type":"string"},"type":"array","title":"Fatica Items","default":[]},"fatica_text":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Fatica Text"},"hair":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Hair"},"health_change":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Health Change"},"health_text":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Health Text"},"photo_keys":{"items":{"$ref":"#/components/schemas/PhotoKey"},"type":"array","title":"Photo Keys","default":[]},"gravidanza":{"anyOf":[{},{"type":"null"}],"title":"Gravidanza"}},"type":"object","required":["token"],"title":"Submit"},"Subscriber":{"properties":{"email":{"type":"string","title":"Email"},"source":{"type":"string","title":"Source","default":"coming_soon"},"ip_address":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ip Address"},"id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Id"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"is_active":{"type":"boolean","title":"Is Active","default":true}},"type":"object","required":["email"],"title":"Subscriber"},"SubscriberBase":{"properties":{"email":{"type":"string","title":"Email"},"source":{"type":"string","title":"Source","default":"coming_soon"},"ip_address":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ip Address"}},"type":"object","required":["email"],"title":"SubscriberBase"},"SummaryResponse":{"properties":{"from_date":{"type":"string","title":"From Date"},"to_date":{"type":"string","title":"To Date"},"email":{"$ref":"#/components/schemas/ChannelCounts"},"sms":{"$ref":"#/components/schemas/ChannelCounts"},"total_unique_users":{"type":"integer","title":"Total Unique Users"}},"type":"object","required":["from_date","to_date","email","sms","total_unique_users"],"title":"SummaryResponse"},"SweepProcessRequest":{"properties":{"video_key":{"type":"string","title":"Video Key"},"evaluation_id":{"type":"string","title":"Evaluation Id"}},"type":"object","required":["video_key"],"title":"SweepProcessRequest"},"SwitchChange":{"properties":{"enabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Enabled"},"percent":{"anyOf":[{"type":"integer","maximum":100.0,"minimum":0.0},{"type":"null"}],"title":"Percent"},"note":{"anyOf":[{"type":"string","maxLength":300},{"type":"null"}],"title":"Note"}},"type":"object","title":"SwitchChange"},"TrainingCompletionRequest":{"properties":{"mock_nre":{"type":"string","title":"Mock Nre"}},"type":"object","required":["mock_nre"],"title":"TrainingCompletionRequest"},"TryBody":{"properties":{"answers":{"additionalProperties":true,"type":"object","title":"Answers"}},"type":"object","required":["answers"],"title":"TryBody"},"Unblock":{"properties":{"motivo":{"type":"string","maxLength":500,"minLength":5,"title":"Motivo"}},"type":"object","required":["motivo"],"title":"Unblock"},"UnitEconomics":{"properties":{"cac_window":{"type":"string","title":"Cac Window"},"cac_window_label":{"type":"string","title":"Cac Window Label"},"ltv_method":{"type":"string","title":"Ltv Method"},"ltv_method_label":{"type":"string","title":"Ltv Method Label"},"avg_orders_per_customer":{"type":"number","title":"Avg Orders Per Customer"},"avg_order_value_cents":{"type":"integer","title":"Avg Order Value Cents"},"ltv_cents":{"type":"integer","title":"Ltv Cents"},"new_customers_in_window":{"type":"integer","title":"New Customers In Window"},"marketing_spend_in_window_cents":{"type":"integer","title":"Marketing Spend In Window Cents"},"cac_cents":{"type":"integer","title":"Cac Cents"},"ltv_cac_ratio":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Ltv Cac Ratio"},"payback_months":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Payback Months"},"prior_cac_cents":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Prior Cac Cents"},"cac_delta_pct":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Cac Delta Pct"}},"type":"object","required":["cac_window","cac_window_label","ltv_method","ltv_method_label","avg_orders_per_customer","avg_order_value_cents","ltv_cents","new_customers_in_window","marketing_spend_in_window_cents","cac_cents","ltv_cac_ratio","payback_months"],"title":"UnitEconomics","description":"Top KPI card: LTV / CAC / payback / ratio."},"UnprepareBody":{"properties":{"order_id":{"type":"string","title":"Order Id"}},"type":"object","required":["order_id"],"title":"UnprepareBody"},"UnsubscribeBody":{"properties":{"token":{"type":"string","title":"Token"}},"type":"object","required":["token"],"title":"UnsubscribeBody"},"UpcomingResponse":{"properties":{"days":{"items":{"$ref":"#/components/schemas/DaySchedule"},"type":"array","title":"Days"}},"type":"object","required":["days"],"title":"UpcomingResponse"},"UpdateBody":{"properties":{"definition":{"additionalProperties":true,"type":"object","title":"Definition"},"note":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}],"title":"Note"},"base_hash":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Base Hash"}},"type":"object","required":["definition"],"title":"UpdateBody"},"UpdateCFRequest":{"properties":{"token":{"type":"string","title":"Token"},"codice_fiscale":{"type":"string","title":"Codice Fiscale"}},"type":"object","required":["token","codice_fiscale"],"title":"UpdateCFRequest"},"UpdateExpenseBody":{"properties":{"amount_cents":{"anyOf":[{"type":"integer","exclusiveMinimum":0.0},{"type":"null"}],"title":"Amount Cents"},"currency":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Currency"},"vendor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Vendor"},"notes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Notes"},"is_recurring":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Is Recurring"},"recurrence_end_date":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Recurrence End Date"}},"type":"object","title":"UpdateExpenseBody"},"UpdateShippingRequest":{"properties":{"order_id":{"type":"string","title":"Order Id"},"shipping_address":{"additionalProperties":true,"type":"object","title":"Shipping Address"}},"type":"object","required":["order_id","shipping_address"],"title":"UpdateShippingRequest"},"UpdateUserRequest":{"properties":{"full_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Full Name"},"role":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Role"},"chat_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Chat Name"},"chat_role":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Chat Role"},"chat_avatar_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Chat Avatar Url"},"pharmacy_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Pharmacy Id"}},"type":"object","title":"UpdateUserRequest"},"UserResponse":{"properties":{"user_id":{"type":"string","title":"User Id"},"email":{"type":"string","title":"Email"},"full_name":{"type":"string","title":"Full Name"},"role":{"type":"string","title":"Role"},"chat_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Chat Name"},"chat_role":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Chat Role"},"chat_avatar_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Chat Avatar Url"},"pharmacy_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Pharmacy Id"},"pharmacy_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Pharmacy Name"},"is_active":{"type":"boolean","title":"Is Active"},"created_at":{"type":"string","title":"Created At"}},"type":"object","required":["user_id","email","full_name","role","is_active","created_at"],"title":"UserResponse"},"UserTimelineEntry":{"properties":{"campaign_id":{"type":"string","title":"Campaign Id"},"channel":{"type":"string","title":"Channel"},"template_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Template Name"},"recipient":{"type":"string","title":"Recipient"},"sent_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sent At"},"delivered_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Delivered At"},"opened_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Opened At"},"clicked_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Clicked At"},"error_message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error Message"},"is_smoke":{"type":"boolean","title":"Is Smoke"}},"type":"object","required":["campaign_id","channel","template_name","recipient","sent_at","delivered_at","opened_at","clicked_at","error_message","is_smoke"],"title":"UserTimelineEntry"},"UserTimelineResponse":{"properties":{"user_id":{"type":"string","title":"User Id"},"first_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"First Name"},"email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email"},"phone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Phone"},"identity_state":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Identity State"},"cohort_label":{"type":"string","title":"Cohort Label"},"suppressed":{"type":"boolean","title":"Suppressed"},"suppression_reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Suppression Reason"},"last_touch_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Touch At"},"touch_count":{"type":"integer","title":"Touch Count"},"timeline":{"items":{"$ref":"#/components/schemas/UserTimelineEntry"},"type":"array","title":"Timeline"}},"type":"object","required":["user_id","first_name","email","phone","identity_state","cohort_label","suppressed","suppression_reason","last_touch_at","touch_count","timeline"],"title":"UserTimelineResponse"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"},"VerifyCFRequest":{"properties":{"codice_fiscale":{"type":"string","title":"Codice Fiscale"}},"type":"object","required":["codice_fiscale"],"title":"VerifyCFRequest"},"VerifyDoctorRequest":{"properties":{"action":{"type":"string","title":"Action"},"note":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Note"}},"type":"object","required":["action"],"title":"VerifyDoctorRequest"},"VerifyOtpPayload":{"properties":{"phone":{"type":"string","title":"Phone"},"code":{"type":"string","title":"Code"},"context":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Context","default":"quiz"},"evaluation_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Evaluation Id"},"sso_user_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sso User Id"},"fbc":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Fbc"},"fbclid":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Fbclid"},"gclid":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Gclid"},"gbraid":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Gbraid"},"wbraid":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Wbraid"},"ad_consent":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Ad Consent"},"ttclid":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ttclid"},"msclkid":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Msclkid"},"utm_source":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Utm Source"},"utm_medium":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Utm Medium"},"utm_campaign":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Utm Campaign"},"utm_content":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Utm Content"},"utm_term":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Utm Term"},"referrer":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Referrer"},"landing_path":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Landing Path"},"partner_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Partner Code"}},"type":"object","required":["phone","code"],"title":"VerifyOtpPayload"},"WaitlistBody":{"properties":{"email":{"type":"string","maxLength":254,"title":"Email"},"consenso":{"type":"boolean","title":"Consenso"},"consenso_testo":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}],"title":"Consenso Testo"},"risposte":{"additionalProperties":true,"type":"object","maxProperties":5,"title":"Risposte"},"path":{"type":"string","enum":["A","C"],"title":"Path","default":"C"}},"type":"object","required":["email","consenso"],"title":"WaitlistBody"},"WaitlistRequest":{"properties":{"email":{"type":"string","title":"Email"},"quiz_data":{"additionalProperties":true,"type":"object","title":"Quiz Data"},"source":{"type":"string","title":"Source","default":"female_flow"}},"type":"object","required":["email","quiz_data"],"title":"WaitlistRequest"},"_AddSuppressionBody":{"properties":{"user_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"},"email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email"},"phone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Phone"},"channel":{"type":"string","enum":["email","sms","all"],"title":"Channel","default":"all"},"reason":{"type":"string","enum":["manual_block","replied_negative"],"title":"Reason","default":"manual_block"},"note":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}],"title":"Note"}},"type":"object","title":"_AddSuppressionBody"},"_PauseBody":{"properties":{"days":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Days"},"one_cycle":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"One Cycle"}},"type":"object","title":"_PauseBody"},"_PostponeBody":{"properties":{"days":{"type":"integer","title":"Days"}},"type":"object","required":["days"],"title":"_PostponeBody"},"app__api__admin__promo_codes__CodeCreate":{"properties":{"code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Code"},"kind":{"type":"string","title":"Kind","default":"campaign"},"amount_cents":{"type":"integer","title":"Amount Cents"},"label":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Label"},"valid_from":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Valid From"},"valid_to":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Valid To"},"max_uses":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Max Uses"}},"type":"object","required":["amount_cents"],"title":"CodeCreate"},"app__api__admin__promo_codes__CodePatch":{"properties":{"active":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Active"},"label":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Label"},"valid_to":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Valid To"},"max_uses":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Max Uses"}},"type":"object","title":"CodePatch"},"app__api__patient__checkin_v2__CheckInStatus":{"properties":{"is_due":{"type":"boolean","title":"Is Due"},"status":{"type":"string","title":"Status"},"next_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next At"},"days_remaining":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Days Remaining"},"checkin_count":{"type":"integer","title":"Checkin Count","default":0},"next_kind":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Kind"}},"type":"object","required":["is_due","status"],"title":"CheckInStatus"},"app__api__pharmacy__case_actions__RejectBody":{"properties":{"reason":{"type":"string","title":"Reason"}},"type":"object","required":["reason"],"title":"RejectBody"},"app__api__pharmacy__case_actions__ShippingAddressBody":{"properties":{"line1":{"type":"string","title":"Line1"},"city":{"type":"string","title":"City"},"postal_code":{"type":"string","title":"Postal Code"},"country":{"type":"string","title":"Country","default":"IT"}},"type":"object","required":["line1","city","postal_code"],"title":"ShippingAddressBody"}}}}