import { AIClient, AIClientOptions } from '@happyvertical/ai'; import { StaticMapProvider } from '@happyvertical/geo'; import { HeadlineCardTemplate } from '@happyvertical/images'; import { DatabaseConfig } from '@happyvertical/smrt-core'; import { Image } from '@happyvertical/smrt-images'; import { Content } from './content'; /** * Available thumbnail generation strategies */ export type ThumbnailStrategy = 'headline-card' | 'static-map' | 'ai-generate'; /** * Base options for all strategies */ interface BaseThumbnailOptions { /** * Generation strategy */ strategy: ThumbnailStrategy; /** * Width in pixels * @default 1200 */ width?: number; /** * Height in pixels * @default 630 */ height?: number; } /** * Options for headline card strategy */ export interface HeadlineCardThumbnailOptions extends BaseThumbnailOptions { strategy: 'headline-card'; /** * Primary brand color (hex) * @default '#3b82f6' */ brandColor?: string; /** * Background color (hex) * @default '#ffffff' */ backgroundColor?: string; /** * Optional subtitle/category text */ subtitle?: string; /** * Optional logo URL */ logoUrl?: string; /** * Template style * @default 'default' */ template?: HeadlineCardTemplate; } /** * Options for static map strategy */ export interface StaticMapThumbnailOptions extends BaseThumbnailOptions { strategy: 'static-map'; /** * Map provider * @default 'mapbox' */ mapProvider?: StaticMapProvider; /** * Zoom level (1-20) * @default 14 */ zoom?: number; /** * Marker color * @default 'e74c3c' */ markerColor?: string; /** * Mapbox style (if using mapbox provider) */ mapboxStyle?: string; /** * Google map type (if using google provider) */ googleMapType?: 'roadmap' | 'satellite' | 'terrain' | 'hybrid'; } /** * Options for AI generation strategy */ export interface AIGenerateThumbnailOptions extends BaseThumbnailOptions { strategy: 'ai-generate'; /** * AI provider configuration */ ai?: AIClientOptions | AIClient; /** * Custom prompt for image generation * If not provided, generates based on content title/body */ prompt?: string; /** * Style hint for image generation * @default 'photorealistic' */ style?: 'photorealistic' | 'illustration' | 'abstract' | 'minimal'; } /** * Union type for all thumbnail options */ export type ThumbnailOptions = HeadlineCardThumbnailOptions | StaticMapThumbnailOptions | AIGenerateThumbnailOptions; /** * Options for ThumbnailGenerator */ export interface ThumbnailGeneratorOptions { /** * Database configuration for storing generated images */ db?: DatabaseConfig; /** * Alias for `db` — mirrors the `SmrtClassOptions.persistence` alias so * callers can pass the same options shape they use for SmrtObject/Collection. * * @deprecated Prefer `db`. Retained for parity with `SmrtClassOptions`. */ persistence?: DatabaseConfig; /** * AI client configuration for AI-generated thumbnails */ ai?: AIClientOptions | AIClient; } /** * ThumbnailGenerator creates thumbnails for content using various strategies */ export declare class ThumbnailGenerator { private content; private options; constructor(content: Content, options?: ThumbnailGeneratorOptions); /** * Generate a thumbnail using the specified strategy */ generate(options: ThumbnailOptions): Promise; /** * Generate a headline card thumbnail */ private generateHeadlineCard; /** * Generate a static map thumbnail */ private generateStaticMap; /** * Generate a thumbnail using AI image generation */ private generateWithAI; /** * Build a prompt for AI image generation based on content. * * Resolves via `@happyvertical/smrt-prompts` so tenants can override the * template/profile/model/params at runtime. Only non-PII content fields * (title, description) and the caller-supplied style hint are passed. * Internal IDs and the freeform `metadata` blob are intentionally excluded. * * Returns the full ResolvedPrompt (text + ai config) so the caller can * forward `model`/`params` overrides to `ai.generateImage()`. Returning * only the text would silently drop the editable model/params overrides. */ private buildAIPrompt; /** * Create an Image object from a buffer */ private createImageFromBuffer; } export {}; //# sourceMappingURL=thumbnail-generator.d.ts.map