# yaml-language-server: $schema=https://unpkg.com/@sveltia/cms/schema/sveltia-cms.json

collections:
  - name: events
    label: Events
    label_singular: Event
    description: Events with their own detail page and photo gallery, shown under Our Events.
    folder: src/content/events
    extension: json
    format: json
    create: true
    identifier_field: title
    summary: '{{title}} — {{date}}'
    sortable_fields:
      fields: [date, title]
      default:
        field: date
        direction: descending
    fields:
      - { label: Title, name: title, widget: string }
      - label: Date
        name: date
        widget: datetime
        time_format: false
        format: 'yyyy-MM-dd'
        date_format: 'dd MMM yyyy'
        hint: Used to show the newest events first.
      - { label: Card Summary, name: summary, widget: text }
      - { label: Intro, name: tagline, widget: text }
      - { label: Venue, name: venue, widget: string }
      - { label: Participants, name: participants, widget: string }
      - { label: Cover Image, name: image, widget: image }
      - { label: Cover Image Alt Text, name: image_alt, widget: string }
      - { label: About Heading, name: about_title, widget: string, default: About the Event }
      - { label: About Image, name: about_image, widget: image }
      - { label: About Image Alt Text, name: about_image_alt, widget: string }
      - label: About Paragraphs
        name: paragraphs
        widget: list
        field: { label: Paragraph, name: paragraph, widget: text }
      - { label: Activities Heading, name: activities_title, widget: string, default: Celebrating Student Talent }
      - label: Activities
        name: activities
        widget: list
        required: false
        summary: '{{fields.title}}'
        fields:
          - { label: Title, name: title, widget: string }
          - label: Icon
            name: icon
            widget: string
            hint: 'Lucide icon name, for example lucide:music or lucide:medal.'
      - { label: Gallery Heading, name: gallery_title, widget: string, default: Event Gallery }
      - label: Gallery Photos
        name: gallery
        widget: list
        required: false
        summary: '{{fields.image_alt}}'
        fields:
          - { label: Image, name: image, widget: image }
          - { label: Image Alt Text, name: image_alt, widget: string }

  - name: news
    label: News & Events items
    label_singular: News Item
    description: Announcements, events and updates shown on the News & Events page.
    folder: src/content/news
    extension: json
    format: json
    create: true
    identifier_field: title
    summary: '{{title}} — {{date}}'
    view_groups:
      - label: Category
        field: category
    sortable_fields:
      fields:
        - date
        - title
      default:
        field: date
        direction: descending
    fields:
      - label: Title
        name: title
        widget: string

      - label: Category
        name: category
        widget: relation
        collection: _singletons
        file: news-categories
        value_field: categories.*.id
        display_fields:
          - categories.*.name
        search_fields:
          - categories.*.name
        hint: Decides which filter chip shows this item. Managed under News categories.

      - label: Date
        name: date
        widget: datetime
        time_format: false
        format: 'yyyy-MM-dd'
        date_format: 'dd MMM yyyy'
        hint: Newest items appear first.

      - label: Summary
        name: summary
        widget: text
        hint: One or two sentences shown on the card.

      - label: Image
        name: image
        widget: image
        required: false
        hint: A placeholder box with the alt text shows until this is set.

      - label: Image Alt Text
        name: image_alt
        widget: string

      - label: Link
        name: link
        widget: object
        required: false
        collapsed: true
        hint: Optional button on the card — a notice, a form or an external article.
        fields:
          - label: Label
            name: label
            widget: string
            required: false
            default: Read More
          - label: Link
            name: href
            widget: string
            required: false

  - name: news-page
    label: News & Events page
    icon: campaign
    files:
      - name: seo
        label: "Search & Social"
        file: src/content/news-page/seo.json
        icon: search
        fields:
          - label: Meta Title
            name: meta_title
            widget: string
          - label: Meta Description
            name: meta_description
            widget: text

      - name: hero
        label: "Hero"
        file: src/content/news-page/hero.json
        icon: featured_video
        fields:
          - label: Eyebrow
            name: eyebrow
            widget: string
          - label: Page Title
            name: title
            widget: string
          - label: Intro
            name: intro
            widget: text
          - label: Events Heading
            name: events_title
            widget: string
            default: Our Events
          - label: Empty Message
            name: empty_message
            widget: text
            hint: Shown when the selected category has no items yet.

singletons:
  - name: news-categories
    label: News categories
    file: src/content/news-categories.json
    icon: label
    fields:
      - label: Categories
        name: categories
        widget: list
        label_singular: Category
        summary: '{{fields.name}}'
        fields:
          - label: ID
            name: id
            widget: string
            hint: Stable identifier referenced by news items. Avoid changing it.
          - label: Name
            name: name
            widget: string
          - label: Order
            name: order
            widget: number
            value_type: int
            min: 1
            hint: Position of the filter chip. Lower numbers appear first.
