/**
 * Port: MediaStoragePort
 *
 * Defines the contract for media file storage operations.
 */

export interface UploadOptions {
  filename: string;
  mimeType: string;
  metadata?: Record<string, unknown>;
}

export interface UploadResult {
  success: boolean;
  url?: string;
  filename?: string;
  errorMessage?: string;
}

export interface MediaStoragePort {
  /**
   * Upload a media file
   * @param buffer File buffer
   * @param options Upload options
   * @returns Upload result with URL
   */
  uploadMedia(buffer: Buffer, options: UploadOptions): Promise<UploadResult>;

  /**
   * Delete a media file by storage key
   * @param storageKey Storage key to delete
   */
  deleteMedia(storageKey: string): Promise<void>;

  /**
   * Get file bytes as Buffer
   * @param storageKey Storage key
   * @returns Buffer or null if not found
   */
  getBytes?(storageKey: string): Promise<Buffer | null>;

  /**
   * Get file metadata
   * @param storageKey Storage key
   * @returns File metadata or null if not found
   */
  getMetadata?(storageKey: string): Promise<{ size: number; contentType: string } | null>;
}