/**
 * Type definitions for transcoding-related types
 */

/**
 * Video transcoding status enum
 * - 'uploaded': Initial state after video upload, awaiting transcoding
 * - 'processing': Currently being transcoded to HLS format
 * - 'transcoded': Successfully transcoded, HLS files available
 * - 'failed': Transcoding failed, MP4 fallback available
 */
export enum TranscodingStatus {
  UPLOADED = 'uploaded',
  PROCESSING = 'processing',
  TRANSCODED = 'transcoded',
  FAILED = 'failed',
}

/**
 * Check if transcoding status is valid
 */
export function isValidTranscodingStatus(status: string): status is TranscodingStatus {
  return Object.values(TranscodingStatus).includes(status as TranscodingStatus);
}

/**
 * Human-readable transcoding status labels
 */
export const transcodingStatusLabels: Record<TranscodingStatus, string> = {
  [TranscodingStatus.UPLOADED]: 'Awaiting Transcoding',
  [TranscodingStatus.PROCESSING]: 'Processing',
  [TranscodingStatus.TRANSCODED]: 'Ready',
  [TranscodingStatus.FAILED]: 'Failed',
};

/**
 * Get status badge color for UI display
 */
export function getStatusBadgeColor(status: TranscodingStatus): string {
  switch (status) {
    case TranscodingStatus.UPLOADED:
      return 'bg-blue-100 text-blue-800';
    case TranscodingStatus.PROCESSING:
      return 'bg-amber-100 text-amber-800';
    case TranscodingStatus.TRANSCODED:
      return 'bg-green-100 text-green-800';
    case TranscodingStatus.FAILED:
      return 'bg-red-100 text-red-800';
    default:
      return 'bg-gray-100 text-gray-800';
  }
}
