// ============================================================================
// API-level types: errors, pagination, common response wrappers
// Generated from honeyDueAPI-go/internal/dto/responses/auth.go (ErrorResponse, MessageResponse)
// ============================================================================

/**
 * Structured API error with HTTP status code.
 * Throw this from fetch wrappers so callers can inspect `status`.
 */
export class ApiError extends Error {
  status: number;

  constructor(status: number, message: string) {
    super(message);
    this.name = "ApiError";
    this.status = status;
  }
}

/** Wire format returned by the Go error handler. */
export interface ErrorResponse {
  error: string;
  details?: Record<string, string>;
}

/** Simple message-only response used by many endpoints. */
export interface MessageResponse {
  message: string;
}

/**
 * Generic paginated response wrapper.
 * The Go API currently returns bare arrays for most list endpoints,
 * but notifications use `{ count, results }`.
 */
export interface PaginatedResponse<T> {
  count: number;
  results: T[];
}
