/*
 * Copyright 2026, Jaime Terrats.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
import { workflow } from '../workflow-generator.js';
export function generateEducationWorkflows(version) {
    return {
        'student-lifecycle-setup.md': workflow(version, 'Student Lifecycle Setup', `
## 1. Gather Requirements

Ask:
- **Student population:** What types of students? (Undergraduate, Graduate, Continuing Education, Online)
- **Recruitment channels:** How are prospective students identified? (Events, web inquiries, purchased lists, referrals)
- **Admissions pipeline:** What stages does an application go through? (Inquiry → Application → Review → Decision → Deposit → Enrolled)
- **Decision criteria:** What information is needed for admissions decisions? (GPA, test scores, essays, recommendations)
- **Enrollment tracking:** What enrollment statuses are needed? (Full-time, Part-time, Leave of Absence, Withdrawn, Graduated)
- **Communication plan:** What automated communications trigger at each stage? (Confirmation emails, reminder sequences, welcome packets)

Check \`force-app/main/default/objects/\` for existing \`Application__c\` and \`hed__Affiliation__c\` field customizations before adding new fields.

## 2. Configure Recruitment

### Inquiry Management
- Map web form submissions to Lead or Contact creation (prefer Contact if student already exists).
- Create an \`hed__Affiliation__c\` record linking the Contact to the target program Account with Status = "Prospect".
- Use Campaigns and CampaignMembers to track recruitment events, open houses, and outreach campaigns.
- Configure Lead conversion to create Contact + Affiliation (do NOT create a Business Account on conversion).

### Event Tracking
- Model recruitment events as Campaigns with Record Type "Recruitment Event".
- Track attendance via CampaignMember Status values (Invited, Registered, Attended, No-Show).
- Automate post-event follow-up Tasks for admissions counselors.

## 3. Configure Admissions Pipeline

### Application Object Setup
1. Review \`Application__c\` fields and Record Types.
2. Define Status picklist values matching the business pipeline (e.g., Draft, Submitted, Under Review, Decision Made, Accepted, Denied, Waitlisted, Withdrawn).
3. Add custom fields for decision criteria: \`GPA__c\`, \`Test_Score__c\`, \`Application_Score__c\`.
4. Create page layouts per application type (Undergraduate, Graduate, Transfer).

### Review Workflow (Record-Triggered Flow)
- **On Submit (After Save, Status = Submitted):**
  - Validate required documents are attached (use Content Document check).
  - Assign to review queue based on program.
  - Send confirmation email to applicant.

- **On Decision (After Save, Status = Accepted/Denied):**
  - Generate decision letter (use email template or document generation).
  - Update \`hed__Affiliation__c\` status based on decision.
  - For Accepted: create enrollment deposit tracking record and set deposit deadline Task.

### Yield Management
- Track Accepted → Enrolled conversion rates by program, term, and cohort.
- Configure reminder flows for deposit deadlines.
- Dashboard: Admissions funnel by program showing conversion at each stage.

## 4. Configure Enrollment Tracking

### Program Enrollment
- Use \`ProgramEnrollment\` to track active degree program enrollments.
- Set Status values: Active, On Leave, Withdrawn, Graduated, Suspended.
- Link to the Program Account (\`Academic_Program\` Record Type).

### Affiliation Updates
- When a student enrolls, update \`hed__Affiliation__c\` Status from "Admitted" to "Current Student".
- When a student graduates, update Status to "Alumni" and Role to "Former Student".

## 5. Deploy Student Lifecycle Configuration

\`\`\`bash
sf project deploy start \\
  --source-dir force-app/main/default/objects/Application__c \\
  --source-dir force-app/main/default/objects/hed__Affiliation__c \\
  --source-dir force-app/main/default/flows \\
  --target-org <alias>
\`\`\`

Verify in the target org:
- Application records transition through all pipeline stages correctly
- Affiliation statuses update automatically on admissions decisions
- Recruitment campaign tracking captures expected engagement data
`),
        'academic-operations-setup.md': workflow(version, 'Academic Operations Setup', `
## 1. Gather Requirements

Ask:
- **Course catalog scope:** How many courses? Are they organized by department, school, or program?
- **Term structure:** Semesters, quarters, trimesters, or custom academic periods? Overlapping terms?
- **Program plans:** How many degree programs need plan requirements defined? Are there shared core requirements?
- **Scheduling constraints:** Room capacity, instructor availability, time block conflicts?
- **Advising model:** Centralized advising office, departmental advisors, or faculty advisors?
- **Degree audit:** Is there an existing SIS handling degree audit, or should Salesforce track progress?

Check \`force-app/main/default/objects/hed__Course__c\` and \`hed__Term__c\` for existing customizations.

## 2. Configure Course Catalog

### Course Object Setup
1. Review \`hed__Course__c\` standard fields: \`hed__Account__c\` (owning department), \`hed__Credit_Hours__c\`, \`hed__Course_ID__c\`.
2. Add custom fields if needed: \`Prerequisites__c\` (text area), \`Delivery_Mode__c\` (picklist: In-Person, Online, Hybrid).
3. Organize courses by Department Account — set \`hed__Account__c\` to the \`University_Department\` Account.
4. Create Course records for the catalog — each represents a template (e.g., "CS 101 - Intro to Computer Science").

### Course Offering Setup
1. \`hed__Course_Offering__c\` represents a specific section of a course in a term.
2. Key fields: \`hed__Course__c\` (parent course), \`hed__Term__c\` (academic term), \`hed__Facility__c\` (room), \`hed__Faculty__c\` (instructor Contact).
3. Set \`hed__Capacity__c\` for enrollment limits per section.
4. Create multiple offerings per course when multiple sections exist in the same term.

## 3. Configure Term Structure

### Term Setup
1. Create \`hed__Term__c\` records for each academic period.
2. Set \`hed__Start_Date__c\` and \`hed__End_Date__c\` for the term boundaries.
3. Link Terms to the institutional Account via \`hed__Account__c\`.
4. Add custom fields if needed: \`Registration_Open_Date__c\`, \`Registration_Close_Date__c\`, \`Add_Drop_Deadline__c\`.

### Term Hierarchy
- Academic Year (parent Term) → Fall Semester / Spring Semester / Summer Term (child Terms).
- Use \`hed__Parent_Term__c\` lookup for the hierarchy.

## 4. Configure Program Plans

### Program Plan Setup
1. Create \`hed__Program_Plan__c\` records for each degree program (e.g., "BS Computer Science", "BA English").
2. Link to the Academic Program Account via \`hed__Account__c\`.
3. Set \`hed__Total_Required_Credits__c\` for the total credits needed.

### Plan Requirements
1. Create \`hed__Plan_Requirement__c\` records as children of the Program Plan.
2. Structure as a hierarchy: Category (e.g., "Core Requirements") → Specific Requirements (e.g., "Complete CS 101").
3. Key fields: \`hed__Credits__c\`, \`hed__Course__c\` (specific course if applicable), \`hed__Category__c\`.
4. Use \`hed__Sequence__c\` to define the recommended order.

### Degree Audit Logic
- Compare student's completed \`hed__Course_Enrollment__c\` records (Status = Completed, Grade = passing) against \`hed__Plan_Requirement__c\` records.
- Build a custom Apex service or Flow to calculate progress percentage.
- Surface progress on the student record via a custom component or formula field.

## 5. Configure Advising

### Advisor Assignment
- Use Account Team on the student's primary Affiliation Account to assign advisors.
- Or create a custom \`Advisor_Assignment__c\` junction object if complex assignment rules are needed (by program, by cohort, by load balancing).

### Success Plans
- Track academic milestones: orientation complete, midterm check-in, pre-registration advising, graduation application.
- Use Tasks or a custom milestone object linked to the student Contact.
- Configure alert flows: if GPA drops below threshold, create a Task for the assigned advisor.

### Appointment Scheduling
- Integrate with Salesforce Scheduler or external calendar tools.
- Track advising sessions as Events linked to the student Contact and advisor User.

## 6. Deploy Academic Operations Configuration

\`\`\`bash
sf project deploy start \\
  --source-dir force-app/main/default/objects/hed__Course__c \\
  --source-dir force-app/main/default/objects/hed__Course_Offering__c \\
  --source-dir force-app/main/default/objects/hed__Term__c \\
  --source-dir force-app/main/default/objects/hed__Program_Plan__c \\
  --source-dir force-app/main/default/objects/hed__Plan_Requirement__c \\
  --target-org <alias>
\`\`\`

Verify in the target org:
- Course Offerings display correct Term and Facility associations
- Program Plan hierarchy renders correctly (Plan → Requirements → Sub-requirements)
- Term dates and registration windows are configured accurately
- Advisor assignments are visible on student records
`),
    };
}
//# sourceMappingURL=education.js.map