/**
 * Model Resolution Utilities
 */

export interface Resolution {
  width: number;
  height: number;
  label: string;
}

export const RESOLUTIONS: Record<string, Resolution> = {
  '256': { width: 256, height: 256, label: '256x256' },
  '512': { width: 512, height: 512, label: '512x512' },
  '720': { width: 1280, height: 720, label: '720p' },
  '1080': { width: 1920, height: 1080, label: '1080p' },
  '1K': { width: 1024, height: 1024, label: '1K' },
  '2K': { width: 2048, height: 2048, label: '2K' },
  '4K': { width: 4096, height: 4096, label: '4K' },
};

export const ASPECT_RATIOS = [
  { id: '1:1', label: '1:1', value: '1:1' },
  { id: '16:9', label: '16:9', value: '16:9' },
  { id: '9:16', label: '9:16', value: '9:16' },
  { id: '4:3', label: '4:3', value: '4:3' },
  { id: '3:4', label: '3:4', value: '3:4' },
  { id: '21:9', label: '21:9', value: '21:9' },
];

export const getResolutionDimensions = (resolution: string): Resolution => {
  return RESOLUTIONS[resolution] || RESOLUTIONS['1K'];
};

export const getAspectRatioDimensions = (aspectRatio: string): { width: number; height: number } => {
  const [w, h] = aspectRatio.split(':').map(Number);
  return { width: w, height: h };
};

// Helper function to get resolution levels for a model
export const getResolutionLevels = (model: string): string[] => {
  return Object.keys(RESOLUTIONS);
};

// Helper function to get aspect ratios for a resolution
export const getAspectRatiosForResolution = (resolution: string): string[] => {
  return ASPECT_RATIOS.map(ar => ar.id);
};
