local_backend: true
backend:
  name: github
  # Use this line in local
  # name: git-gateway
  repo: Telescoop/atelier-emmaus
  branch: main
  squash_merges: true
  base_url: https://gateway.telescoop.fr
  auth_endpoint: /github/auth

# Améliore la réactivité de l'éditeur
editor:
  preview: true

# Configuration du rich text editor
markdown:
  editor_components: []
  buttons:
    - bold
    - italic
    - code
    - link
    - heading-one
    - heading-two
    - heading-three
    - heading-four
    - quote
    - bulleted-list
    - numbered-list

media_folder: '/public/media' # Emplacement par défaut où les fichiers seront stockés
public_folder: '/media' # L'attribut src pour les médias téléchargés
base_folder: 'src/content'

# Slug configuration for filenames
slug:
  encoding: 'ascii'
  clean_accents: true
  sanitize_replacement: '-'

# Champs réutilisables
title_field: &title_field
  label: 'Titre'
  name: 'title'
  widget: 'string'

metadata_field: &metadata_field
  name: 'metadata'
  label: 'Métadonnées'
  hint: 'Pour le SEO et les réseaux sociaux'
  widget: 'object'
  collapsed: false
  fields:
    - label: 'Titre Meta (SEO)'
      name: 'title'
      widget: 'string'
      required: false
      hint: 'Si vide, utilise le titre principal de la page'
    - label: 'Description'
      name: 'description'
      widget: 'string'
      required: false
    - label: 'Image de couverture'
      name: 'heroImage'
      widget: 'image'
      required: false
      hint: 'Image utilisée pour la preview sur les réseaux sociaux'

body_field: &body_field
  label: 'Contenu'
  name: 'body'
  widget: 'markdown'

content_blocks_field: &content_blocks_field
  label: 'Contenu de la page'
  name: 'contentBlocks'
  widget: 'list'
  required: false
  hint: 'Ajoutez et organisez les différents blocs de contenu'
  types:
    # - label: 'Hero'
    #   name: 'hero'
    #   widget: 'object'
    #   fields:
    #     - { label: 'Titre', name: 'title', widget: 'string' }
    #     - { label: 'Sous-titre', name: 'subtitle', widget: 'string', required: false }
    #     - { label: 'Image de fond', name: 'backgroundImage', widget: 'image', required: false }
    #     - { label: 'Texte du bouton', name: 'buttonText', widget: 'string', required: false }
    #     - { label: 'Lien du bouton', name: 'buttonLink', widget: 'string', required: false }
    # - label: 'Texte'
    #   name: 'text'
    #   widget: 'object'
    #   fields:
    #     - { label: 'Contenu', name: 'content', widget: 'markdown', required: true }
    # - label: 'Vidéo (URL externe)'
    #   name: 'video-url'
    #   widget: 'object'
    #   fields:
    #     - {
    #         label: 'URL de la vidéo',
    #         name: 'url',
    #         widget: 'string',
    #         hint: 'URL YouTube, Vimeo, ou lien direct vers un fichier vidéo',
    #       }
    #     - { label: 'Légende', name: 'caption', widget: 'string', required: false }
    # - label: 'Petite vidéo (upload)'
    #   name: 'small-video'
    #   widget: 'object'
    #   fields:
    #     - {
    #         label: 'Fichier vidéo',
    #         name: 'video',
    #         widget: 'file',
    #         hint: 'Téléchargez une vidéo MP4, WebM ou OGG (max 128MB)',
    #         media_library:
    #           {
    #             config:
    #               {
    #                 max_file_size: 134217728,
    #                 media_formats: ['video/mp4', 'video/webm', 'video/ogg'],
    #               },
    #           },
    #         pattern:
    #           [
    #             '\\.mp4$|\\.webm$|\\.ogg$',
    #             'Format de fichier non supporté. Utilisez MP4, WebM ou OGG.',
    #           ],
    #       }
    #     - { label: 'Légende', name: 'caption', widget: 'string', required: false }
    # - label: "Carrousel d'images"
    #   name: 'carousel'
    #   widget: 'object'
    #   fields:
    #     - label: 'Images'
    #       name: 'images'
    #       widget: 'list'
    #       min: 2
    #       max: 10
    #       hint: 'Entre 2 et 10 images'
    #       fields:
    #         - { label: 'Image', name: 'image', widget: 'image' }
    #         - { label: 'Alt text', name: 'alt', widget: 'string', required: false }
    #         - { label: 'Légende', name: 'caption', widget: 'string', required: false }
    # - label: 'Image unique'
    #   name: 'image'
    #   widget: 'object'
    #   fields:
    #     - { label: 'Image', name: 'src', widget: 'image' }
    #     - { label: 'Alt text', name: 'alt', widget: 'string' }
    #     - { label: 'Légende', name: 'caption', widget: 'string', required: false }
    #     - {
    #         label: 'Taille',
    #         name: 'size',
    #         widget: 'select',
    #         options: ['small', 'medium', 'large', 'full'],
    #         default: 'large',
    #       }
    # - label: 'Citation'
    #   name: 'quote'
    #   widget: 'object'
    #   fields:
    #     - { label: 'Citation', name: 'text', widget: 'text', required: true, min: 10, max: 500, hint: 'Entre 10 et 500 caractères' }
    #     - { label: 'Auteur', name: 'author', widget: 'string', required: false }
    # - label: "Galerie d'images"
    #   name: 'gallery'
    #   widget: 'object'
    #   fields:
    #     - label: 'Images'
    #       name: 'images'
    #       widget: 'list'
    #       field: { label: 'Image', name: 'image', widget: 'image' }
    #       min: 1
    #       max: 20
    #       hint: 'Entre 1 et 20 images'
    #     - {
    #         label: 'Colonnes',
    #         name: 'columns',
    #         widget: 'select',
    #         options: ['2', '3', '4'],
    #         default: '3',
    #       }
    # - label: 'Document'
    #   name: 'document'
    #   widget: 'object'
    #   fields:
    #     - {
    #         label: 'Fichier',
    #         name: 'file',
    #         widget: 'file',
    #         hint: 'Téléchargez un document (PDF, DOCX, etc.)',
    #       }
    #     - { label: 'Titre', name: 'title', widget: 'string' }
    #     - { label: 'Description', name: 'description', widget: 'text', required: false }
    # - label: 'Titre'
    #   name: 'title'
    #   widget: 'object'
    #   fields:
    #     - { label: 'Texte', name: 'text', widget: 'string', required: true, max: 200, hint: 'Maximum 200 caractères' }
    #     - {
    #         label: 'Niveau',
    #         name: 'level',
    #         widget: 'select',
    #         options: ['h1', 'h2', 'h3', 'h4'],
    #         default: 'h2',
    #       }
    - label: 'Section de contenu'
      name: 'layout-wrapper'
      hint: 'Une section peut contenir plusieurs groupes de blocs, chaque groupe ayant ses propres colonnes'
      widget: 'object'
      summary: '{{fields.sectionTitle}}'
      fields:
        - {
            label: 'Variante',
            name: 'variant',
            widget: 'select',
            options:
              [
                { label: 'Hero (pleine largeur)', value: 'hero' },
                { label: 'Avec marges', value: 'contained' },
              ],
            default: 'contained',
          }
        - {
            label: 'Couleur de fond',
            name: 'backgroundColor',
            widget: 'select',
            options: [
              { label: 'Blanc', value: 'white' },
              { label: 'Beige', value: 'beige' },
              { label: 'Jaune', value: 'yellow' },
              { label: 'Bleu', value: 'blue' },
              { label: 'Vert', value: 'green' }
            ],
            required: false,
            hint: 'Couleur de fond de la section (optionnel)',
          }
        - {
            label: 'Titre de section',
            name: 'sectionTitle',
            widget: 'string',
            required: false,
            hint: 'Titre affiché en haut de la section (optionnel)',
          }
        - {
            label: 'Niveau du titre',
            name: 'sectionTitleLevel',
            widget: 'select',
            options: [
              { label: 'H1 (très grand)', value: 'h1' },
              { label: 'H2 (grand)', value: 'h2' },
              { label: 'H3 (moyen)', value: 'h3' },
              { label: 'H4 (petit)', value: 'h4' }
            ],
            default: 'h2',
            required: false,
            hint: 'Taille du titre de section',
          }
        - {
            label: 'Couleur du titre',
            name: 'sectionTitleColor',
            widget: 'select',
            options: [
              { label: 'Par défaut (vert)', value: 'default' },
              { label: 'Noir', value: 'black' },
              { label: 'Jaune', value: 'yellow' },
              { label: 'Vert', value: 'green' },
              { label: 'Rouge', value: 'red' },
              { label: 'Bleu', value: 'blue' },
              { label: 'Bleu clair', value: 'blue-light' }
            ],
            default: 'default',
            required: false,
            hint: 'Couleur du titre de section',
          }
        - label: 'Groupes de blocs'
          name: 'groups'
          widget: 'list'
          hint: 'Ajoutez un ou plusieurs groupes de blocs. Chaque groupe peut avoir ses propres colonnes.'
          required: false
          fields:
            - {
                label: 'Colonnes',
                name: 'columns',
                widget: 'select',
                options: [
                  { label: '1 colonne', value: '1' },
                  { label: '2 colonnes', value: '2' },
                  { label: '3 colonnes', value: '3' },
                  { label: '4 colonnes', value: '4' },
                  { label: '5 colonnes', value: '5' },
                  { label: '6 colonnes', value: '6' },
                  { label: '7 colonnes', value: '7' },
                  { label: '8 colonnes', value: '8' },
                  { label: '9 colonnes', value: '9' },
                  { label: '10 colonnes', value: '10' },
                  { label: '11 colonnes', value: '11' },
                  { label: '12 colonnes', value: '12' }
                ],
                default: '1',
                hint: 'Nombre de colonnes pour ce groupe de blocs',
              }
            - label: 'Blocs'
              name: 'blocks'
              widget: 'list'
              hint: 'Ajoutez les blocs pour ce groupe'
              min: 1
              types:
                - label: 'Texte'
                  name: 'text'
                  widget: 'object'
                  fields:
                    - { label: 'Contenu', name: 'content', widget: 'markdown', required: true }
                    - { label: 'Police', name: 'fontFamily', widget: 'select', options: [{ label: 'Dinn (sans-serif)', value: 'sans' }, { label: 'Questrial (serif)', value: 'serif' }], default: 'sans', required: false }
                    - { label: 'Graisse', name: 'fontWeight', widget: 'select', options: ['light', 'normal', 'medium', 'semibold', 'bold'], default: 'normal', required: false }
                    - { label: 'Couleur du texte', name: 'textColor', widget: 'select', options: ['default', 'yellow', 'green', 'red', 'blue', 'blue-light'], default: 'default', required: false }
                    - { label: 'Majuscules', name: 'uppercase', widget: 'boolean', default: false, required: false, hint: 'Mettre le texte en majuscules' }
                - label: 'Vidéo (URL externe)'
                  name: 'video-url'
                  widget: 'object'
                  fields:
                    - { label: 'URL de la vidéo', name: 'url', widget: 'string' }
                    - { label: 'Légende', name: 'caption', widget: 'string', required: false }
                - label: 'Image unique'
                  name: 'image'
                  widget: 'object'
                  fields:
                    - { label: 'Image', name: 'src', widget: 'image' }
                    - { label: 'Alt text', name: 'alt', widget: 'string' }
                    - { label: 'Légende', name: 'caption', widget: 'string', required: false }
                    - {
                        label: 'Taille',
                        name: 'size',
                        widget: 'select',
                        options: [
                          { label: 'Extra petite (256-320px)', value: 'xs' },
                          { label: 'Petite (320-384px)', value: 'sm' },
                          { label: 'Moyenne (384-640px)', value: 'md' },
                          { label: 'Grande (512-896px)', value: 'lg' },
                          { label: 'Très grande (640-1152px)', value: 'xl' },
                          { label: 'Extra large (896-1440px)', value: '2xl' },
                          { label: 'Pleine largeur', value: 'full' }
                        ],
                        default: 'lg',
                      }
                - label: 'Citation'
                  name: 'quote'
                  widget: 'object'
                  fields:
                    - { label: 'Citation', name: 'text', widget: 'text', required: true, min: 10, max: 500, hint: 'Entre 10 et 500 caractères' }
                    - { label: 'Auteur', name: 'author', widget: 'string', required: false }
                - label: "Galerie d'images"
                  name: 'gallery'
                  widget: 'object'
                  fields:
                    - label: 'Images'
                      name: 'images'
                      widget: 'list'
                      field: { label: 'Image', name: 'image', widget: 'image' }
                      min: 1
                      max: 20
                      hint: 'Entre 1 et 20 images'
                    - {
                        label: 'Colonnes',
                        name: 'columns',
                        widget: 'select',
                        options: ['2', '3', '4'],
                        default: '3',
                      }
                - label: 'Titre'
                  name: 'title'
                  widget: 'object'
                  fields:
                    - { label: 'Texte', name: 'text', widget: 'string', required: true, max: 200, hint: 'Maximum 200 caractères' }
                    - {
                        label: 'Niveau',
                        name: 'level',
                        widget: 'select',
                        options: ['h1', 'h2', 'h3', 'h4'],
                        default: 'h2',
                      }
                    - { label: 'Police', name: 'fontFamily', widget: 'select', options: [{ label: 'Dinn (sans-serif)', value: 'sans' }, { label: 'Questrial (serif)', value: 'serif' }], default: 'serif', required: false }
                    - { label: 'Graisse', name: 'fontWeight', widget: 'select', options: ['light', 'normal', 'medium', 'semibold', 'bold'], default: 'semibold', required: false }
                    - { label: 'Couleur', name: 'textColor', widget: 'select', options: ['default', 'yellow', 'green', 'red', 'blue', 'blue-light'], default: 'green', required: false }
                - label: 'Carte avec lien'
                  name: 'card'
                  widget: 'object'
                  fields:
                    - { label: 'Image', name: 'image', widget: 'image', required: false }
                    - { label: 'Titre', name: 'title', widget: 'string', required: true }
                    - { label: 'Description', name: 'description', widget: 'text', required: false }
                    - { label: 'Lien', name: 'link', widget: 'string', required: true, hint: 'URL de destination (ex: /devenir-partenaire-mecene)' }
                    - { label: 'Texte du bouton', name: 'buttonText', widget: 'string', default: 'En savoir plus', required: false }
                - label: 'Bouton'
                  name: 'button'
                  widget: 'object'
                  fields:
                    - { label: 'Texte', name: 'text', widget: 'string', required: true }
                    - label: 'Lien'
                      name: 'href'
                      widget: 'string'
                      required: true
                      hint: "Exemples: '/contact' (page interne), 'https://example.com' ou 'www.example.com' (externe). Les liens externes s'ouvrent automatiquement dans un nouvel onglet."
                    - { label: 'Variante', name: 'variant', widget: 'select', options: ['primary', 'secondary'], default: 'primary', required: false }
                    - { label: 'Fond plein', name: 'filled', widget: 'boolean', default: true, required: false }
                    - { label: 'Avec bordure', name: 'bordered', widget: 'boolean', default: false, required: false }
                    - { label: 'Taille', name: 'size', widget: 'select', options: ['sm', 'md', 'lg'], default: 'md', required: false }
                - label: 'FAQ (Questions fréquentes)'
                  name: 'faq'
                  widget: 'object'
                  fields:
                    - { label: 'Titre', name: 'title', widget: 'string', default: 'Questions fréquentes', required: false }
                    - label: 'Questions'
                      name: 'items'
                      widget: 'list'
                      min: 1
                      fields:
                        - { label: 'Question', name: 'question', widget: 'string', required: true }
                        - { label: 'Réponse', name: 'answer', widget: 'text', required: true }

collections:
  - name: 'blog'
    label: 'Blog'
    folder: '{{ base_folder }}/blog'
    create: true
    slug: '{{year}}-{{month}}-{{day}}-{{slug}}'
    fields:
      - *title_field
      - { label: 'Date de publication', name: 'pubDate', widget: 'datetime' }
      - *metadata_field
      - *body_field

  - name: 'pages'
    label: 'Pages'
    folder: 'src/content/pages'
    create: true
    slug: '{{slug}}'
    fields:
      - *title_field
      - *metadata_field
      - *content_blocks_field

