# Decap CMS config for the HDC entries collection.
#
# backend.name/repo are placeholders for the real GitHub repo this spike
# would deploy against — not yet decided, see SPECIFICATION.md. For local
# testing (this spike), `local_backend: true` lets Decap talk to a local
# proxy server instead of GitHub, so no OAuth app is needed to try it:
#
#   1. From the repo root (hdc_v2/):        npx decap-server
#   2. From spikes/astro/:                  npm run dev
#   3. Visit:                               http://localhost:4321/admin/
#
# decap-server reads/writes relative to the directory it's run from, which
# is why it needs to run from the repo root — it lets the CMS edit
# /data/entries directly, the same canonical data every spike iteration
# reads from (see /schema/README.md), rather than a copy inside this
# Astro project.
backend:
  name: github
  repo: HDRUK/hdc_v2 # placeholder — replace once a real repo/org is confirmed
  branch: main

local_backend: true

media_folder: "spikes/astro/public/images/uploads"
public_folder: "/images/uploads"

collections:
  # A second "drop a file, get a page" folder collection, alongside `pages`
  # below — pointed at the shared /markdown folder (not this project's own
  # content-pages/) and rendered through a *different* template
  # (ArticleLayout.astro, not Base.astro) — tests SPECIFICATION.md's
  # "Demonstrate alternative layouts and images" section. `media_folder`
  # here overrides the top-level one so images an editor uploads for an
  # article land in the shared /images folder every other spike also reads
  # from, not a per-spike copy.
  - name: articles
    label: Articles
    label_singular: Article
    folder: "markdown"
    create: true
    format: "md"
    slug: "{{slug}}"
    media_folder: "/images"
    public_folder: "/images"
    fields:
      - { label: "Body", name: "body", widget: "markdown" }
  # A single-file "settings" collection, shared with every other spike (see
  # /data/site-settings.yaml) — tests the CMS's "turn on/off and edit text +
  # link for a banner" requirement (SPECIFICATION.md, "CMS gui like options").
  - name: settings
    label: Site Settings
    files:
      - name: banner
        label: Banner
        file: "data/site-settings.yaml"
        fields:
          - { label: "Enabled", name: "bannerEnabled", widget: "boolean" }
          - { label: "Text", name: "bannerText", widget: "string", required: false }
          - { label: "Link", name: "bannerLink", widget: "string", required: false }
  # A folder collection, not a fixed list of named files — this is the part
  # that actually tests SPECIFICATION.md's "Demonstrate Markdown rendering"
  # requirement. Clicking "New Site Page" here creates a brand new .md file
  # in content-pages/ with no config change, and it renders on the site via
  # the single generic route at src/pages/[page].astro (see that file and
  # src/content.config.ts). `format: md` means the whole file is the body —
  # no frontmatter block required, matching how summary.md/evaluation.md are
  # written today.
  - name: pages
    label: Site Pages
    label_singular: Page
    folder: "spikes/astro/content-pages"
    create: true
    format: "md"
    slug: "{{slug}}"
    fields:
      - { label: "Body", name: "body", widget: "markdown" }
  - name: entries
    label: HDC Entries
    label_singular: HDC Entry
    folder: "data/entries"
    create: true
    slug: "{{fields.id}}"
    extension: yaml
    format: yaml
    identifier_field: name
    summary: "{{name}} — {{readinessTier}}"
    fields:
      - { label: "ID (slug, must match filename)", name: "id", widget: "string" }
      - { label: "Name", name: "name", widget: "string" }
      - { label: "Description", name: "description", widget: "text" }
      - label: "Categories"
        name: "categories"
        widget: "select"
        multiple: true
        options:
          [
            "Service",
            "Product",
            "Template",
            "Training Product",
            "Framework",
            "Pathway",
            "Standard",
            "Template Standard Pathway Guidance",
          ]
      - label: "Readiness tier"
        name: "readinessTier"
        widget: "select"
        options: ["Exploratory", "Emerging", "Established"]
      - { label: "Primary purpose", name: "primaryPurpose", widget: "list", required: false }
      - { label: "Intended users", name: "intendedUsers", widget: "list", required: false }
      - label: "Primary contact route"
        name: "primaryContactRoute"
        widget: "select"
        options: ["URL", "Email"]
        required: false
      - { label: "Primary contact detail", name: "primaryContactDetail", widget: "string", required: false }
      - { label: "Contact team/person", name: "contactTeamPerson", widget: "string", required: false }
      - { label: "Adoption pack link", name: "adoptionPackLink", widget: "string", required: false }
      - { label: "Originator orgs", name: "originatorOrgs", widget: "list", required: false }
      - { label: "Links", name: "links", widget: "list", required: false }
      - { label: "DOI link", name: "doiLink", widget: "string", required: false }
      - { label: "Context of use", name: "contextOfUse", widget: "text", required: false }
      - label: "Maturity - TFS"
        name: "maturityTfs"
        widget: "select"
        options: ["Prototype", "Pilot", "Growth", "Productisation"]
        required: false
      - { label: "Primary use case", name: "primaryUseCase", widget: "list", required: false }
      - { label: "Intended outcomes", name: "intendedOutcomes", widget: "text", required: false }
      - { label: "What it is not", name: "whatItIsNot", widget: "text", required: false }
      - { label: "Number adopting", name: "numberAdopting", widget: "number", required: false }
      - { label: "Adoption evidence", name: "adoptionEvidence", widget: "text", required: false }
      - { label: "Registered users (2025)", name: "registeredUsers2025", widget: "string", required: false }
      - { label: "Preconditions", name: "preconditions", widget: "text", required: false }
      - { label: "Constraints", name: "constraints", widget: "text", required: false }
      - { label: "Dependencies", name: "dependencies", widget: "list", required: false }
      - label: "Cost model"
        name: "costModel"
        widget: "select"
        options: ["Free", "Cost recovery"]
        required: false
      - { label: "Cost model details", name: "costModelDetails", widget: "string", required: false }
      - label: "License"
        name: "license"
        widget: "select"
        options: ["Open Source", "Not Applicable", "CC-BY", "Custom Terms"]
        required: false
      - label: "Support level"
        name: "supportLevel"
        widget: "select"
        options: ["Supported service", "Light-touch"]
        required: false
      - { label: "Engagement pathway", name: "engagementPathway", widget: "list", required: false }
      - { label: "Response expectations", name: "responseExpectations", widget: "text", required: false }
      - { label: "Ownership boundary", name: "ownershipBoundary", widget: "text", required: false }
      - { label: "Related or alternative capability", name: "relatedOrAlternativeCapability", widget: "text", required: false }
