/**
 * Standard return type for Server Actions.
 *
 * - `success` indicates whether the action completed without errors.
 * - `message` is an optional human-readable summary (success or failure).
 *   注意：面向用户展示的文案应通过 `errorCode` + 前端 i18n 查找，
 *   `message` 仅用于非结构化的诊断信息或临时占位。
 * - `errorCode` carries a structured error code that the frontend can map to
 *   an i18n key. 优先使用 errorCode 而非硬编码 message。
 * - `errors` holds field-level validation errors keyed by field name.
 * - `data` carries the action's payload on success.
 */
export type ActionState<T = void> = {
  success: boolean
  message?: string
  /** 结构化错误码，前端通过 t(`errors.${errorCode}`) 查 i18n 翻译 */
  errorCode?: string
  errors?: Record<string, string[]>
  data?: T
}
