""" Body Parts API Endpoints GET /api/v1/body-parts - Returns body part categories for sideline entry picker """ from typing import List from fastapi import APIRouter, Depends from pydantic import BaseModel from sqlalchemy.orm import Session from app.database import get_db from app.auth import get_current_user, require_role router = APIRouter(tags=["body-parts"]) # ============== SCHEMAS ============== class BodyPart(BaseModel): """Individual body part""" id: str label: str icon: str class BodyPartCategory(BaseModel): """Category of body parts""" name: str parts: List[BodyPart] # ============== DATA ============== # Body parts hierarchy matching the frontend picker BODY_PARTS_DATA: List[BodyPartCategory] = [ BodyPartCategory( name="Head & Neck", parts=[ BodyPart(id="head", label="Head", icon="🧠"), BodyPart(id="face", label="Face", icon="😷"), BodyPart(id="neck", label="Neck", icon="🦒"), BodyPart(id="concussion", label="Concussion", icon="🧠"), ] ), BodyPartCategory( name="Upper Body", parts=[ BodyPart(id="shoulder", label="Shoulder", icon="💪"), BodyPart(id="upper_arm", label="Upper Arm", icon="💪"), BodyPart(id="elbow", label="Elbow", icon="🦴"), BodyPart(id="forearm", label="Forearm", icon="💪"), BodyPart(id="wrist", label="Wrist", icon="⌚"), BodyPart(id="hand", label="Hand", icon="✋"), BodyPart(id="fingers", label="Fingers", icon="👆"), BodyPart(id="chest", label="Chest", icon="🫁"), BodyPart(id="upper_back", label="Upper Back", icon="↕️"), ] ), BodyPartCategory( name="Lower Body", parts=[ BodyPart(id="hip", label="Hip", icon="🦴"), BodyPart(id="groin", label="Groin", icon="🩳"), BodyPart(id="thigh", label="Thigh", icon="🦵"), BodyPart(id="knee", label="Knee", icon="🦵"), BodyPart(id="shin", label="Shin", icon="🦵"), BodyPart(id="calf", label="Calf", icon="🦵"), BodyPart(id="ankle", label="Ankle", icon="🦶"), BodyPart(id="foot", label="Foot", icon="🦶"), BodyPart(id="toes", label="Toes", icon="👣"), BodyPart(id="lower_back", label="Lower Back", icon="↕️"), ] ), BodyPartCategory( name="Other", parts=[ BodyPart(id="abdomen", label="Abdomen", icon="🫃"), BodyPart(id="ribs", label="Ribs", icon="🍖"), BodyPart(id="general", label="General/Illness", icon="🤒"), ] ), ] # ============== ROUTER ENDPOINTS ============== @router.get("", response_model=List[BodyPartCategory]) async def get_body_parts( db: Session = Depends(get_db), current_user = Depends(require_role(["at", "coach", "admin"])), ): """ Get body part categories and parts for the sideline entry picker Returns a hierarchical list of body part categories and their parts with icons for the 3-tap sideline entry flow. """ return BODY_PARTS_DATA