# ---------------------------------------------------------------------------
# Sveltia CMS — Alpine Triad
#
# Served at the ROOT of admin.alpinetriad.com by its own Cloudflare Pages
# project (root directory: admin/, no build step). Hosting it at a subpath
# breaks image previews, so keep it at the root.
#
# Content lives in src/content/** of this same repo. Every locale is a
# separate file: home.en.json / home.cs.json / home.de.json.
# Media is committed to public/images/uploads and shipped by the next
# Cloudflare Pages build of the public site.
# ---------------------------------------------------------------------------
backend:
  name: github
  repo: BinaryTexx/alpinetriad-website
  branch: main
  # sveltia-cms-auth Worker (GitHub OAuth proxy).
  # Use the direct workers.dev URL — a custom domain here is less reliable.
  base_url: https://sveltia-cms-auth.texx.workers.dev

publish_mode: simple

media_folder: public/images/uploads
public_folder: /images/uploads

site_url: https://www.alpinetriad.com
display_url: https://www.alpinetriad.com
logo_url: https://www.alpinetriad.com/favicon.svg

i18n:
  structure: multiple_files
  locales: [en, cs, de]
  default_locale: en

# ---------------------------------------------------------------------------
# Reusable field groups
# ---------------------------------------------------------------------------
_link_fields: &link_fields
  - { label: Label, name: label, widget: string }
  - { label: 'Link (e.g. /booking or /#apartments)', name: href, widget: string }

collections:
  # =========================================================================
  # PAGES
  # =========================================================================
  - name: pages
    label: Pages
    label_singular: Page
    icon: article
    editor: { preview: false }
    files:
      # ---------------------------------------------------------------------
      # HOME
      # ---------------------------------------------------------------------
      - name: home
        label: Home page
        file: src/content/pages/home.json
        i18n: true
        fields:
          - label: SEO
            name: seo
            widget: object
            i18n: true
            fields:
              - { label: Page title, name: title, widget: string, i18n: true }
              - { label: Meta description, name: description, widget: text, i18n: true }
              - { label: Share image, name: ogImage, widget: image, i18n: duplicate }

          - label: Hero
            name: hero
            widget: object
            i18n: true
            fields:
              - { label: Eyebrow, name: eyebrow, widget: string, i18n: true }
              - { label: Headline, name: title, widget: string, i18n: true }
              - { label: Subtitle, name: subtitle, widget: text, i18n: true }
              - { label: Background image, name: image, widget: image, i18n: duplicate }
              - { label: Image alt text, name: imageAlt, widget: string, i18n: true }
              - label: Primary button
                name: primaryCta
                widget: object
                i18n: true
                fields: *link_fields
              - label: Secondary button
                name: secondaryCta
                widget: object
                i18n: true
                fields: *link_fields
              - label: Badges
                name: badges
                widget: list
                i18n: true
                summary: '{{fields.icon}} {{fields.text}}'
                fields:
                  - { label: Icon (emoji), name: icon, widget: string, i18n: duplicate }
                  - { label: Text, name: text, widget: string, i18n: true }

          - label: Quick facts bar
            name: quickFacts
            widget: list
            i18n: true
            summary: '{{fields.icon}} {{fields.label}} — {{fields.value}}'
            fields:
              - { label: Icon (emoji), name: icon, widget: string, i18n: duplicate }
              - { label: Label, name: label, widget: string, i18n: true }
              - { label: Value, name: value, widget: string, i18n: true }

          - label: About section
            name: about
            widget: object
            i18n: true
            fields:
              - { label: Eyebrow, name: eyebrow, widget: string, i18n: true }
              - { label: Heading, name: title, widget: string, i18n: true }
              - { label: Lead paragraph, name: lead, widget: text, i18n: true }
              - label: Paragraphs
                name: body
                i18n: true
                widget: list
                field: { label: Paragraph, name: text, widget: text }
              - { label: Image, name: image, widget: image, i18n: duplicate }
              - { label: Image alt text, name: imageAlt, widget: string, i18n: true }

          - label: Apartments section
            name: apartmentsSection
            widget: object
            i18n: true
            fields:
              - { label: Eyebrow, name: eyebrow, widget: string, i18n: true }
              - { label: Heading, name: title, widget: string, i18n: true }
              - { label: Lead, name: lead, widget: text, required: false, i18n: true }
              - { label: Callout icon, name: noteIcon, widget: string, i18n: duplicate }
              - { label: Callout title, name: noteTitle, widget: string, i18n: true }
              - { label: Callout text, name: noteText, widget: text, i18n: true }

          - label: Key facts grid
            name: keyInfo
            widget: object
            i18n: true
            fields:
              - { label: Eyebrow, name: eyebrow, widget: string, i18n: true }
              - { label: Heading, name: title, widget: string, i18n: true }
              - label: Items
                name: items
                widget: list
                i18n: true
                summary: '{{fields.icon}} {{fields.title}}'
                fields:
                  - { label: Icon (emoji), name: icon, widget: string, i18n: duplicate }
                  - { label: Title, name: title, widget: string, i18n: true }
                  - { label: First line, name: line1, widget: string, i18n: true }
                  - { label: Second line, name: line2, widget: string, i18n: true }

          - label: Gallery
            name: gallery
            widget: object
            i18n: true
            fields:
              - { label: Eyebrow, name: eyebrow, widget: string, i18n: true }
              - { label: Heading, name: title, widget: string, i18n: true }
              - label: Groups
                name: groups
                widget: list
                i18n: true
                summary: '{{fields.title}}'
                fields:
                  - { label: Group title, name: title, widget: string, i18n: true }
                  - { label: Group subtitle, name: subtitle, widget: string, i18n: true }
                  - label: Photos
                    name: images
                    widget: list
                    i18n: true
                    summary: '{{fields.src}}'
                    fields:
                      - { label: Photo, name: src, widget: image, i18n: duplicate }
                      - { label: Alt text, name: alt, widget: string, required: false, i18n: true }

          - label: Amenities
            name: amenities
            widget: object
            i18n: true
            fields:
              - { label: Eyebrow, name: eyebrow, widget: string, i18n: true }
              - { label: Heading, name: title, widget: string, i18n: true }
              - { label: Lead, name: lead, widget: text, i18n: true }
              - label: Items
                name: items
                widget: list
                i18n: true
                summary: '{{fields.icon}} {{fields.text}}'
                fields:
                  - { label: Icon (emoji), name: icon, widget: string, i18n: duplicate }
                  - { label: Text, name: text, widget: string, i18n: true }

          - label: 'Ski section (Nassfeld)'
            name: ski
            widget: object
            i18n: true
            fields:
              - { label: Eyebrow, name: eyebrow, widget: string, i18n: true }
              - { label: Heading, name: title, widget: string, i18n: true }
              - { label: Image, name: image, widget: image, i18n: duplicate }
              - { label: Image alt text, name: imageAlt, widget: string, i18n: true }
              - label: Paragraphs
                name: body
                i18n: true
                widget: list
                field: { label: Paragraph, name: text, widget: text }
              - { label: Tip icon, name: tipIcon, widget: string, i18n: duplicate }
              - { label: Tip label, name: tipLabel, widget: string, i18n: true }
              - { label: Tip text, name: tipText, widget: text, i18n: true }

          - label: 'Lake section (Pressegger See)'
            name: lake
            widget: object
            i18n: true
            fields:
              - { label: Eyebrow, name: eyebrow, widget: string, i18n: true }
              - { label: Heading, name: title, widget: string, i18n: true }
              - { label: Subtitle, name: subtitle, widget: string, i18n: true }
              - { label: Image, name: image, widget: image, i18n: duplicate }
              - { label: Image alt text, name: imageAlt, widget: string, i18n: true }
              - label: Paragraphs
                name: body
                i18n: true
                widget: list
                field: { label: Paragraph, name: text, widget: text }

          - label: Activities
            name: activities
            widget: object
            i18n: true
            fields:
              - { label: Eyebrow, name: eyebrow, widget: string, i18n: true }
              - { label: Heading, name: title, widget: string, i18n: true }
              - { label: Lead, name: lead, widget: text, i18n: true }
              - label: Cards
                name: items
                widget: list
                i18n: true
                summary: '{{fields.title}}'
                fields:
                  - { label: 'Tag (e.g. ❄️ Winter)', name: tag, widget: string, i18n: true }
                  - { label: Title, name: title, widget: string, i18n: true }
                  - { label: Text, name: text, widget: text, i18n: true }
                  - { label: 'Meta (distance/location)', name: meta, widget: string, i18n: true }
                  - { label: Image, name: image, widget: image, i18n: duplicate }
                  - { label: Image alt text, name: imageAlt, widget: string, i18n: true }

          - label: Italy section
            name: italy
            widget: object
            i18n: true
            fields:
              - { label: Eyebrow, name: eyebrow, widget: string, i18n: true }
              - { label: Heading, name: title, widget: string, i18n: true }
              - { label: Subtitle, name: subtitle, widget: string, i18n: true }
              - label: Paragraphs
                name: body
                i18n: true
                widget: list
                field: { label: Paragraph, name: text, widget: text }
              - label: Destinations
                name: destinations
                widget: list
                i18n: true
                summary: '{{fields.icon}} {{fields.name}}'
                fields:
                  - { label: Icon (emoji), name: icon, widget: string, i18n: duplicate }
                  - { label: Name, name: name, widget: string, i18n: true }
                  - { label: Detail, name: detail, widget: string, i18n: true }

          - label: Pricing
            name: pricing
            widget: object
            i18n: true
            fields:
              - { label: Eyebrow, name: eyebrow, widget: string, i18n: true }
              - { label: Heading, name: title, widget: string, i18n: true }
              - label: Table column headers
                name: columns
                i18n: true
                widget: list
                field: { label: Header, name: text, widget: string }
              - label: Table rows
                name: rows
                widget: list
                i18n: true
                summary: '{{fields.season}}'
                fields:
                  - { label: Season, name: season, widget: string, i18n: true }
                  - { label: 'Price — Ground (4)', name: priceSmall, widget: string, i18n: true }
                  - { label: 'Price — Vista & Peak (6)', name: priceLarge, widget: string, i18n: true }
              - label: Notes under the table
                name: notes
                i18n: true
                widget: list
                field: { label: Note, name: text, widget: text }
              - { label: Transparency badge, name: transparencyNote, widget: string, i18n: true }
              - { label: '"Included" heading', name: includedTitle, widget: string, i18n: true }
              - label: Included
                name: included
                i18n: true
                widget: list
                field: { label: Item, name: text, widget: string }
              - { label: '"Not included" heading', name: notIncludedTitle, widget: string, i18n: true }
              - label: Not included
                name: notIncluded
                i18n: true
                widget: list
                field: { label: Item, name: text, widget: string }
              - label: 'Info blocks (rules, payment, cancellation)'
                name: blocks
                widget: list
                i18n: true
                summary: '{{fields.icon}} {{fields.title}}'
                fields:
                  - { label: Icon (emoji), name: icon, widget: string, i18n: duplicate }
                  - { label: Title, name: title, widget: string, i18n: true }
                  - label: Items
                    name: items
                    i18n: true
                    widget: list
                    field: { label: Item, name: text, widget: string }

          - label: Location
            name: location
            widget: object
            i18n: true
            fields:
              - { label: Eyebrow, name: eyebrow, widget: string, i18n: true }
              - { label: Heading, name: title, widget: string, i18n: true }
              - { label: Address note, name: note, widget: string, i18n: true }
              - { label: Map link label, name: mapLinkLabel, widget: string, i18n: true }

          - label: Booking section
            name: booking
            widget: object
            i18n: true
            fields:
              - { label: Eyebrow, name: eyebrow, widget: string, i18n: true }
              - { label: Heading, name: title, widget: string, i18n: true }
              - { label: Lead, name: lead, widget: text, i18n: true }

          - label: FAQ
            name: faq
            widget: object
            i18n: true
            fields:
              - { label: Eyebrow, name: eyebrow, widget: string, i18n: true }
              - { label: Heading, name: title, widget: string, i18n: true }
              - label: Questions
                name: items
                widget: list
                i18n: true
                summary: '{{fields.q}}'
                fields:
                  - { label: Question, name: q, widget: string, i18n: true }
                  - { label: Answer, name: a, widget: text, i18n: true }

      # ---------------------------------------------------------------------
      # SITE CHROME
      # ---------------------------------------------------------------------
      - name: site
        label: Header, footer & contact
        file: src/content/pages/site.json
        i18n: true
        fields:
          - { label: Brand name, name: brandName, widget: string, i18n: true }
          - { label: Brand tagline, name: brandTagline, widget: string, i18n: true }
          - label: Main navigation
            name: nav
            widget: list
            i18n: true
            summary: '{{fields.label}} → {{fields.href}}'
            fields: *link_fields
          - { label: Header button label, name: ctaLabel, widget: string, i18n: true }
          - { label: Header button link, name: ctaHref, widget: string, i18n: duplicate }

          - label: Contact details
            name: contact
            widget: object
            i18n: duplicate
            fields:
              - { label: Company, name: company, widget: string }
              - { label: Street address, name: address, widget: string }
              - { label: Country, name: country, widget: string }
              - { label: Phone 1, name: phone1, widget: string }
              - { label: Phone 2, name: phone2, widget: string }
              - { label: E-mail, name: email, widget: string }
              - { label: Trade licence, name: gisa, widget: string }
              - { label: VAT / UID, name: vat, widget: string }
              - { label: Map embed URL, name: mapEmbed, widget: string }
              - { label: Map link URL, name: mapLink, widget: string }

          - label: Social links
            name: social
            widget: list
            i18n: duplicate
            summary: '{{fields.label}}'
            fields: *link_fields

          - label: Legal links
            name: legalLinks
            widget: list
            i18n: true
            summary: '{{fields.label}}'
            fields: *link_fields

          - { label: Footer note, name: footerNote, widget: string, i18n: true }
          - { label: Copyright holder, name: copyright, widget: string, i18n: true }

          - { label: 'Label: contact heading', name: contactHeading, widget: string, i18n: true }
          - { label: 'Label: phone', name: phoneLabel, widget: string, i18n: true }
          - { label: 'Label: e-mail', name: emailLabel, widget: string, i18n: true }
          - { label: 'Label: address', name: addressLabel, widget: string, i18n: true }
          - { label: 'Label: follow us', name: followLabel, widget: string, i18n: true }
          - { label: 'Label: skip to content', name: skipToContent, widget: string, i18n: true }
          - { label: 'Label: menu', name: menuLabel, widget: string, i18n: true }
          - { label: 'Label: close', name: closeLabel, widget: string, i18n: true }
          - { label: 'Label: language', name: languageLabel, widget: string, i18n: true }
          - { label: 'Label: back to apartments', name: backToApartments, widget: string, i18n: true }
          - { label: 'Label: book this apartment', name: bookThisApartment, widget: string, i18n: true }
          - { label: 'Label: view apartment', name: viewDetail, widget: string, i18n: true }
          - { label: 'Label: gallery', name: galleryOf, widget: string, i18n: true }
          - { label: 'Label: apartment amenities', name: amenitiesLabel, widget: string, i18n: true }
          - { label: 'Label: highlights', name: highlightsLabel, widget: string, i18n: true }
          - { label: 'Label: guests', name: guestsLabel, widget: string, i18n: true }
          - { label: 'Label: area unit', name: areaLabel, widget: string, i18n: true }
          - { label: 'Label: previous image', name: previousImage, widget: string, i18n: true }
          - { label: 'Label: next image', name: nextImage, widget: string, i18n: true }

  # =========================================================================
  # APARTMENTS
  # =========================================================================
  - name: apartments
    label: Apartments
    label_singular: Apartment
    icon: apartment
    folder: src/content/apartments
    extension: json
    format: json
    create: true
    slug: '{{slug}}'
    identifier_field: name
    summary: '{{name}} — {{floor}} ({{area}} m², {{guests}})'
    sortable_fields: [order, name]
    i18n: true
    editor: { preview: false }
    fields:
      - { label: Sort order, name: order, widget: number, value_type: int, default: 99, i18n: duplicate }
      - { label: Name, name: name, widget: string, i18n: true }
      - { label: 'Floor (Ground floor / 1st floor / Attic)', name: floor, widget: string, i18n: true }
      - { label: Area (m²), name: area, widget: number, value_type: int, i18n: duplicate }
      - { label: Max guests, name: guests, widget: number, value_type: int, i18n: duplicate }
      - { label: Bedrooms, name: bedrooms, widget: number, value_type: int, default: 1, i18n: duplicate }
      - { label: Tagline, name: tagline, widget: string, i18n: true }
      - { label: 'Short summary (card + meta description)', name: excerpt, widget: text, i18n: true }
      - { label: Cover image, name: coverImage, widget: image, i18n: duplicate }
      - label: Description paragraphs
        name: description
        i18n: true
        widget: list
        field: { label: Paragraph, name: text, widget: text }
      - label: Highlights
        name: highlights
        i18n: true
        widget: list
        field: { label: Highlight, name: text, widget: string }
      - label: Amenities
        name: amenities
        i18n: true
        widget: list
        field: { label: Amenity, name: text, widget: string }
      - label: Photos
        name: images
        widget: list
        i18n: true
        summary: '{{fields.src}}'
        fields:
          - { label: Photo, name: src, widget: image, i18n: duplicate }
          - { label: Alt text, name: alt, widget: string, required: false, i18n: true }
