# WP1 — BE rule contract for GYN customize
Goal: let the visit-layout endpoints store the richer GYN rules.
Files: /home/moonui3/moon-erp-be/Modules/Clinic/app/Support/VisitLayoutRegistry.php, Modules/Clinic/app/Services/VisitLayoutService.php (sanitizeClientFields, doctorEntry, effective, saveDoctor sanitizer, elements sanitizer), describe() output, lang errors; tests under Modules/Clinic/tests/Feature (find the existing visit-layout tests and extend).
Contract: see LEDGER «Shared contract». For clinical_type gyn_ob and keys that are GYN history-question codes (historyCodes()): capabilities visible, required, input (allowed 'chips'|'select'), size ('s'|'m'|'l'|'f'), hidden_options (array of ≤200 strings ≤100 chars each). Other keys unchanged. Element keys: for gyn_ob additionally accept the grammar `^gyn\.(sec|tab|card|col|row|btn|hdr|sum|el)\.[a-z0-9_.:-]{1,110}$`. Doctor profile: accept `input` and `size` per field (dropped when the client locked it); `effective` merges size like input.
Acceptance: PUT client with these rules round-trips through GET visit-layout (effective too); invalid input/size/hidden_options → 422 with key-specific error; non-gyn types reject the new attrs; existing behaviour unchanged.
Tests: write Pest tests (do NOT run the suite — owner rule; you may run ONLY the new/changed test file once with /opt/cpanel/ea-php82/root/usr/bin/php vendor/bin/pest <file>).
Out of scope: FE, templates, schema meta.
