import { ALL_SYSTEM_PAGE_ROLES } from './types.js'; /** Admin-facing labels per role. */ const ROLE_LABELS = { cookiePolicy: 'Cookie Policy', homepage: 'Homepage', privacyPolicy: 'Privacy Policy', termsOfService: 'Terms of Service' }; /** Admin descriptions per role. */ const ROLE_DESCRIPTIONS = { cookiePolicy: 'Page linked from the cookie consent banner.', homepage: 'Page served at the locale root (e.g. /pl, /en).', privacyPolicy: 'Page linked as the privacy policy.', termsOfService: 'Page linked as the terms of service / site regulations.' }; /** * Builds one relationship field per configured system-page role. * * Each field points at the client's Pages collection (via the provided slug) * and holds a single document reference. The referenced document's slug is * localized, so the same assignment resolves to /pl/strona-glowna and * /en/home at runtime — role assignment is locale-agnostic, path resolution * is locale-aware (see getSystemPagePath). */ export function buildSystemPagesFields(pages) { const roles = pages.roles?.length ? pages.roles : [ ...ALL_SYSTEM_PAGE_ROLES ]; return roles.map((role)=>({ name: role, type: 'relationship', admin: { description: ROLE_DESCRIPTIONS[role] }, label: ROLE_LABELS[role], maxDepth: 1, relationTo: pages.slug })); } //# sourceMappingURL=systemPagesFields.js.map