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

collections:
  - name: courses
    label: Courses
    label_singular: Course
    description: Programmes listed on the All Courses page.
    folder: src/content/courses
    extension: json
    format: json
    identifier_field: title
    slug: '{{code}}'
    summary: '{{code}} — {{title}}'
    sortable_fields:
      fields:
        - order
        - code
        - title
      default:
        field: order
        direction: ascending
    fields:
      - label: Course Code
        name: code
        widget: string
        hint: Stable course identifier, e.g. MEC or CEC. Used for new filenames.

      - label: Display Code
        name: display_code
        widget: string
        required: false
        hint: Optional label for cards, navigation and enquiry forms, e.g. MEC / CEC. Leave empty to use the course code.

      - label: Course Title
        name: title
        widget: string
        hint: Full programme name, e.g. Mathematics, Economics & Commerce.

      - label: Tagline
        name: tagline
        widget: text
        hint: One or two sentences summarising the programme.

      - label: Display Order
        name: order
        widget: number
        value_type: int
        min: 1
        hint: Position on the All Courses page. Lower numbers appear first.

      - label: Duration
        name: duration
        widget: string
        required: false
        hint: e.g. Integrated with 2 years of Intermediate.

      - label: Eligibility
        name: eligibility
        widget: text
        required: false
        hint: Who the programme is open to.

      - label: Board
        name: board
        widget: string
        required: false
        hint: e.g. Board of Intermediate Education, Andhra Pradesh.

      - label: Programme Overview
        name: overview
        widget: text
        hint: The longer description shown on the course detail page.

      - label: Programme Highlights
        name: highlights
        widget: list
        label_singular: Highlight
        field:
          label: Highlight
          name: highlight
          widget: string

      - label: Detail Sections
        name: sections
        widget: list
        required: false
        label_singular: Section
        summary: "{{fields.heading}}"
        hint: Main headings with optional subsections for examination patterns and course stages.
        fields:
          - label: Heading
            name: heading
            widget: string
          - &course-paragraphs
            label: Paragraphs
            name: paragraphs
            widget: list
            required: false
            field:
              label: Paragraph
              name: paragraph
              widget: text
          - &course-items
            label: Bullet points
            name: items
            widget: list
            required: false
            summary: "{{fields.text}}"
            fields:
              - label: Point
                name: text
                widget: text
              - label: Indented points
                name: children
                widget: list
                required: false
                field:
                  label: Point
                  name: item
                  widget: text
          - &course-closing-paragraphs
            label: Closing paragraphs
            name: closing_paragraphs
            widget: list
            required: false
            hint: Paragraphs displayed after the bullet points.
            field:
              label: Paragraph
              name: paragraph
              widget: text
          - label: Subsections
            name: subsections
            widget: list
            required: false
            summary: "{{fields.heading}}"
            fields:
              - label: Heading
                name: heading
                widget: string
              - *course-paragraphs
              - *course-items
              - *course-closing-paragraphs

      - label: Career Opportunities
        name: careers
        widget: relation
        multiple: true
        collection: _singletons
        file: careers
        value_field: careers.*.id
        display_fields:
          - careers.*.name
        search_fields:
          - careers.*.name
        hint: Managed under Career outcomes. Add new ones there first.

      - label: Enquiry Phone Numbers
        name: enquiry_phones
        widget: relation
        required: false
        multiple: true
        collection: _singletons
        file: contact-details
        value_field: phone_numbers.*
        display_fields:
          - phone_numbers.*
        search_fields:
          - phone_numbers.*
        hint: Managed under Contact details.

      - label: Enquiry Email Addresses
        name: enquiry_emails
        widget: relation
        required: false
        multiple: true
        collection: _singletons
        file: contact-details
        value_field: emails.*
        display_fields:
          - emails.*
        search_fields:
          - emails.*
        hint: Managed under Contact details.

  - name: courses-page
    label: Courses page
    icon: menu_book
    files:
      - name: seo
        label: "Search & Social"
        file: src/content/courses-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/courses-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
