# CMX MedGen Response Instructions

## What MedGen Must Do

CMX sends one generation task for one exact page target. MedGen must return localized content already placed into the CMX page skeleton format.

MedGen generates text and content values. CMX owns the route, page type, module order, CSS, spacing, responsive layout, schema assembly, canonical URLs, global header, global footer, forms, logo, favicon, preview, approval and deploy.

For every task:

- preserve the requested `target.route` and `target.content_path` when they are provided;
- use the requested `locale` language for all public text;
- return content for the requested page only;
- generate all text strings inside allowed module props: headings, paragraphs, lists, FAQ, CTA labels, SEO title/description, image prompts, image alt text, source labels and relation labels;
- do not return a full website document;
- do not return CSS, JavaScript, forms, global navigation, footer, logo or favicon.

## Required Response Shape

Preferred path:

```text
result.cmx_page
```

Required JSON shape:

```json
{
  "status": "succeeded",
  "stage": "done",
  "progress": 100,
  "result": {
    "cmx_page": {
      "version": "cmx-page-skeleton-v1",
      "content_type": "technical_page",
      "route": "/about/",
      "locale": "bg_BG",
      "seo": {
        "title": "Localized SEO title",
        "description": "Localized SEO description",
        "robots": "index,follow"
      },
      "modules": [
        {
          "type": "page_header",
          "slot": "header",
          "props": {
            "h1": "Generated H1",
            "lead": "Generated lead."
          }
        },
        {
          "type": "rich_text",
          "slot": "main",
          "props": {
            "html": "<section><h2>Generated H2</h2><p>Generated paragraph.</p></section>"
          }
        }
      ],
      "faq": [],
      "media": [],
      "relations": {}
    }
  }
}
```

Backward-compatible fallback:

```text
article.body
```

`article.body` may be returned as a fallback HTML fragment, but CMX prefers `result.cmx_page` because it is directly mountable into page modules.

## HTML Rules

Allowed inside body/module HTML strings:

```text
section, article, header, div, h1, h2, h3, p, ul, ol, li, dl, dt, dd,
strong, em, small, blockquote, table, thead, tbody, tr, th, td, a
```

Forbidden:

```text
doctype, html, head, body, script, style, iframe, form, input, textarea,
button, svg, canvas, link, meta, inline styles, on* event attributes
```

Contact pages are special: MedGen fills the upper content modules only. CMX appends the contact form below the MedGen content.

## Locale And URL Rules

CMX sites use one root locale per domain.

If `locale=bg_BG`, Bulgarian content is published at:

```text
/
/about/
/bady/example-product/
/obzory/example-product-review/
/experts/example-reviewer/
```

Do not generate locale folders such as `/bg/`, `/en/` or `/ru/` unless CMX explicitly sends such a route.

## Page Formats

### Home Page

Use when `content_type=home_page`, route `/`.

Generate:

- SEO title and description;
- brand slogan;
- hero H1 and lead;
- homepage CTA labels;
- search placeholder;
- product carousel heading and lead;
- trust/evidence card headings and text;
- methodology block text;
- expert/trust block text;
- FAQ preview;
- brand visual prompt, caption and alt text.

Do not generate the actual carousel data if CMX did not ask for products in this task. CMX renders the product carousel from product pages and site data.

### Technical Pages

Use when `content_type=technical_page`.

Supported `page_key` values:

| page_key | route |
|---|---|
| `about` | `/about/` |
| `methodology` | `/methodology/` |
| `editorial_policy` | `/editorial-policy/` |
| `information_sources` | `/sources/` |
| `affiliate_disclosure` | `/affiliate-disclosure/` |
| `contact` | `/contact/` |
| `support` | `/support/` |
| `faq` | `/faq/` |
| `how_to_use` | `/how-to-use/` |
| `suggest_supplement` | `/suggest-supplement/` |
| `legal_information` | `/legal-information/` |
| `disclaimer` | `/disclaimer/` |
| `privacy_policy` | `/privacy-policy/` |
| `terms_of_use` | `/terms/` |
| `cookie_policy` | `/cookie-policy/` |

Expected module pattern:

```json
{
  "result": {
    "cmx_page": {
      "version": "cmx-page-skeleton-v1",
      "content_type": "technical_page",
      "route": "/methodology/",
      "locale": "bg_BG",
      "seo": {
        "title": "Localized SEO title",
        "description": "Localized SEO description"
      },
      "modules": [
        {
          "type": "page_header",
          "slot": "header",
          "props": {
            "h1": "Generated page heading",
            "lead": "Generated intro."
          }
        },
        {
          "type": "rich_text",
          "slot": "main",
          "props": {
            "html": "<section><h2>Generated section</h2><p>Generated paragraph.</p><ul><li>Generated list item.</li></ul></section>"
          }
        },
        {
          "type": "faq",
          "slot": "main",
          "props": {
            "items": [
              {
                "question": "Generated question?",
                "answer_html": "<p>Generated answer.</p>"
              }
            ]
          }
        }
      ],
      "faq": [],
      "media": [],
      "relations": {
        "related_pages": []
      }
    }
  }
}
```

### Index Pages

Use for catalog and list pages such as:

- `/bady/`
- `/obzory/`
- `/experts/`
- `/guides/`
- `/popular-products/`
- `/sravneniya/`
- `/brands/`
- `/vitamins-minerals/`

Generate only index-level text: SEO title/description, H1, lead, intro sections, FAQ and widget labels. Do not generate full product, review or expert pages inside an index page task.

### Product Card

Use when `content_type=product_card`.

The product card route usually looks like:

```text
/bady/{product_slug}/
```

Generate:

- product name and brand;
- short summary;
- long description;
- facts/specification text;
- price/seller labels when provided by the request;
- safety note;
- affiliate note;
- CTA label;
- image prompt and image alt text;
- SEO title and description.

Preserve `relations.product_route`, `relations.review_route` and `relations.expert_route` if CMX sends them.

### Expert Profile

Use when `content_type=expert_profile`.

The expert route usually looks like:

```text
/experts/{expert_slug}/
```

Generate:

- expert display name;
- role/title;
- short bio;
- longer profile text;
- qualification section;
- reviewed-materials section;
- disclosure text;
- portrait prompt and alt text;
- SEO title and description.

Do not invent credentials that contradict the request. If the request contains demo data, keep it clearly neutral.

### Product Review

Use when `content_type=product_review`.

The review route usually looks like:

```text
/obzory/{product_slug}-review/
```

Generate:

- review H1 and lead;
- summary;
- verdict;
- rating text/value when the request allows it;
- pros and cons;
- safety notes;
- main review sections;
- FAQ;
- source labels and source URLs when known;
- links/labels back to product and expert routes;
- SEO title and description.

A product content bundle is complete only when `product_card`, `expert_profile` and `product_review` tasks for the same product all succeed and pass CMX preview/approval.

### Guide Article

Use when `content_type=guide_article`.

Generate:

- guide H1 and lead;
- article sections;
- lists/tables where useful;
- FAQ;
- related product/review labels;
- SEO title and description.

## Final Checklist

Before returning a successful task, verify:

- `result.cmx_page.version` is `cmx-page-skeleton-v1`;
- `result.cmx_page.route` matches the requested route;
- `result.cmx_page.locale` matches the requested locale;
- all visible strings are in the requested language;
- modules contain generated text, not placeholders;
- no forbidden HTML appears;
- contact form, global header, footer, logo and favicon are not included;
- fallback `article.body` exists if `result.cmx_page` cannot be produced.
