# Decap CMS configuration for kiraschindler.com / KirARTify.
#
# Backend: Gitea OAuth (git.ndtss.de). Until the repo is transferred from
# koellner/ to kiraschindler/, leave `repo:` on koellner/kirartify. Update
# the line below after the Gitea transfer is done.
#
# Media: stored under public/uploads (browser-resolvable). The reference
# Decap writes into JSON (`public_folder` value) is `/uploads/<area>/<file>`,
# a plain absolute web URL. Astro serves public/ verbatim at the site root,
# so the same URL works in both editor preview and production runtime.
# Existing content was migrated from ~/assets/... in the same commit batch
# that introduced this config — see feat/decap-images-public-folder branch.

backend:
  name: gitea
  repo: kiraschindler/kirartify
  branch: main
  api_root: https://git.ndtss.de/api/v1
  base_url: https://git.ndtss.de
  # auth_endpoint defaults to /login/oauth/authorize which is correct for Gitea.
  app_id: a00987dd-c12c-497f-b237-cc5c2f496975
  # The OAuth client-id is NOT a secret (it's a public identifier sent in the
  # browser redirect). The client-secret stays inside Gitea and is never
  # required here because Decap uses PKCE (implicit-like flow with code
  # verifier) since Decap 3.x against Gitea 1.20+.

# OAuth: Decap performs an implicit-grant flow against Gitea directly,
# no separate auth proxy needed (Gitea supports PKCE since 1.20).
# Register the OAuth app in Gitea with these redirect URIs:
#   https://kiraschindler.com/admin/
#   http://localhost:4321/admin/

publish_mode: simple                # editorial_workflow needs PR review; Kira is solo so simple is fine

# Top-level media folders. Each image widget below overrides these to land
# uploads in the right subfolder (products / events / pages).
#
# The global "Media" tab is limited to files directly inside this folder
# (Decap doesn't recurse into subdirs by default). Kira uses image widgets
# inside Products/Shows/Pages instead — the media tab is only useful for
# ad-hoc uploads that don't belong to a single collection.
media_folder: "public/uploads"
public_folder: "/uploads"

# Site URL shown in the Decap UI (preview links, "view live" buttons).
site_url: https://kiraschindler.com
display_url: https://kiraschindler.com
logo_url: /favicon.svg

# Languages — Decap UI itself stays in English; content is i18n via separate
# files per locale (see `pages` collection below).

collections:
  # ---------------------------------------------------------------------
  # Pages — editorial copy for static pages, one JSON per page+language.
  # Filename pattern: <page>.<lang>.json (e.g. about.en.json, about.de.json).
  # Astro reads these via getEntry('pages', `${page}.${lang}`).
  # ---------------------------------------------------------------------
  - name: pages
    label: Pages
    label_singular: Page
    folder: src/content/pages
    extension: json
    format: json
    create: false                   # Kira edits existing pages, doesn't add new ones
    slug: "{{fields.pageKey}}.{{fields.lang}}"
    identifier_field: pageKey
    summary: "{{pageKey}} · {{lang}}"
    sortable_fields: [pageKey, lang]
    fields:
      - { name: pageKey, label: "Page key", widget: string, hint: "Internal id, e.g. 'about', 'home', 'contact'. Do not rename without updating the Astro view." }
      - { name: lang, label: "Language", widget: select, options: ["en", "de"] }
      - { name: eyebrow, label: "Eyebrow (small caps line)", widget: string, required: false }
      - { name: title, label: "Title (H1)", widget: string, required: false }
      - { name: lead, label: "Lead paragraph (bold intro)", widget: text, required: false }
      - { name: intro, label: "Intro paragraph", widget: text, required: false }
      - { name: cta, label: "Call-to-action button label", widget: string, required: false }
      - name: paragraphs
        label: "Body paragraphs"
        widget: list
        required: false
        summary: "{{fields.text | truncate(60)}}"
        field: { name: text, label: "Paragraph", widget: text }
      - name: extras
        label: "Extra fields (key/value)"
        widget: list
        required: false
        hint: "Free-form key/value pairs for page-specific bits (e.g. 'home.title.line1')."
        summary: "{{fields.key}} = {{fields.value | truncate(40)}}"
        fields:
          - { name: key, label: Key, widget: string }
          - { name: value, label: Value, widget: text }
      - name: heroImage
        label: "Hero-Bild (optional)"
        widget: image
        required: false
        hint: "Großes Header-Bild auf dieser Seite. Leer lassen = Default-Layout."

  # ---------------------------------------------------------------------
  # Products — already in src/content/products, JSON format.
  # ---------------------------------------------------------------------
  - name: products
    label: Products
    label_singular: Product
    folder: src/content/products
    extension: json
    format: json
    create: true
    slug: "{{slug}}"
    identifier_field: slug
    summary: "{{title}} · {{price}} {{currency}}"
    sortable_fields: [title, price, availability]
    fields:
      - { name: slug, label: "Slug (URL)", widget: string, hint: "lowercase-with-dashes, never change after publishing" }
      - { name: sku, label: SKU, widget: string, required: false }
      - { name: title, label: Title, widget: string }
      - { name: description, label: Description, widget: text }
      - { name: price, label: "Price (number, blank = on request)", widget: number, required: false, value_type: float }
      - { name: currency, label: Currency, widget: string, default: "EUR" }
      - name: availability
        label: Availability
        widget: select
        options: ["in_stock", "on_request", "sold"]
        default: "in_stock"
      - name: categories
        label: Categories
        widget: list
        required: false
        field: { name: cat, label: Category, widget: string }
      - { name: sourceUrl, label: "Original source URL", widget: string, required: false }
      - name: imagesLocal
        label: "Bilder"
        widget: list
        required: false
        collapsed: false
        minimize_collapsed: false
        hint: "Klick auf ein Bild → 'Choose an image' bzw. 'Replace' zum Austauschen, '×' zum Löschen. Neue Bilder: 'Add Bilder +' klicken oder Datei in den Editor ziehen."
        summary: "Bild"
        field:
          name: image
          label: Image
          widget: image
          allow_multiple: false
          choose_url: false
      - name: images
        label: "External image URLs (legacy, Wix)"
        widget: list
        required: false
        field: { name: url, label: URL, widget: string }

  # ---------------------------------------------------------------------
  # Events — shows / exhibitions.
  # ---------------------------------------------------------------------
  - name: events
    label: Shows
    label_singular: Show
    folder: src/content/events
    extension: json
    format: json
    create: true
    slug: "{{slug}}"
    identifier_field: slug
    summary: "{{title}} · {{startDate}}"
    sortable_fields: [startDate, title]
    fields:
      - { name: slug, label: Slug, widget: string }
      - { name: title, label: Title, widget: string }
      - { name: description, label: Description, widget: text, required: false, default: "" }
      - { name: startDate, label: "Start (ISO datetime)", widget: datetime, format: "YYYY-MM-DDTHH:mm:ssZZ" }
      - { name: endDate, label: "End (ISO datetime, optional)", widget: datetime, required: false, format: "YYYY-MM-DDTHH:mm:ssZZ" }
      - { name: location, label: "Location name", widget: string, default: "" }
      - { name: address, label: Address, widget: string, default: "" }
      - { name: city, label: City, widget: string, default: "" }
      - { name: country, label: Country, widget: string, default: "" }
      - { name: instagram, label: "Instagram link", widget: string, required: false }
      - name: extraNotes
        label: "Extra notes"
        widget: list
        required: false
        field: { name: note, label: Note, widget: string }
      - name: cover
        label: "Cover image"
        widget: image
        required: true
        hint: "Hauptbild der Show/Ausstellung."
      - { name: sourceUrl, label: "Original source URL", widget: string, required: false }

  # ---------------------------------------------------------------------
  # Featured portfolio picks — a hand-curated subset of products that
  # appear in the portfolio view. (Implementation note: as long as there
  # is no separate `portfolio_featured` collection yet, this section
  # serves as Decap-side scaffold; will be wired into Astro once Kira
  # signals she wants a separate curated list.)
  # ---------------------------------------------------------------------
  - name: portfolio_featured
    label: "Portfolio · Featured selection"
    folder: src/content/portfolio_featured
    extension: json
    format: json
    create: true
    slug: "{{order}}-{{productSlug}}"
    identifier_field: productSlug
    summary: "#{{order}} · {{productSlug}}"
    sortable_fields: [order, productSlug]
    fields:
      - { name: order, label: "Display order", widget: number, value_type: int }
      - { name: productSlug, label: "Product slug (must match a product)", widget: string }
      - { name: note, label: "Optional caption", widget: text, required: false }
