# Zone Otomasyon content admin (Decap CMS).
#
# LOCAL USE:  run `npm run admin` next to `npm run dev`, open
#             http://localhost:4321/config/ — local_backend applies on
#             localhost only and bypasses GitHub entirely.
# PRODUCTION: GitHub backend below + the OAuth relay worker in
#             deploy/decap-oauth/. Keep /config/ behind Cloudflare Access.

backend:
  name: github
  repo: iooppo/zone-website
  branch: main
  base_url: https://zone-decap-oauth.orhungunes.workers.dev

media_folder: public/images
public_folder: /images

site_url: https://www.zoneotomasyon.com
logo_url: /favicon.svg

collections:
  - name: blog
    label: Blog Posts
    label_singular: Blog Post
    folder: src/content/blog
    create: true
    slug: '{{slug}}'
    sortable_fields: [pubDate, title, cluster]
    view_groups:
      - label: Cluster
        field: cluster
    fields:
      - { name: title, label: Title, widget: string }
      - { name: description, label: 'Meta description (SEO, 1–2 sentences)', widget: text }
      - { name: pubDate, label: 'Publish date', widget: datetime, format: 'YYYY-MM-DD', time_format: false }
      - name: cluster
        label: 'Topic cluster'
        widget: select
        options: [tia-portal, drives, plc, fieldbus, schneider, marine, retrofit]
      - { name: tags, label: Tags, widget: list, default: [] }
      - { name: draft, label: 'Draft (hidden from site)', widget: boolean, default: false, required: false }
      - { name: body, label: Body, widget: markdown }

  - name: projects
    label: Globe Projects
    files:
      - name: projects
        label: 'Project pins (globe + projects page)'
        file: src/data/projects.json
        fields:
          - name: projects
            label: Projects
            widget: list
            summary: '{{fields.client}} — {{fields.city}} ({{fields.year}})'
            fields:
              - { name: slug, label: 'Slug (unique, kebab-case)', widget: string }
              - { name: client, label: Client, widget: string }
              - { name: city, label: City, widget: string }
              - { name: country, label: Country, widget: string }
              - { name: lat, label: Latitude, widget: number, value_type: float }
              - { name: lon, label: Longitude, widget: number, value_type: float }
              - { name: year, label: Year, widget: string }
              - name: sector
                label: Sector
                widget: object
                fields:
                  - { name: en, label: 'Sector (EN)', widget: string }
                  - { name: tr, label: 'Sector (TR)', widget: string }
              - name: desc
                label: Description
                widget: object
                fields:
                  - { name: en, label: 'Description (EN)', widget: text }
                  - { name: tr, label: 'Description (TR)', widget: text }
              - { name: tags, label: Tags, widget: list }
              - { name: featured, label: 'Featured on homepage', widget: boolean, default: false, required: false }
              - { name: image, label: 'Installation photo', widget: image, required: false, hint: 'Landscape photos work best (min ~1200px wide)' }
