# ─── Decap CMS Configuration ──────────────────────────────────────────────────
# Docs: https://decapcms.org/docs/configuration-options/
#
# Backend: GitHub OAuth via ECUSTA API.
# ─────────────────────────────────────────────────────────────────────────────

backend:
  name: github
  repo: aaronkebede/ecuweb-gai
  branch: main
  base_url: https://www.ecu.edu.et
  auth_endpoint: api/cms-auth

# ── Media ─────────────────────────────────────────────────────────────────────
media_folder: "public/uploads"
public_folder: "/uploads"

# ── Site URL (used for preview links) ─────────────────────────────────────────
site_url: https://www.ecu.edu.et
display_url: https://www.ecu.edu.et

# ── Slug Options ──────────────────────────────────────────────────────────────
slug:
  encoding: "ascii"
  clean_accents: true

# ══════════════════════════════════════════════════════════════════════════════
# Collections
# ══════════════════════════════════════════════════════════════════════════════
collections:

  # ── 1. Site Configuration ────────────────────────────────────────────────────
  - name: "site_config"
    label: "Site Configuration"
    description: "Global settings that control site-wide behaviour — alert banner, contact details, social links."
    files:

      - name: "global_alert"
        label: "Global Alert Banner"
        file: "content/site-config.json"
        description: "The announcement banner displayed at the top of every page."
        fields:
          - label: "Enable Banner"
            name: "enabled"
            widget: "boolean"
            default: false
            hint: "Toggle the banner on or off globally."

          - label: "Banner Message"
            name: "message"
            widget: "string"
            hint: "Supports basic HTML. Keep it concise."

          - label: "Call-to-Action Text"
            name: "linkText"
            widget: "string"
            required: false

          - label: "Call-to-Action URL"
            name: "linkUrl"
            widget: "string"
            required: false

          - label: "Alert ID"
            name: "id"
            widget: "string"
            hint: "Change this value whenever you update the message to reset dismissals."

          - label: "Background Colour"
            name: "bgColor"
            widget: "select"
            options:
              - { label: "Gold (default)", value: "gold" }
              - { label: "Crimson / Urgent", value: "crimson" }
              - { label: "Navy / Informational", value: "navy" }
              - { label: "Emerald / Success", value: "emerald" }
            default: "gold"

  # ── 2. Editable Pages ───────────────────────────────────────────────────────
  - name: "pages"
    label: "Website Pages"
    description: "Edit main content and text blocks for institutional website pages."
    files:
      - name: "about"
        label: "About & History Page"
        file: "content/pages/about.json"
        fields:
          - { label: "Page Title", name: "title", widget: "string" }
          - { label: "Subtitle", name: "subtitle", widget: "string" }
          - { label: "Motto", name: "motto", widget: "string" }
          - { label: "History & Identity", name: "history", widget: "text" }
          - { label: "Institutional Vision", name: "vision", widget: "text" }
          - { label: "Institutional Mission", name: "mission", widget: "text" }

      - name: "admissions"
        label: "Admissions Page"
        file: "content/pages/admissions.json"
        fields:
          - { label: "Title", name: "title", widget: "string" }
          - { label: "Hero Subtitle", name: "heroText", widget: "string" }
          - { label: "Application Deadline", name: "applicationDeadline", widget: "string" }
          - label: "Requirements"
            name: "requirements"
            widget: "list"
            field: { label: "Requirement", name: "req", widget: "string" }
          - { label: "Admissions Contact Email", name: "contactEmail", widget: "string" }

      - name: "why-ecusta"
        label: "Why ECUSTA Page"
        file: "content/pages/why-ecusta.json"
        fields:
          - { label: "Page Title", name: "title", widget: "string" }
          - { label: "Subtitle", name: "subtitle", widget: "string" }
          - { label: "Hero Text", name: "heroText", widget: "text" }
          - label: "Key Institutional Pillars"
            name: "reasons"
            widget: "list"
            field: { label: "Pillar / Reason", name: "reason", widget: "string" }

      - name: "governance"
        label: "Governance & Leadership Page"
        file: "content/pages/governance.json"
        fields:
          - { label: "Page Title", name: "title", widget: "string" }
          - { label: "Subtitle", name: "subtitle", widget: "string" }
          - { label: "Chancellor", name: "chancellor", widget: "string" }
          - { label: "Board Chair", name: "boardChair", widget: "string" }
          - { label: "Charter Summary", name: "charterSummary", widget: "text" }

      - name: "tuition"
        label: "Tuition & Fees Page"
        file: "content/pages/tuition.json"
        fields:
          - { label: "Page Title", name: "title", widget: "string" }
          - { label: "Subtitle", name: "subtitle", widget: "string" }
          - { label: "Medicine Tuition Fee", name: "medicineFee", widget: "string" }
          - { label: "MLT Tuition Fee", name: "mltFee", widget: "string" }
          - { label: "Social Work Tuition Fee", name: "socialWorkFee", widget: "string" }
          - { label: "Financial Aid Policy", name: "scholarshipPolicy", widget: "text" }

      - name: "contact"
        label: "Contact & Campus Location Page"
        file: "content/pages/contact.json"
        fields:
          - { label: "Page Title", name: "title", widget: "string" }
          - { label: "Campus Name", name: "campusName", widget: "string" }
          - { label: "Physical Address", name: "address", widget: "string" }
          - { label: "Phone Number", name: "phone", widget: "string" }
          - { label: "Email Address", name: "email", widget: "string" }
          - { label: "Office Hours", name: "officeHours", widget: "string" }
          - { label: "Google Maps Embed URL", name: "googleMapEmbed", widget: "string" }

  # ── 3. People & Directory ───────────────────────────────────────────────────
  - name: "people"
    label: "People & Directory"
    description: "Leadership, faculty, and administrative staff profiles."
    folder: "content/people"
    extension: "json"
    format: "json"
    create: true
    slug: "{{name | slugify}}"
    summary: "{{name}} — {{role}}"
    fields:
      - { label: "Full Name", name: "name", widget: "string" }
      - { label: "Role / Title", name: "role", widget: "string" }
      - label: "Category"
        name: "category"
        widget: "select"
        options:
          - Executive
          - Academics
          - Administration
          - Services
          - Governance
        default: "Academics"
      - label: "Department"
        name: "department"
        widget: "select"
        options:
          - Leadership
          - School of Medicine
          - MLT & Research
          - Social Work Department
          - Computer Science
          - Accounting & Finance
          - Human Resources
          - Office of the Registrar
          - Finance Office
          - Project Office
          - Quality Assurance
          - Student Services
          - Governance
        default: "School of Medicine"
      - { label: "Profile Photo URL", name: "image", widget: "string", required: false }
      - { label: "Biography", name: "bio", widget: "text", required: false }
      - { label: "Email Address", name: "email", widget: "string", required: false }
      - { label: "Office Link", name: "officeLink", widget: "string", required: false }

  # ── 4. Official Notices & Announcements ────────────────────────────────────
  - name: "announcements"
    label: "Official Announcements"
    description: "Official notices and announcements from the Registrar, Academic VP, or Administration."
    folder: "content/announcements"
    extension: "json"
    format: "json"
    create: true
    slug: "{{title | slugify}}"
    summary: "{{title}} — {{date}}"
    fields:
      - { label: "Announcement Title", name: "title", widget: "string" }
      - { label: "Publish Date & Time", name: "date", widget: "datetime" }
      - label: "Urgency / Priority"
        name: "priority"
        widget: "select"
        options:
          - { label: "Normal (Informational)", value: "normal" }
          - { label: "Important (Highlighted)", value: "important" }
          - { label: "Urgent (Red Alert)", value: "urgent" }
        default: "normal"
      - label: "Target Audience"
        name: "audience"
        widget: "select"
        options:
          - "All Students & Staff"
          - "Undergraduate Students"
          - "Postgraduate Students"
          - "Faculty & Academic Staff"
          - "Prospective Students"
        default: "All Students & Staff"
      - { label: "Issuer / Department", name: "issuer", widget: "string", default: "Office of the Registrar" }
      - { label: "Summary / Excerpt", name: "summary", widget: "text", hint: "Short summary shown in cards." }
      - { label: "Detailed Content / Body", name: "body", widget: "markdown" }
      - { label: "Document Attachment URL", name: "attachment", widget: "file", required: false }

  # ── 5. Academic Calendar & Events ───────────────────────────────────────────
  - name: "calendar"
    label: "Academic Calendar"
    description: "Manage official academic calendar events, exam schedules, and holiday dates."
    folder: "content/calendar"
    extension: "json"
    format: "json"
    create: true
    slug: "{{summary | slugify}}"
    summary: "{{summary}} — {{start_date}}"
    fields:
      - { label: "Title / Event Name", name: "summary", widget: "string" }
      - { label: "Description", name: "description", widget: "text", required: false }
      - { label: "Location", name: "location", widget: "string", required: false, default: "Main Campus" }
      - { label: "Start Date", name: "start_date", widget: "date", format: "YYYY-MM-DD" }
      - { label: "End Date", name: "end_date", widget: "date", format: "YYYY-MM-DD", required: false }
      - label: "Category"
        name: "category"
        widget: "select"
        options:
          - Academic
          - Exam
          - Registration
          - Holiday
          - Event
        default: "Academic"

  # ── 6. News & Dispatches ────────────────────────────────────────────────────
  - name: "news"
    label: "News & Announcements"
    description: "News posts and institutional articles."
    folder: "content/news"
    create: true
    slug: "{{year}}-{{month}}-{{day}}-{{title | slugify}}"
    summary: "{{title}} — {{date}}"
    fields:
      - { label: "Title", name: "title", widget: "string" }
      - { label: "Publish Date", name: "date", widget: "datetime" }
      - label: "Status"
        name: "status"
        widget: "select"
        options:
          - { label: "Draft", value: "draft" }
          - { label: "Review", value: "review" }
          - { label: "Published", value: "published" }
        default: "draft"
      - { label: "Featured Image", name: "image", widget: "image", required: false }
      - { label: "Summary", name: "summary", widget: "text", hint: "Short excerpt shown in news cards." }
      - { label: "Body", name: "body", widget: "markdown" }
      - label: "Tags / Labels"
        name: "tags"
        widget: "list"
        required: false

  # ── 7. Academic Programs ─────────────────────────────────────────────────────
  - name: "programs"
    label: "Academic Programs"
    description: "Manage program descriptions, highlights, faculty, and gallery images."
    folder: "content/programs"
    extension: "json"
    format: "json"
    create: true
    slug: "{{programId}}"
    summary: "{{title}} ({{degree}})"
    fields:
      - { label: "Program ID", name: "programId", widget: "string", hint: "e.g. medicine, mlt, socialwork" }
      - { label: "Title", name: "title", widget: "string" }
      - { label: "Degree", name: "degree", widget: "string", hint: "e.g. Doctor of Medicine (MD)" }
      - { label: "Duration", name: "duration", widget: "string" }
      - { label: "Faculty / School", name: "faculty", widget: "string" }
      - { label: "Hero Image URL", name: "image", widget: "string" }
      - { label: "Description", name: "description", widget: "text" }
      - label: "Highlights"
        name: "highlights"
        widget: "list"
        field: { label: "Highlight", name: "highlight", widget: "string" }
      - label: "Career Paths"
        name: "careers"
        widget: "list"
        field: { label: "Career", name: "career", widget: "string" }
