export interface ErrorResponse { message: string; code?: string; statusCode?: number; } export interface ApiResponse { data?: T; successful: boolean; error?: ErrorResponse; } export function wrapResponse(data?: T): ApiResponse { return { data, successful: true }; } export function wrapError( message: string, statusCode: number = 500, code?: string ): ApiResponse { return { data: undefined, successful: false, error: { message, statusCode, code }, }; }