import type { z } from '@zod/zod'

export {
  BlobRef,
  Bookmark,
  BookmarkAddress,
  bookmarkDisplayName,
  BookmarkList,
  BookmarkProperties,
  LastView,
  Lat,
  Lng,
  SearchHistoryEntry,
  SharedBookmark,
  SharedList,
  toSharedBookmark,
} from './schema/v0.ts'

/**
 * Bridges a zod/mini schema (what this app uses) to APIs typed against
 * classic `z.ZodType`, like `getShare`'s `schema` option. Safe because those
 * APIs only call `.parse()`, which both flavours implement — the two class
 * hierarchies just don't overlap nominally.
 */
export function asZodType<T>(
  schema: { parse: (data: unknown) => T },
): z.ZodType<T> {
  return schema as unknown as z.ZodType<T>
}
