import type { PageTemplate, PageTemplatePreset, } from '../../service/visibility/visibility.interface'; /** * Adapt a preset into a {@link PageTemplate}-shaped object for the Run / Edit * modals. Presets are seeded server-side (``seed_page_template_presets`` in * the agent repo) and fetched via ``listPageTemplatePresets``; the empty * ``template_id`` marks the result as unsaved, so Run sends no template id and * Edit creates a new merchant-owned template instead of patching one. * * @param {PageTemplatePreset} preset - The Recomaze-shipped preset. * @param {string} brandId - Brand the run/fork belongs to. * @param {string} language - Brand language stamped on a fork. * @returns {PageTemplate} A template-shaped view of the preset. */ export function presetToTemplate( preset: PageTemplatePreset, brandId: string, language: string ): PageTemplate { return { template_id: '', brand_id: brandId, content_type: preset.content_type, name: preset.name, description: preset.description, language, default_instructions: preset.default_instructions, default_target_prompts: preset.default_target_prompts, default_keywords: preset.default_keywords, created_at: null, updated_at: null, }; }