# Sveltia CMS configuration — Linstead Primary & Junior High School
# Migrated from TinaCMS. Content format (YAML frontmatter + markdown body) is unchanged.

backend:
  name: github
  repo: grantonique96-art/linstead-primary
  branch: main
  # OAuth via Netlify's built-in provider (register Client ID/Secret per-site in Netlify settings)
  base_url: https://api.netlify.com

# Lets you edit locally with no OAuth: run `npx @sveltia/cms-proxy-server`
# in the project folder, then open http://localhost:4321/admin/index.html
local_backend: true

media_folder: "public/uploads"
public_folder: "/uploads"

collections:
  # ---- Site Settings (singleton) ----
  - name: settings
    label: "Site Settings"
    files:
      - name: site
        label: "Site Settings"
        file: "src/content/settings/site.json"
        fields:
          - { label: "School Name", name: "schoolName", widget: "string" }
          - { label: "Tagline", name: "tagline", widget: "string", required: false }
          - { label: "School Motto", name: "motto", widget: "string", required: false }
          - { label: "Logo (square image)", name: "logo", widget: "image", required: false }
          - { label: "Primary Color (hex)", name: "primaryColor", widget: "string", required: false, hint: "Site accent color, e.g. #1e40af" }
          - { label: "Address", name: "address", widget: "text", required: false }
          - { label: "Phone Number", name: "phone", widget: "string", required: false }
          - { label: "Contact Email", name: "email", widget: "string", required: false }

  # ---- Pages (fixed set: home, about, contact, etc.) ----
  - name: page
    label: "Pages"
    folder: "src/content/pages"
    extension: "md"
    format: "frontmatter"
    create: false
    delete: false
    identifier_field: title
    fields:
      - { label: "Page Title", name: "title", widget: "string" }
      - { label: "Hero Heading", name: "heroHeading", widget: "string", required: false }
      - { label: "Hero Subheading", name: "heroSubheading", widget: "text", required: false }
      - { label: "Hero Background Image", name: "heroImage", widget: "image", required: false }
      - { label: "Page Content", name: "body", widget: "markdown", required: false }

  # ---- News & Announcements ----
  - name: news
    label: "News & Announcements"
    folder: "src/content/news"
    extension: "md"
    format: "frontmatter"
    create: true
    slug: "{{slug}}"
    identifier_field: title
    fields:
      - { label: "Title", name: "title", widget: "string" }
      - { label: "Publish Date", name: "date", widget: "datetime" }
      - { label: "Featured Image", name: "image", widget: "image", required: false }
      - { label: "Summary (1-2 sentences)", name: "summary", widget: "text", required: false }
      - { label: "Article Body", name: "body", widget: "markdown", required: false }

  # ---- Staff ----
  - name: staff
    label: "Staff"
    folder: "src/content/staff"
    extension: "md"
    format: "frontmatter"
    create: true
    slug: "{{fields.name}}"
    identifier_field: name
    fields:
      - { label: "Full Name", name: "name", widget: "string" }
      - { label: "Role / Title", name: "role", widget: "string", required: false }
      - { label: "Photo (portrait)", name: "photo", widget: "image", required: false }
      - { label: "Display Order (lower number shows first)", name: "order", widget: "number", required: false, value_type: "int" }
      - { label: "Biography", name: "bio", widget: "markdown", required: false }

  # ---- Photo Gallery ----
  - name: gallery
    label: "Photo Gallery"
    folder: "src/content/gallery"
    extension: "md"
    format: "frontmatter"
    create: true
    identifier_field: title
    fields:
      - { label: "Photo Title / Caption", name: "title", widget: "string" }
      - { label: "Photo", name: "image", widget: "image" }
      - label: "Category"
        name: "category"
        widget: "select"
        required: false
        options:
          - { label: "Events", value: "events" }
          - { label: "Sports", value: "sports" }
          - { label: "Classrooms", value: "classrooms" }
          - { label: "Field Trips", value: "field-trips" }
          - { label: "Facilities", value: "facilities" }
      - { label: "Date Taken", name: "date", widget: "datetime", required: false }
      - { label: "Display Order (lower number shows first)", name: "order", widget: "number", required: false, value_type: "int" }
      - { label: "Description (optional)", name: "description", widget: "text", required: false }

  # ---- Events ----
  - name: event
    label: "Events"
    folder: "src/content/events"
    extension: "md"
    format: "frontmatter"
    create: true
    identifier_field: title
    fields:
      - { label: "Event Title", name: "title", widget: "string" }
      - { label: "Event Date", name: "date", widget: "datetime" }
      - { label: "Time (e.g. 9:00 AM - 12:00 PM)", name: "time", widget: "string", required: false }
      - { label: "Location (e.g. School Hall)", name: "location", widget: "string", required: false }
      - label: "Category"
        name: "category"
        widget: "select"
        required: false
        options:
          - { label: "Academic", value: "academic" }
          - { label: "Sports", value: "sports" }
          - { label: "Social", value: "social" }
          - { label: "Parent / PTA", value: "parent" }
          - { label: "Holiday", value: "holiday" }
      - { label: "Featured Image (optional)", name: "image", widget: "image", required: false }
      - { label: "Short Summary", name: "summary", widget: "text", required: false }
      - { label: "Full Details", name: "body", widget: "markdown", required: false }

  # ---- Programs ----
  - name: program
    label: "Programs"
    folder: "src/content/programs"
    extension: "md"
    format: "frontmatter"
    create: true
    identifier_field: title
    fields:
      - { label: "Program Name", name: "title", widget: "string" }
      - { label: "Grade Level / Age Range (e.g. Grades 1-3)", name: "gradeLevel", widget: "string", required: false }
      - { label: "Program Image", name: "image", widget: "image", required: false }
      - { label: "Short Summary", name: "summary", widget: "text", required: false }
      - { label: "Schedule (e.g. Mon-Fri, 8 AM - 2 PM)", name: "schedule", widget: "string", required: false }
      - { label: "Fee (optional)", name: "fee", widget: "string", required: false }
      - { label: "Display Order (lower number shows first)", name: "order", widget: "number", required: false, value_type: "int" }
      - { label: "Full Description", name: "body", widget: "markdown", required: false }

  # ---- Downloads & Forms ----
  - name: download
    label: "Downloads & Forms"
    folder: "src/content/downloads"
    extension: "md"
    format: "frontmatter"
    create: true
    identifier_field: title
    fields:
      - { label: "Document Title", name: "title", widget: "string" }
      - { label: "File (PDF, DOCX, etc.)", name: "file", widget: "file", hint: "Upload the file the parent will download. Any file type works." }
      - label: "Category"
        name: "category"
        widget: "select"
        required: false
        options:
          - { label: "Forms", value: "forms" }
          - { label: "Handbooks & Policies", value: "handbooks" }
          - { label: "Calendars", value: "calendars" }
          - { label: "Newsletters", value: "newsletters" }
          - { label: "Reports", value: "reports" }
      - { label: "Description", name: "description", widget: "text", required: false }
      - { label: "Date Added", name: "dateAdded", widget: "datetime", required: false }
      - { label: "Display Order (lower number shows first)", name: "order", widget: "number", required: false, value_type: "int" }
