# Flexcompute.com content CMS (Decap).
#
# Editors sign in with Flexcompute Google SSO (the dev site already gates that). The CMS talks
# to a commit proxy (Lambda, same dev account) instead of GitHub directly: /__cms/auth validates
# the SSO cookie and hands the CMS a session token; api_root forwards git writes to GitHub as the
# flexcompute-cms App, but ONLY under frontend/flexcompute.com/. Saves commit straight to the
# content branch (no PR, no approval) — that branch auto-deploys to dev for review, and to prod
# once it's `main`. Marketing needs no GitHub account.
backend:
  name: github
  repo: flexcompute/flex
  branch: matt/flex-home-deploy-any-branch   # flip to `main` after the content PR lands
  base_url: https://dev.flexcompute.com      # auth popup origin (same-origin -> proxy)
  auth_endpoint: __cms/auth                  # no leading slash (Decap joins base_url + '/' + this)
  api_root: https://dev.flexcompute.com/__cms/api   # git writes -> proxy (CloudFront /__cms/* behavior)
  commit_messages:
    create: "cms: create {{collection}} “{{slug}}”"
    update: "cms: update {{collection}} “{{slug}}”"
    delete: "cms: delete {{collection}} “{{slug}}”"
    uploadMedia: "cms: upload {{path}}"
    deleteMedia: "cms: delete {{path}}"

# No editorial_workflow: edits commit directly to the content branch (straight-to-main once flipped).

site_url: https://dev.flexcompute.com
display_url: https://dev.flexcompute.com
# Paths are repo-root-relative so they are correct when we switch to the GitHub backend.
media_folder: "frontend/flexcompute.com/assets/uploads"
public_folder: "/assets/uploads"

collections:
  - name: faqs
    label: FAQs
    label_singular: FAQ
    description: "Frequently asked questions (Tidy3D / Flow360 / PhotonForge)."
    folder: "frontend/flexcompute.com/_faqs"
    create: true
    slug: "{{fields.id}}"
    extension: md
    format: yaml-frontmatter
    fields:
      - { name: title, label: Question, widget: string }
      - { name: category, label: Category, widget: string, required: false }
      - { name: id, label: "ID (URL slug)", widget: string, required: false }
      - { name: date, label: Date, widget: datetime, required: false }
      - { name: enabled, label: Published, widget: boolean, default: true, required: false }
      - { name: body, label: Answer, widget: markdown }

  - name: publications
    label: Publications
    label_singular: Publication
    description: "Peer-reviewed papers and publications."
    folder: "frontend/flexcompute.com/_publications"
    create: true
    slug: "{{title}}"
    extension: md
    format: yaml-frontmatter
    fields:
      - { name: layout, label: Layout, widget: hidden, default: post }
      - { name: title, label: Title, widget: string }
      - { name: author, label: Authors, widget: string }
      - { name: date, label: Date, widget: datetime }
      - { name: type, label: Domain, widget: select, options: ["EM", "CFD"], default: EM }
      - { name: journal_name, label: Journal, widget: string, required: false }
      - { name: backlink, label: "External link (DOI/PDF)", widget: string, required: false }
      - { name: notebook_link, label: "Notebook link", widget: string, required: false }
      - { name: post_image, label: Image, widget: image, required: false }
      - { name: description, label: Description, widget: text, required: false }
      - { name: body, label: Body, widget: markdown, required: false }

  - name: positions
    label: Open Positions
    label_singular: Position
    description: "Careers / open roles."
    folder: "frontend/flexcompute.com/_positions"
    create: true
    slug: "{{position_title}}"
    extension: md
    format: yaml-frontmatter
    fields:
      - { name: layout, label: Layout, widget: hidden, default: open_positions }
      - { name: enable, label: Published, widget: boolean, default: true }
      - { name: position_title, label: Position title, widget: string }
      - { name: title, label: "Page title (SEO)", widget: string, required: false }
      - { name: site, label: Site, widget: string, required: false }
      - { name: country, label: Country, widget: string, required: false }
      - { name: apply_email, label: Apply email, widget: string, required: false }
      - { name: date, label: Date, widget: datetime, required: false }
      - { name: tags, label: Tags, widget: list, required: false }
      - { name: description, label: Description, widget: markdown, required: false }
      - { name: body, label: Body, widget: markdown, required: false }

  # NOTE: no blog collection — blog authoring lives in HubSpot (the on-site /blog
  # index redirects to hs.flexcompute.com). The legacy _posts files stay in the
  # repo and keep rendering, they are just not edited through this CMS.

  # ============================================================================
  # HOMEPAGE — edits www.flexcompute.com main page.
  # Files collections can only EDIT the files listed here; they cannot create
  # new files. Decap rewrites the whole YAML file on save and silently drops
  # any key not declared below, so EVERY top-level key in home.yml is declared
  # even though only face_section (and start_section's enable flag, on the
  # PhotonForge open-access page) is rendered anywhere today.
  # ============================================================================
  - name: homepage
    label: Homepage
    description: >-
      Content for the www.flexcompute.com main page: the hero headlines, the
      trust-logo marquee, and homepage SEO. Sections marked NOT LIVE are kept
      so saving does not delete them — editing them changes nothing visible.
    editor:
      preview: false
    files:
      - name: home_content
        label: "Homepage content (trust logos)"
        file: "frontend/flexcompute.com/_data/home.yml"
        fields:
          - name: face_section
            label: "Hero (LIVE — logos also shown on the PhotonForge open-access page)"
            widget: object
            fields:
              - { name: enable, label: "Show hero section (also gates the FlexAgent and PhotonForge open-access heroes)", widget: boolean, default: true }
              # Hero copy. Keep the <span class="fc-hero-em">...</span> tags around the words
              # that should render in the highlight style (and fc-hero-pill for the pill).
              - { name: hero_title, label: "Headline (keep the <span> tags around highlighted words)", widget: string }
              - { name: subheadline, label: "Subheadline (line under the headline)", widget: string, required: false }
              - { name: trust_label, label: "Trust label (small caps line under the headline)", widget: string }
              - { name: foundation_title, label: "Second headline (scroll state)", widget: string }
              - { name: foundation_sub, label: "Second subline (scroll state)", widget: string }
              - { name: logo_bg, label: "Legacy image path (unused, do not change)", widget: string, required: false }
              - { name: btn_start, label: "Legacy image path (unused, do not change)", widget: string, required: false }
              - { name: btn_see, label: "Legacy image path (unused, do not change)", widget: string, required: false }
              - name: columns
                label: "Trust logo marquee"
                label_singular: logo
                widget: list
                summary: "{{fields.alt}}"
                fields:
                  - { name: src, label: "Logo image", widget: image }
                  - { name: alt, label: "Company name (alt text)", widget: string }
                  - { name: class, label: "CSS class (set by developers, usually blank)", widget: string, required: false }
          - name: platform_section
            label: "Platform cards (NOT LIVE on any page)"
            widget: object
            collapsed: true
            fields:
              - { name: enable, label: Enabled, widget: boolean, default: true }
              - { name: features_bg, label: "Background image path", widget: string, required: false }
              - { name: btn_explore, label: "Explore button image path", widget: string, required: false }
              - name: columns
                label: Cards
                widget: list
                fields:
                  - { name: icon, label: Icon, widget: image }
                  - { name: title, label: Title, widget: string }
                  - { name: subtitle, label: Subtitle, widget: text }
                  - { name: num, label: "Stat (e.g. 1.8, 350, 20K)", widget: string, required: false }
                  - { name: unit, label: Unit, widget: string, required: false }
                  - { name: numtip, label: "Stat caption", widget: string, required: false }
          - name: products_section
            label: "Product cards (NOT LIVE on any page)"
            widget: object
            collapsed: true
            fields:
              - { name: enable, label: Enabled, widget: boolean, default: true }
              - name: columns
                label: Products
                widget: list
                summary: "{{fields.name}}"
                fields:
                  - { name: name, label: Name, widget: string }
                  - { name: icon, label: "Logo / icon", widget: image }
                  - { name: subtitle, label: Description, widget: text }
                  - { name: img, label: "Product image", widget: image }
                  - { name: url, label: URL, widget: string }
          - name: customer_sections
            label: "Customer testimonials (NOT LIVE on any page)"
            label_singular: testimonial
            widget: list
            collapsed: true
            summary: "{{fields.name}}"
            fields:
              - { name: quote, label: Quote, widget: text }
              - { name: name, label: "Person name", widget: string, required: false }
              - { name: title, label: "Person title", widget: string, required: false }
              - { name: logo, label: "Company logo", widget: image }
              - { name: url, label: "Read-more link", widget: string, required: false }
              - { name: has_read_more, label: "Show read-more", widget: boolean, required: false }
          - name: trusted_section
            label: "Trusted section (NOT LIVE on any page)"
            widget: object
            collapsed: true
            fields:
              - { name: enable, label: Enabled, widget: boolean, default: true }
              - { name: logo_1, label: "Logo 1 path", widget: string, required: false }
              - { name: logo_2, label: "Logo 2 path", widget: string, required: false }
              - { name: trusted_bg, label: "Background image path", widget: string, required: false }
              - { name: learn_more, label: "Learn-more image path", widget: string, required: false }
          - name: features_section
            label: "Feature cards (NOT LIVE on any page)"
            widget: object
            collapsed: true
            fields:
              - { name: enable, label: Enabled, widget: boolean, default: true }
              - { name: bg, label: "Background image path", widget: string, required: false }
              - name: columns
                label: Cards
                widget: list
                fields:
                  - { name: img, label: Image, widget: image }
                  - { name: name, label: Eyebrow, widget: string }
                  - { name: title, label: Title, widget: string }
                  - { name: subtitle, label: Subtitle, widget: string }
                  - { name: btn, label: "Button label", widget: string }
          - name: security_section
            label: "Security badges (NOT LIVE on any page)"
            widget: object
            collapsed: true
            fields:
              - { name: enable, label: Enabled, widget: boolean, default: true }
              - { name: icon_1, label: "SOC badge path", widget: string, required: false }
              - { name: icon_2, label: "ISO badge path", widget: string, required: false }
              - { name: learn_more, label: "Learn-more image path", widget: string, required: false }
          - name: start_section
            label: "Start CTA (LIVE only on the PhotonForge open-access page)"
            widget: object
            collapsed: true
            fields:
              - { name: enable, label: "Show start CTA", widget: boolean, default: true }
              - { name: btn_start, label: "Start button image path", widget: string, required: false }
              - { name: btn_see, label: "See button image path", widget: string, required: false }

      - name: home_seo
        label: "Homepage SEO (title, description, share image)"
        file: "frontend/flexcompute.com/index.html"
        fields:
          - { name: layout, label: Layout, widget: hidden, default: default }
          - { name: title, label: "Browser / Google title", widget: string }
          - { name: description, label: "Meta description", widget: text }
          - name: image
            label: "Social share image"
            widget: object
            fields:
              - { name: path, label: Image, widget: image }
              - { name: alt, label: "Alt text", widget: string }
          - { name: tags, label: "SEO keywords", widget: list, required: false }
          - { name: author, label: Author, widget: string, required: false }
          - { name: custom_font, label: "Font preset", widget: hidden, required: false }
          # Body holds the page's HTML/JS; hidden so it round-trips untouched on save.
          - { name: body, label: "Page code (managed by developers)", widget: hidden, required: false }

  # ============================================================================
  # NAVIGATION & FOOTER — header menus (incl. Products mega-menu) and the
  # footer link columns. Blast radius is EVERY page on the site; keep
  # editorial_workflow (PR review) on once the GitHub backend is enabled.
  # ============================================================================
  - name: navigation
    label: "Navigation & footer links"
    description: >-
      Header menus (including the Products mega-menu) and footer link columns
      for every page on the site. Do not change Analytics IDs — they drive
      click tracking.
    editor:
      preview: false
    files:
      - name: site_map
        label: "Menus & footer columns"
        file: "frontend/flexcompute.com/_data/site_map.yml"
        fields:
          - name: main_menu
            label: "Main menu"
            label_singular: "menu item"
            widget: list
            summary: "{{fields.text}}"
            fields:
              - { name: text, label: "Menu label", widget: string }
              - { name: url, label: "URL (use '#' for dropdown-only items)", widget: string }
              - { name: click_id, label: "Analytics ID — do not change (breaks click tracking)", widget: string, required: false }
              - { name: menu_type, label: "Menu type", widget: select, options: ["dropdown"], required: false }
              - { name: header_enable, label: "Show in header", widget: boolean, default: true }
              - { name: footer_enable, label: "Show in footer", widget: boolean, default: true }
              - { name: footer_class, label: "Footer column CSS class (developers)", widget: string, required: false }
              - { name: mega_menu, label: "Render as mega-menu (Products style)", widget: boolean, required: false }
              - name: sections
                label: "Mega-menu sections (only used when mega-menu is on)"
                label_singular: section
                widget: list
                required: false
                summary: "{{fields.heading}}"
                fields:
                  - { name: heading, label: "Section heading", widget: string }
                  - name: items
                    label: Items
                    widget: list
                    summary: "{{fields.name}}"
                    fields:
                      - { name: name, label: Name, widget: string }
                      - { name: description, label: "Short description", widget: string }
                      - { name: url, label: URL, widget: string }
                      - { name: click_id, label: "Analytics ID — do not change", widget: string, required: false }
              - name: mega_footer
                label: "Mega-menu footer links"
                widget: list
                required: false
                summary: "{{fields.name}}"
                fields:
                  - { name: name, label: Label, widget: string }
                  - { name: url, label: URL, widget: string }
                  - { name: click_id, label: "Analytics ID — do not change", widget: string, required: false }
              - name: submenu
                label: "Dropdown / footer column links"
                label_singular: link
                widget: list
                required: false
                summary: "{{fields.text}}"
                fields:
                  - { name: text, label: Label, widget: string }
                  - { name: url, label: URL, widget: string }
                  - { name: click_id, label: "Analytics ID — do not change", widget: string, required: false }
                  - { name: header_enable, label: "Show in header dropdown", widget: boolean, default: true }
                  - { name: footer_enable, label: "Show in footer column", widget: boolean, default: true }
                  - { name: target, label: "Open in new tab", widget: select, options: ["_blank"], required: false }