export type ServerResult<T> = 
  | { success: true; data: T }
  | { success: false; error: ServerError };

export type ServerError = {
  code: ErrorType;
  message: string;
  userMessage: string;
  statusCode?: number;
  context?: Record<string, any>;
};

export enum ErrorType {
  VALIDATION = 'VALIDATION',
  NOT_FOUND = 'NOT_FOUND',
  UNAUTHORIZED = 'UNAUTHORIZED',
  FORBIDDEN = 'FORBIDDEN',
  NETWORK = 'NETWORK',
  DATABASE = 'DATABASE',
  POCKETBASE = 'POCKETBASE',
  UNKNOWN = 'UNKNOWN'
}