# Content Management Specification ## Purpose Leírja a weboldal Payload CMS-alapú tartalomszerkesztését, admin hozzáférését, publikálását és az adminisztrált média/partner tartalmak kezelését. ## Requirements ### Requirement: Protected Payload administration The CMS SHALL require an authenticated user for administration and protected Users collection operations. The current user model SHALL treat every authenticated user as an administrator. #### Scenario: Unauthenticated user attempts a protected admin operation - **WHEN** a request without an authenticated user attempts to read or modify a protected Users or content record through the Payload API - **THEN** Payload SHALL deny the operation #### Scenario: Login attempts exceed the configured limit - **WHEN** an account reaches five failed login attempts - **THEN** Payload SHALL lock that account for ten minutes ### Requirement: Editable site content The CMS SHALL provide editable Home, About, Services, Contact, and Common globals, and LegalPages, Partners, Media, ContactSubmissions, and Users collections. Public page content SHALL be obtained from these Payload records rather than hard-coded into page components. #### Scenario: An administrator edits a public page global - **WHEN** an authenticated administrator saves a supported global - **THEN** the CMS SHALL persist the global and make its published values available to the public site #### Scenario: An administrator manages legal pages or partners - **WHEN** an authenticated administrator creates or updates a LegalPages or Partners record - **THEN** the CMS SHALL persist the record for use by the corresponding public page ### Requirement: Draft and versioned publishing The site globals and the LegalPages and Partners collections SHALL support drafts and version history, with a maximum of 50 retained versions per global or document. Publishing SHALL be an explicit administrator action. Public content reads SHALL return published data rather than drafts. #### Scenario: Save an unpublished draft - **WHEN** an administrator saves a draft of a supported global, legal page, or partner record - **THEN** the draft SHALL be retained in version history and SHALL NOT replace the published content rendered publicly #### Scenario: Publish a draft - **WHEN** an administrator explicitly publishes a saved draft - **THEN** subsequent public requests SHALL be able to render the newly published content without an application redeployment ### Requirement: Hungarian and English locale support The CMS SHALL configure Hungarian (`hu`) and English (`en`) locales, use Hungarian as the default locale, and enable fallback to Hungarian for localized fields with no English value. This requirement applies only to fields configured as localized; it does not imply that every current content field has a translation. #### Scenario: Read a localized field without an English translation - **WHEN** the public site requests a localized field in English and that field has no English value - **THEN** Payload SHALL fall back to the Hungarian value ### Requirement: Localized page globals The Home, About, Services, Contact, and Common globals SHALL store every translatable text value (titles, subtitles, descriptions, body paragraphs, labels, button texts, form messages, FAQ entries, metadata, and locale-dependent link targets) separately per locale. Structural values (icons, row identifiers, the external-link flag, and the postal address) SHALL be shared across locales. List items that consist of a single text value (paragraph lists, bullet lists, feature lists, specification item lists) SHALL be editable per locale, including a different number of items per locale. For lists of structured rows, the row count, order, and structural values SHALL be shared across locales, and only the text values within each row SHALL be localized. #### Scenario: An administrator saves an English value - **WHEN** an administrator edits a translatable global field in the `en` locale and publishes it - **THEN** the English public page SHALL render the English value and the Hungarian public page SHALL continue to render the unchanged Hungarian value #### Scenario: An administrator changes a shared structural value - **WHEN** an administrator changes a structural value such as an icon in either locale - **THEN** both locales SHALL render the changed value #### Scenario: A paragraph list differs between locales - **WHEN** the Hungarian version of a paragraph list has three items and the English version has two - **THEN** each locale's public page SHALL render exactly its own items ### Requirement: Lossless locale migration of existing content When a previously non-localized global field becomes localized, its existing value SHALL be preserved as the Hungarian value, including values edited by administrators after the initial content import. The migration SHALL cover published content, saved drafts, and version history, SHALL NOT overwrite existing content with seed data, and SHALL be safe to run more than once. Deployed environments SHALL apply the migration without a manual step. #### Scenario: Deploy onto a database with administrator edits - **WHEN** the localized configuration is deployed onto a database whose globals were edited in the admin after the initial import - **THEN** after startup the Hungarian public pages SHALL render the edited values unchanged, and the English public pages SHALL render the same values through fallback #### Scenario: Restore an older version after migration - **WHEN** an administrator opens or restores a global version saved before the migration - **THEN** the version SHALL show its original text as the Hungarian value rather than empty fields #### Scenario: Migration runs a second time - **WHEN** the migration is executed on already migrated data - **THEN** stored values SHALL remain unchanged ### Requirement: Localized legal pages Legal pages SHALL store their title, last-updated text, and section titles and contents separately per locale. The slug and section identifiers SHALL be shared across locales. Existing Hungarian legal content SHALL be preserved as the Hungarian value, including published content and version history. #### Scenario: An administrator adds an English privacy policy - **WHEN** an administrator edits a legal page in the `en` locale - **THEN** the Hungarian legal page content SHALL remain unchanged #### Scenario: Existing legal page after migration - **WHEN** the localized legal page configuration is deployed onto existing data - **THEN** the Hungarian legal pages SHALL render the same content as before ### Requirement: English translation status Every page global and legal page SHALL carry an English translation status with the values "no translation", "AI draft awaiting review", and "approved", visible to administrators with a warning that AI drafts require review. Only an administrator action SHALL set the status to "approved". #### Scenario: AI draft is imported - **WHEN** machine-translated English content is imported for a page - **THEN** that page's status SHALL be "AI draft awaiting review" #### Scenario: An administrator approves a translation - **WHEN** an administrator sets the status to "approved" and publishes - **THEN** the page SHALL be marked as having an approved English translation ### Requirement: Non-destructive AI draft import Importing AI-draft English content SHALL only fill English values that are empty and whose current Hungarian source text is identical to the text that was translated. It SHALL NOT change Hungarian values, shared values, or existing English values, SHALL keep placeholders such as `{year}`, `{min}` and `{privacyHref}` intact, and SHALL be safe to run more than once. #### Scenario: Hungarian text changed after translation - **WHEN** a Hungarian value differs from the source text in the translation memory - **THEN** its English value SHALL stay empty and the import SHALL report it #### Scenario: An English value was already edited by a person - **WHEN** a field already has an English value - **THEN** the import SHALL leave it unchanged ### Requirement: Validated English legal pages The English translation of a legal page SHALL NOT be set to "approved" unless at least two distinct language models have reviewed it and their reviews are recorded in the CMS. Each review record SHALL contain the model name, the review date, the verdict (approve, approve with changes, reject), and the model's pasted answer. For each model only its latest review SHALL count, and a model whose latest verdict is "reject" SHALL NOT count. Reviews SHALL be run with the admin validation prompt, which covers meaning equivalence with the Hungarian text, data-protection terminology, omissions or additions, and preserved placeholders. #### Scenario: Approving an unvalidated legal translation - **WHEN** an administrator sets a legal page's English status to "approved" while fewer than two distinct models have a complete, non-rejecting latest review - **THEN** the CMS SHALL reject the save with a validation error #### Scenario: Approving a validated legal translation - **WHEN** two distinct models each have a complete latest review that does not reject the translation - **THEN** the CMS SHALL allow the status to be set to "approved" #### Scenario: A rejection is superseded - **WHEN** a model rejected the translation and, after corrections, a newer review by the same model approves it - **THEN** that model SHALL count towards the required reviews #### Scenario: Page globals are not affected - **WHEN** an administrator approves the English translation of a page global - **THEN** no legal validation record SHALL be required ### Requirement: Legal validation prompt in the admin The legal page editor SHALL offer administrators a ready-to-use validation prompt for the English translation. The prompt SHALL contain the review criteria, the requested structured output format, and the current Hungarian and English text of every section of that page, and SHALL be copyable with a single action. The prompt SHALL be generated from the same template that is used for the project's own model validation. #### Scenario: An administrator copies the validation prompt - **WHEN** an administrator opens a legal page that has English content and uses the copy action of the validation prompt panel - **THEN** the clipboard SHALL contain a prompt with the review criteria and the Hungarian and English text of each section of the current version #### Scenario: No English text yet - **WHEN** a legal page has no English content - **THEN** the panel SHALL state that there is nothing to validate instead of offering a prompt ### Requirement: Public partner media The CMS SHALL allow authenticated administrators to manage partner records and image media. Partner logos SHALL be optional in the CMS, but the public site SHALL render a partner only when a usable logo is available. Media reads required by public pages SHALL be publicly accessible; media writes SHALL remain protected. #### Scenario: Public page loads a partner logo - **WHEN** the public site requests an uploaded partner image - **THEN** the media endpoint SHALL allow the read without an administrator session #### Scenario: An unauthenticated user attempts to change media - **WHEN** an unauthenticated user attempts to create, update, or delete media - **THEN** the CMS SHALL deny the operation