/**
 * Storage Provider Interface
 *
 * Abstracts file storage operations to support multiple backends:
 * - S3/MinIO: Production storage with pre-signed URLs
 * - Local: Development/testing with filesystem storage
 */

export type StorageProvider = {
  /**
   * Get a pre-signed URL for uploading a file
   */
  getUploadUrl(
    key: string,
    contentType: string,
    expirySeconds?: number
  ): Promise<string>

  /**
   * Get a pre-signed URL for downloading/viewing a file
   */
  getDownloadUrl(key: string, expirySeconds?: number): Promise<string>

  /**
   * Delete an object from storage
   */
  deleteObject(key: string): Promise<void>

  /**
   * Upload data directly (server-side upload)
   */
  putObject(key: string, data: Buffer, contentType: string): Promise<void>

  /**
   * Download data directly (server-side download)
   */
  getObject(key: string): Promise<Buffer>

  /**
   * Check if an object exists
   */
  objectExists(key: string): Promise<boolean>
}

export type StorageProviderType = 's3' | 'local'

export type StorageConfig = {
  provider: StorageProviderType
  bucket: string
  // S3-specific
  s3Endpoint?: string
  s3PublicEndpoint?: string
  s3AccessKey?: string
  s3SecretKey?: string
  // Local-specific
  localBasePath?: string
}
