/**
 * `@wrnexus/uploader` — config-driven file uploads + serving.
 *
 * Declare stores in `wrnexus.config.ts`:
 *
 *   storage: {
 *     default: "public",
 *     stores: {
 *       public: { driver: "local", dir: "uploads/public", access: "public",
 *                 maxBytes: 10_000_000, accept: ["image/*", ".pdf"] },
 *       docs:   { driver: "s3", access: "private", bucket: "…", region: "auto",
 *                 endpoint: "https://…r2.cloudflarestorage.com",
 *                 accessKeyId: process.env.S3_KEY!, secretAccessKey: process.env.S3_SECRET! },
 *     },
 *   }
 *
 * Upload from an API route, and drop a drag-and-drop widget on a page:
 *
 *   // app/api/upload.ts
 *   export const POST = handleUpload({ store: "public" });
 *
 *   <!-- any page -->
 *   <div data-uploader="public" data-endpoint="/api/upload" data-accept="image/*"></div>
 *
 * Public files serve themselves (local → framework route, S3 → bucket URL).
 * Private files serve through a route you gate with your auth middleware:
 *
 *   // app/api/files/[key].ts
 *   export const GET = serveFromStore("docs");
 */

export {
  upload,
  handleUpload,
  serveFromStore,
  serveStoredFile,
  storedUrl,
  UploadError,
  UPLOADS_PREFIX,
} from "./upload.ts";
export type { UploadedFile, UploadOptions, UploadScanInput, UploadScanResult } from "./upload.ts";

export { configureStorage, getStore, hasStorage, storeNames } from "./client.ts";
export type { Store } from "./client.ts";

export { UPLOAD_RUNTIME, UPLOAD_JS_HREF } from "./runtime.ts";

export { localDriver } from "./adapters/local.ts";
export { s3Driver } from "./adapters/s3.ts";
export { signS3, sha256Hex, encodeKey } from "./sigv4.ts";
export { accepts, contentTypeOf, extForType, extOf } from "./mime.ts";

export type {
  StorageConfig,
  StoreConfig,
  LocalStoreConfig,
  S3StoreConfig,
  StorageDriver,
  StoredObject,
  StoreAccess,
  PutMeta,
} from "./driver.ts";
export {
  safeObjectKey,
  inspectUpload,
  enforceUploadPolicy,
  sniffContentType,
  createSignedFileToken,
  verifySignedFileToken,
  UploadPolicyError,
} from "./security.ts";
export type { UploadPolicy, UploadInspection, SignedFileToken } from "./security.ts";
export {
  formatFileSize,
  uploadAccept,
  uploadedFileMap,
  uploaderAttributes,
  assertUploadedFiles,
} from "./helpers.ts";
export { uploaderPlugin, uploaderComponentsDir } from "./plugin.ts";
export type { UploaderPluginOptions } from "./plugin.ts";
export { createResumableUploadManager, memoryResumableSessionStore } from "./resumable.ts";
export type {
  ResumableUploadManager,
  ResumableUploadManagerOptions,
  ResumableUploadSession,
  ResumableSessionStore,
  CreateResumableUpload,
  ResumableChunkResult,
} from "./resumable.ts";
export {
  memoryQuotaStore,
  postgresQuotaStore,
  POSTGRES_QUOTA_SCHEMA,
  multipartUpload,
  createTemporaryObjectCleaner,
  ffmpegVideoTranscoder,
} from "./operations.ts";
export type {
  QuotaUsage,
  QuotaStore,
  QuotaSqlClient,
  MultipartObjectClient,
  TemporaryObject,
  VideoTranscodeOptions,
} from "./operations.ts";
