import type { AudioFormat, VideoFormat, FormatType } from './types';

export const VIDEO_MIME: Record<VideoFormat, string> = {
  mp4: 'video/mp4',
  webm: 'video/webm',
  mkv: 'video/x-matroska',
  avi: 'video/x-msvideo',
};

export const AUDIO_MIME: Record<AudioFormat, string> = {
  mp3: 'audio/mpeg',
  wav: 'audio/wav',
  m4a: 'audio/mp4',
  opus: 'audio/ogg',
};

export function getMimeType(formatType: FormatType, format: VideoFormat | AudioFormat): string {
  if (formatType === 'video') {
    return VIDEO_MIME[format as VideoFormat] || 'application/octet-stream';
  }
  return AUDIO_MIME[format as AudioFormat] || 'application/octet-stream';
}
