package httpapi import ( "context" "errors" "net/http" "speech-learning-api/internal/domain" "time" ) type pronunciationStore interface { PronunciationProfile(context.Context, string, string, time.Time) (domain.PronunciationProfile, error) PlanPronunciation(context.Context, string, string, time.Time) (domain.PronunciationPlan, error) FailPronunciationPlan(context.Context, string, string) error } func (s *Server) pronunciationProfile(w http.ResponseWriter, r *http.Request) { repo, ok := s.store.(pronunciationStore) if !ok { writeError(w, 503, errors.New("Ausspracheprofil nicht verfügbar")) return } user := currentUserID(r) profile, err := s.store.GetPrimaryProfile(r.Context(), user) if err != nil { writeError(w, 404, err) return } result, err := repo.PronunciationProfile(r.Context(), user, profile.TargetLanguage, time.Now().UTC()) if err != nil { writeError(w, 500, err) return } writeJSON(w, 200, result) }