// @requirements REQ-PRODUCT-COLLECTION-NOTICE REQ-EU-NOTICE REQ-NZ-NOTICE
import {compileLegalDocuments,createCollectionNotice} from 'notabenda/content';
import {renderCollectionNotice,renderLegalLinks,collectionNoticeIds} from 'notabenda';
export async function collectionFiles(base){
const files={};
for(const prefix of ['','/dark']){
const config=structuredClone(base);config.site.id='juniper-collection';config.purposes=config.purposes.filter(p=>p.id==='enquiries');config.storage=[];
config.services=[{id:'message-inbox',name:'Message handling',provider:'Juniper Notes (fictional)',location:'This read-only example sends no message. A real deployment must declare actual hosting and processing locations.',purposeIds:['enquiries']}];
config.purposes[0].collection.description='A message and reply address deliberately provided through a contact form.';
for(const [kind,doc] of Object.entries(config.documents))doc.route=`${prefix}/collection/${kind}`;
const build=compileLegalDocuments(config,{mode:'preview',stylesheetUrl:prefix?'/assets/dark.css':'/assets/notabenda.css'});
const notice=createCollectionNotice(build.artifact,{scopeId:'contact-form',purposeIds:['enquiries'],reviewStatus:'draft',wording:{title:'About your message',intro:'We use the information you choose to send to respond to your enquiry.'}},{mode:'preview'});
const ids=collectionNoticeIds('message-privacy');
Object.assign(files,build.files);
const root=prefix?prefix.slice(1)+'/collection':'collection';
files[root+'/notice.json']=JSON.stringify(notice);
files[root+'/index.html']=`
Notabenda · At the point of collection
Contact the team
The notice beside this form describes its declared purpose and links to the relevant privacy revision.
Read-only form · Sending is disabled.
`;
}
files['assets/collection-example.css']='@layer sample { .sample-message>label{display:block;font-size:.85rem;font-weight:600;margin:1.5rem 0 .5rem}.sample-message>input,.sample-message>textarea{display:block;box-sizing:border-box;width:100%;max-width:100%;border:1px solid var(--nb-line,#e3e6ef);background:var(--nb-surface,#fff);color:var(--nb-text,#202437);font:inherit;padding:.85rem;border-radius:.65rem;line-height:1.6}.sample-message>.sample-field-hint{font-size:.8rem;color:var(--nb-muted,#646b80)}.sample-message>button{font:inherit;border:1px solid var(--nb-line,#e3e6ef);border-radius:.65rem;min-height:44px;padding:.75rem;background:var(--nb-soft,#f3f4fb);color:var(--nb-muted,#646b80);max-width:100%;white-space:normal} }';
return files;
}