// @requirements REQ-PRODUCT-EMBEDS
import {readFile} from 'node:fs/promises';
import {compileLegalDocuments} from 'notabenda/content';
import {renderEmbedPlaceholder,renderLegalLinks} from 'notabenda';
import {exampleConsentConfig} from '../static/choices-build.mjs';
export async function embedFiles(base){
const config=exampleConsentConfig(base);config.site.id='juniper-embeds';
const template=config.purposes[0];
config.purposes=[{...template,id:'embedded-media',name:'Embedded media',description:'Load fictional first-party framed content and an illustration in this demonstration.',dataCategories:['Synthetic media request'],retention:'No application record is created by these sample media resources.'},config.purposes.find(p=>p.id==='remember-choices')];
config.services=[{id:'sample-media',name:'Sample embedded media',provider:'Juniper Notes (fictional)',location:'This local demonstration only',purposeIds:['embedded-media'],resourceOrigins:['self']},config.services.find(s=>s.id==='privacy-choices')];
config.storage=config.storage.filter(s=>s.serviceId==='privacy-choices');for(const item of config.storage)item.name=item.name.replace('juniper-choices',config.site.id);
config.consent.purposes=[{id:'embedded-media',scope:'sample-1'}];config.consent.services=[{id:'sample-media',scope:'sample-1'}];
for(const [kind,doc] of Object.entries(config.documents))doc.route=`/embeds/${kind}`;
const build=compileLegalDocuments(config,{mode:'preview',stylesheetUrl:'/assets/notabenda.css'});
const html=`