backend:
  name: github
  repo: Rasola2/il-mondo-intorno-a-noi
  branch: main
  base_url: 'https://www.ilmondointornoanoi.it'
  auth_endpoint: api/auth
  auth_methods:
    - oauth
    - token

# Media storage: posters are committed to src/assets/events so they go through the
# Astro <Image> optimisation pipeline (src/lib/images.ts). Frontmatter keeps the stable
# public path '/images/events/<file>', which src/pages/images/events/[file].ts also
# publishes as an absolute URL for Open Graph and JSON-LD.
media_folder: 'src/assets/events'
public_folder: '/images/events'

# Display settings
site_url: 'https://www.ilmondointornoanoi.it'
logo_url: '/images/brand/logo.png'

collections:
  - name: 'events'
    label: 'Incontri & Dossier'
    label_singular: 'Incontro'
    folder: 'src/content/events'
    create: true
    slug: '{{year}}-{{month}}-{{day}}-{{slug}}'
    extension: 'md'
    format: 'frontmatter'
    editor:
      preview: true
    summary: '#{{sessionNumber}} — {{title}}'
    sortable_fields: ['eventDate', 'sessionNumber', 'title']
    view_filters:
      - label: 'Pubblicati'
        field: isDraft
        pattern: false
      - label: 'Bozze'
        field: isDraft
        pattern: true
    fields:
      - {
          label: 'Titolo Incontro (5-120 caratteri)',
          name: 'title',
          widget: 'string',
          required: true,
          pattern: ['^[\s\S]{5,120}$', 'Il titolo deve contenere da 5 a 120 caratteri.'],
        }
      - {
          label: 'Numero Sessione',
          name: 'sessionNumber',
          widget: 'number',
          value_type: 'int',
          min: 1,
          required: false,
        }
      - {
          label: 'Data Incontro',
          name: 'eventDate',
          widget: 'datetime',
          format: 'YYYY-MM-DDTHH:mm:ssZ',
          date_format: 'DD/MM/YYYY',
          time_format: 'HH:mm',
          required: true,
        }
      - {
          label: 'Orario Apertura Porte',
          name: 'doorsOpenTime',
          widget: 'string',
          default: '20:30',
          pattern: ['^([01][0-9]|2[0-3]):[0-5][0-9]$', 'Formato HH:MM (es. 20:30)'],
        }
      - {
          label: 'Orario Inizio Dibattito',
          name: 'startTime',
          widget: 'string',
          default: '20:45',
          pattern: ['^([01][0-9]|2[0-3]):[0-5][0-9]$', 'Formato HH:MM (es. 20:45)'],
        }
      - label: 'Luogo Incontro'
        name: 'location'
        widget: 'object'
        fields:
          - { label: 'Nome Sala / Spazio', name: 'name', widget: 'string' }
          - { label: 'Indirizzo', name: 'address', widget: 'string' }
          - { label: 'Città', name: 'city', widget: 'string' }
          - {
              label: 'Link Google Maps',
              name: 'mapsUrl',
              widget: 'string',
              required: false,
              pattern:
                [
                  '^(https?://[^\s/$.?#][^\s]*)?$',
                  'Inserisci un indirizzo web completo che inizi con https:// (o http://).',
                ],
            }
      - {
          label: 'Locandina / Immagine di Copertina',
          name: 'coverImage',
          widget: 'image',
          default: '/images/events/default-cover.jpg',
          required: false,
        }
      - {
          label: 'Descrizione Alternativa Immagine',
          name: 'coverAlt',
          widget: 'string',
          default: "Locandina dell'incontro",
          required: false,
        }
      - {
          label: 'Sintesi / Abstract (20-300 caratteri)',
          name: 'summary',
          widget: 'text',
          required: true,
          pattern: ['^[\s\S]{20,300}$', 'La sintesi deve contenere da 20 a 300 caratteri.'],
        }
      - {
          label: 'Link Registrazione Spotify',
          name: 'spotifyEpisodeUrl',
          widget: 'string',
          required: false,
          pattern:
            [
              '^(https?://[^\s/$.?#][^\s]*)?$',
              'Inserisci un indirizzo web completo che inizi con https:// (o http://).',
            ],
        }
      - {
          label: 'Link Video / Registrazione YouTube',
          name: 'youtubeVideoUrl',
          widget: 'string',
          required: false,
          pattern:
            [
              '^(https?://[^\s/$.?#][^\s]*)?$',
              'Inserisci un indirizzo web completo che inizi con https:// (o http://).',
            ],
        }
      - label: 'Relatori & Moderatori'
        name: 'speakers'
        widget: 'list'
        required: false
        fields:
          - { label: 'Nome e Cognome', name: 'name', widget: 'string' }
          - { label: 'Ruolo / Bio Sintetica', name: 'role', widget: 'string', required: false }
      - label: 'Bibliografia & Fonti Consigliate'
        name: 'readingList'
        widget: 'list'
        required: false
        fields:
          - { label: 'Titolo Libro / Saggio', name: 'title', widget: 'string' }
          - { label: 'Autore', name: 'author', widget: 'string' }
          - {
              label: 'Anno di Pubblicazione',
              name: 'year',
              widget: 'number',
              value_type: 'int',
              required: false,
            }
          - {
              label: 'Link Scheda / Acquisto',
              name: 'link',
              widget: 'string',
              required: false,
              pattern:
                [
                  '^(https?://[^\s/$.?#][^\s]*)?$',
                  'Inserisci un indirizzo web completo che inizi con https:// (o http://).',
                ],
            }
      - label: 'Materiali & Dispense Cartografiche (PDF)'
        name: 'attachments'
        widget: 'list'
        required: false
        fields:
          - { label: 'Titolo Documento', name: 'label', widget: 'string' }
          - {
              label: 'File PDF',
              name: 'filePath',
              widget: 'file',
              choose_url: false,
              media_folder: 'public/documents',
              public_folder: '/documents',
            }
          - {
              label: 'Dimensione File (Bytes)',
              name: 'fileSizeBytes',
              widget: 'number',
              value_type: 'int',
              required: false,
            }
      - {
          label: 'Bozza (Nascondi dal sito pubblico)',
          name: 'isDraft',
          widget: 'boolean',
          default: false,
          required: false,
        }
      - { label: 'Dossier Esteso / Trascrizione (Markdown)', name: 'body', widget: 'markdown' }
