import type { IiosTemplateChannel } from '@prisma/client';

/** What to render: a STORED template (by key, optionally pinned to a version) or INLINE content. */
export type TemplateSource =
  | { key: string; version?: number }
  | { inline: { subject?: string; html?: string; text?: string; variables?: string[] } };

export interface RenderOptions {
  channel: IiosTemplateChannel;
  locale?: string;
  scopeId?: string;
}

export function isInlineSource(s: TemplateSource): s is { inline: { subject?: string; html?: string; text?: string; variables?: string[] } } {
  return 'inline' in s;
}
