/**
 * Sale-ad (Abgabe-Inserat) AI assist — FEAT-12a frontend stub.
 *
 * The backend endpoint (POST /gerbils/sale-ad, Claude-powered) is FEAT-12a-backend
 * and lands only once Julian provides an API key. Until then this call 404s/503s
 * and the UI shows a German "API-Schlüssel noch nicht konfiguriert" disabled state.
 *
 * REQUEST SHAPE (defined here; backend must match):
 *   {
 *     animals: [{ name, farbschlag, dateOfBirth, notes }],
 *     statusLine: string,   // e.g. "FREI" / "LOCKER RESERVIERT Anna"
 *     hints: string         // free-text style/wishes from the user
 *   }
 *   -> { text: string }     // the assembled/improved German listing
 */
import { api } from './client'

export interface SaleAdAnimal {
  name: string
  farbschlag: string | null
  dateOfBirth: string | null
  notes: string | null
  /** FEAT-14: German trait LABELS (human-readable for the prompt), not keys. */
  traits?: string[]
  characterNote?: string | null
}

export interface SaleAdRequest {
  animals: SaleAdAnimal[]
  statusLine: string
  hints: string
}

export interface SaleAdResponse {
  text: string
}

export function generateSaleAd(request: SaleAdRequest): Promise<SaleAdResponse> {
  return api.post<SaleAdResponse>('/gerbils/sale-ad', request)
}
