import { describe, it, expect } from 'vitest';
import { getAgent } from '../agents';
import {
  GeneralAgent,
  PhotorealisticAgent,
  IllustrationAgent,
  MinimalistAgent,
  StickerAgent,
  ProductAgent,
  ComicAgent,
} from '../agents';

describe('getAgent', () => {
  const mockApiKey = 'test-api-key';

  it('should return GeneralAgent when no template provided', () => {
    const agent = getAgent(mockApiKey);
    expect(agent).toBeInstanceOf(GeneralAgent);
  });

  it('should return PhotorealisticAgent for photorealistic template', () => {
    const agent = getAgent(mockApiKey, 'photorealistic');
    expect(agent).toBeInstanceOf(PhotorealisticAgent);
  });

  it('should return IllustrationAgent for illustration template', () => {
    const agent = getAgent(mockApiKey, 'illustration');
    expect(agent).toBeInstanceOf(IllustrationAgent);
  });

  it('should return MinimalistAgent for minimalist template', () => {
    const agent = getAgent(mockApiKey, 'minimalist');
    expect(agent).toBeInstanceOf(MinimalistAgent);
  });

  it('should return StickerAgent for sticker template', () => {
    const agent = getAgent(mockApiKey, 'sticker');
    expect(agent).toBeInstanceOf(StickerAgent);
  });

  it('should return ProductAgent for product template', () => {
    const agent = getAgent(mockApiKey, 'product');
    expect(agent).toBeInstanceOf(ProductAgent);
  });

  it('should return ComicAgent for comic template', () => {
    const agent = getAgent(mockApiKey, 'comic');
    expect(agent).toBeInstanceOf(ComicAgent);
  });

  it('should return GeneralAgent for general template', () => {
    const agent = getAgent(mockApiKey, 'general');
    expect(agent).toBeInstanceOf(GeneralAgent);
  });

  it('should fallback to GeneralAgent for unknown template', () => {
    const agent = getAgent(mockApiKey, 'unknown-template' as any);
    expect(agent).toBeInstanceOf(GeneralAgent);
  });

  it('should return agent with correct templateType', () => {
    const agent = getAgent(mockApiKey, 'photorealistic');
    expect(agent.templateType).toBe('photorealistic');
  });
});
