# Sveltia CMS – administrace webu hasiciunanov.cz (dostupná na /admin/).
# Obsah se ukládá jako commity přímo do větve main (publish_mode: simple).

backend:
  name: gitlab
  repo: ewebs/hasiciunanov.cz
  branch: main
  # Vlastní GitLab (git.evalue.cz), přihlášení přes OAuth PKCE bez serveru.
  base_url: https://git.evalue.cz
  api_root: https://git.evalue.cz/api/v4
  auth_type: pkce
  # TODO (Lukáš): ID aplikace z GitLabu (Admin → Applications, nebo Skupina → Applications).
  #   Redirect URI: https://hasiciunanov.cz/admin/ a http://localhost:8080/admin/
  #   Scope: api. Typ aplikace: Confidential vypnout (PKCE).
  app_id: 1ea3592b9ce9905a8962892091447124222d149022a43c02088eb73cc5ad60ad

site_url: https://hasiciunanov.cz
display_url: https://hasiciunanov.cz
locale: cs

# Nahrané soubory (dokumenty) jdou do src/dokumenty a na webu jsou na /dokumenty/.
media_folder: src/dokumenty
public_folder: /dokumenty

collections:
  - name: dokumenty
    label: Dokumenty
    label_singular: Dokument
    folder: src/dokumenty-polozky
    extension: md
    format: yaml-frontmatter
    create: true
    slug: "{{slug}}"
    summary: "{{nazev}} ({{typ}})"
    sortable_fields: [nazev, skupina, poradi]
    fields:
      - { label: Název, name: nazev, widget: string }
      - label: Skupina
        name: skupina
        widget: relation
        collection: dokumentySkupiny
        search_fields: [nazev]
        value_field: "{{slug}}"
        display_fields: [nazev]
        hint: Skupiny (nadpisy a úvodní texty) se upravují v kolekci „Skupiny dokumentů“.
      - { label: Typ (štítek na kartě, např. PPTX, PDF, Tabulka), name: typ, widget: string }
      - { label: Popis (např. Prezentace), name: popis, widget: string, required: false }
      - { label: Soubor ke stažení, name: soubor, widget: file, required: false, hint: Nahrajte soubor, nebo vyplňte odkaz níže. }
      - { label: Odkaz (externí, např. Google Tabulky), name: odkaz, widget: string, required: false, hint: Použije se, jen když není nahraný soubor. }
      - { label: Pořadí ve skupině, name: poradi, widget: number, value_type: int, required: false, hint: Menší číslo je výš. Bez čísla se řadí abecedně na konec. }

  - name: dokumentySkupiny
    label: Skupiny dokumentů
    label_singular: Skupinu
    folder: src/dokumenty-skupiny
    extension: md
    format: yaml-frontmatter
    create: true
    slug: "{{slug}}"
    summary: "{{nazev}}"
    sortable_fields: [poradi, nazev]
    fields:
      - { label: Rubrika (malý nadpis nad názvem), name: rubrika, widget: string }
      - { label: Název skupiny, name: nazev, widget: string }
      - { label: Pořadí na stránce, name: poradi, widget: number, value_type: int, required: false, hint: Menší číslo je výš. }
      - { label: Úvodní text, name: body, widget: markdown, required: false, buttons: [bold, italic, link], editor_components: [] }

  - name: vedeni
    label: Vedení sboru (SDH)
    label_singular: Člena vedení
    folder: src/vedeni
    extension: md
    format: yaml-frontmatter
    create: true
    slug: "{{slug}}"
    summary: "{{funkce}} – {{jmeno}}"
    sortable_fields: [poradi, funkce, jmeno]
    fields:
      - { label: Funkce, name: funkce, widget: string, hint: "Např. Starosta sboru, Náměstek starosty" }
      - { label: Jméno (včetně titulů), name: jmeno, widget: string }
      - { label: Pořadí na stránce, name: poradi, widget: number, value_type: int, required: false, hint: Menší číslo je výš. }

  - name: jsdh
    label: Členové zásahové jednotky (JSDH)
    label_singular: Člena
    folder: src/jsdh
    extension: md
    format: yaml-frontmatter
    create: true
    slug: "{{slug}}"
    summary: "{{jmeno}}"
    sortable_fields: [poradi, jmeno]
    fields:
      - { label: Jméno, name: jmeno, widget: string }
      - label: Kvalifikace
        name: kody
        widget: select
        multiple: true
        required: false
        hint: "Zkratky se zobrazují u jména. Seznam zkratek a jejich význam je v src/_data/kvalifikace.json."
        options:
          - { label: "VJ – Velitel jednotky", value: VJ }
          - { label: "VD – Velitel družstva", value: VD }
          - { label: "S – Strojník", value: S }
          - { label: "NDT – Nositel dýchací techniky", value: NDT }
          - { label: "ZZZ – Zdravotník", value: ZZZ }
          - { label: "OMP – Obsluha motorových pil", value: OMP }
          - { label: "TCH – Technik dobrovolné jednotky", value: TCH }
          - { label: "TOOB – Technik ochrany obyvatelstva", value: TOOB }
      - { label: Pořadí na stránce, name: poradi, widget: number, value_type: int, required: false, hint: Menší číslo je výš. Bez čísla se řadí abecedně na konec. }

  - name: akce
    label: Akce
    label_singular: Akci
    folder: src/udalosti/akce
    extension: md
    format: yaml-frontmatter
    create: true
    slug: "{{datum_od}}-{{slug}}"
    summary: "{{datum_od}} · {{title}}"
    sortable_fields: [datum_od, title]
    fields:
      - { label: Název, name: title, widget: string }
      - { label: Datum (první den), name: datum_od, widget: datetime, format: YYYY-MM-DD, date_format: DD.MM.YYYY, time_format: false }
      - { label: Datum do (jen u vícedenní akce), name: datum_do, widget: datetime, format: YYYY-MM-DD, date_format: DD.MM.YYYY, time_format: false, required: false }
      - { label: Čas (např. 16:00), name: cas, widget: string, required: false }
      - { label: Místo, name: misto, widget: string, required: false }
      # Plakáty jsou zatím vypnuté (úložiště fotek se řeší později); šablona plakat podporuje.
      # - { label: Plakát, name: plakat, widget: image, required: false }
      - { label: Odkaz pro více informací, name: odkaz, widget: string, required: false, hint: "Celá adresa včetně https://" }
      - { label: Krátká adresa webu, name: kratka_adresa, widget: string, required: false, pattern: ["^[a-z0-9-]+$", "Jen malá písmena bez diakritiky, čísla a pomlčky"], hint: "Např. ples2027 vytvoří hasiciunanov.cz/ples2027/ a přesměruje na odkaz výše. Vyžaduje vyplněný odkaz." }
      - { label: Popis, name: body, widget: markdown, required: false, buttons: [bold, italic, link, bulleted-list], editor_components: [] }

  - name: souteze
    label: Soutěže
    label_singular: Soutěž
    folder: src/udalosti/souteze
    extension: md
    format: yaml-frontmatter
    create: true
    slug: "{{datum_od}}-{{slug}}"
    summary: "{{datum_od}} · {{title}}"
    sortable_fields: [datum_od, title]
    fields:
      - { label: Název, name: title, widget: string }
      - { label: Datum (první den), name: datum_od, widget: datetime, format: YYYY-MM-DD, date_format: DD.MM.YYYY, time_format: false }
      - { label: Datum do (jen u vícedenní soutěže), name: datum_do, widget: datetime, format: YYYY-MM-DD, date_format: DD.MM.YYYY, time_format: false, required: false }
      - { label: Čas (např. 9:00), name: cas, widget: string, required: false }
      - { label: Místo, name: misto, widget: string, required: false }
      # Plakáty jsou zatím vypnuté (úložiště fotek se řeší později); šablona plakat podporuje.
      # - { label: Plakát, name: plakat, widget: image, required: false }
      - { label: Odkaz na přihlášku (Google formulář apod.), name: odkaz, widget: string, required: false, hint: "Celá adresa včetně https://" }
      - { label: Krátká adresa webu, name: kratka_adresa, widget: string, required: false, pattern: ["^[a-z0-9-]+$", "Jen malá písmena bez diakritiky, čísla a pomlčky"], hint: "Např. soutez2027 vytvoří hasiciunanov.cz/soutez2027/ a přesměruje na přihlášku. Vyžaduje vyplněný odkaz." }
      - { label: Popis, name: body, widget: markdown, required: false, buttons: [bold, italic, link, bulleted-list], editor_components: [] }

  - name: vyjezdy
    label: Výjezdy JSDH
    label_singular: Výjezd
    folder: src/vyjezdy
    extension: md
    format: yaml-frontmatter
    create: true
    slug: "{{datum}}-{{slug}}"
    summary: "{{datum}} · {{typ}} · {{title}}"
    sortable_fields: [datum, typ, title]
    fields:
      - { label: Stručný název, name: title, widget: string, hint: "Např. Požár trávy nebo Spadlý strom. Bez jmen a přesných adres." }
      - { label: Datum, name: datum, widget: datetime, format: YYYY-MM-DD, date_format: DD.MM.YYYY, time_format: false }
      - { label: Čas výjezdu (např. 14:25), name: cas, widget: string, required: false }
      - label: Druh události
        name: typ
        widget: select
        options: [Požár, Dopravní nehoda, Technická pomoc, Záchrana osob a zvířat, Únik nebezpečných látek, Planý poplach, Cvičení, Ostatní]
        default: Ostatní
      - { label: Obec / lokalita, name: lokalita, widget: string, hint: "Jen obec nebo část obce, bez přesné adresy." }
      - label: Zasahující jednotky
        name: jednotky
        widget: list
        default: [JSDHO Únanov]
        field: { label: Jednotka, name: jednotka, widget: string }
      # Fotky výjezdů jsou zatím vypnuté (úložiště fotek se řeší později); šablona foto podporuje.
      # - { label: Fotka, name: foto, widget: image, required: false, hint: "Bez rozpoznatelných osob a poznávacích značek." }
      - { label: Popis, name: body, widget: markdown, required: false, buttons: [bold, italic, link, bulleted-list], editor_components: [], hint: "Stručně co se stalo a co jednotka dělala. Bez údajů o zasažených osobách." }
