import { genericJsonImageTemplate } from './generic-json';
import { openAICompatibleImageTemplate } from './openai-compatible';
import type { ImageApiConfigForTemplate, ImageApiTemplate } from './types';

const imageApiTemplates: ImageApiTemplate[] = [
  openAICompatibleImageTemplate,
  genericJsonImageTemplate,
];

export function resolveImageApiTemplate(config: ImageApiConfigForTemplate): ImageApiTemplate {
  return imageApiTemplates.find(template => template.matches(config)) || genericJsonImageTemplate;
}

export {
  genericJsonImageTemplate,
  openAICompatibleImageTemplate,
};
export {
  isDallE2Model,
  isDallE3Model,
  isGptImageModel,
  isOpenAICompatibleImageApi,
  normalizeOpenAICompatibleImageCount,
  normalizeOpenAICompatibleImageSize,
} from './openai-compatible';
export type {
  ImageApiConfigForTemplate,
  ImageApiTemplate,
  ImageOutputFormat,
  ImageQuality,
  TextToImageTemplateInput,
  TextToImageTemplateResult,
} from './types';
