nazar-salary 3.2.5 → 3.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/index.d.ts +53 -0
  2. package/index.js +14 -0
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -650,6 +650,8 @@ declare module 'nazar-salary' {
650
650
  prepayment: boolean;
651
651
  bonus_languages?: string[];
652
652
  lesson_group_id?: number;
653
+ /** Unix timestamp (ms) — дата записи студента */
654
+ created_at: number;
653
655
  }
654
656
 
655
657
  export interface UpdateStudentData {
@@ -1611,7 +1613,58 @@ declare module 'nazar-salary' {
1611
1613
  createRefund(studentId: number, data: CreateRefundData): Promise<CreateRefundResponse>;
1612
1614
  getRefunds(params?: RefundsListParams): Promise<RefundsListResponse>;
1613
1615
 
1616
+ // Forecast endpoints
1617
+ /**
1618
+ * Get teacher salary forecast for upcoming months (Admin only)
1619
+ * @param monthsAhead Number of months to forecast (1–12). Default: 6
1620
+ */
1621
+ getTeacherExpensesForecast(monthsAhead?: number): Promise<TeacherExpensesForecastResponse>;
1622
+
1614
1623
  // Custom request
1615
1624
  request(method: string, path: string, data?: any): Promise<any>;
1616
1625
  }
1626
+
1627
+ export interface TeacherExpensesForecastResponse {
1628
+ status: string;
1629
+ forecast_metadata: {
1630
+ generated_at: string;
1631
+ current_month: string;
1632
+ forecast_period_months: number;
1633
+ forecast_from: string;
1634
+ forecast_to: string;
1635
+ active_students_count: number;
1636
+ };
1637
+ summary: {
1638
+ total_forecast_amount: number;
1639
+ average_monthly_salary: number;
1640
+ min_month_salary: number;
1641
+ max_month_salary: number;
1642
+ min_month: string | null;
1643
+ max_month: string | null;
1644
+ };
1645
+ monthly_data: Array<{
1646
+ month: string;
1647
+ month_display: string;
1648
+ total_salary: number;
1649
+ forecast_salary: number;
1650
+ real_salary: number | null;
1651
+ students_count: number;
1652
+ students: Array<{
1653
+ student_id: number;
1654
+ student_name: string;
1655
+ teacher_id: number;
1656
+ enrollment_months: number;
1657
+ lessons_per_month: number;
1658
+ rate_per_lesson: number;
1659
+ monthly_salary: number;
1660
+ remaining_months: number;
1661
+ }>;
1662
+ }>;
1663
+ risk_analysis: {
1664
+ trend: 'declining' | 'stable' | 'growing';
1665
+ risk_level: 'low' | 'medium' | 'high';
1666
+ warning_message: string;
1667
+ recommended_action: string;
1668
+ };
1669
+ }
1617
1670
  }
package/index.js CHANGED
@@ -531,6 +531,7 @@ class SalaryAPI {
531
531
  * @param {boolean} data.prepayment - Prepayment flag
532
532
  * @param {string[]} [data.bonus_languages] - Bonus languages array
533
533
  * @param {number} [data.lesson_group_id] - Lesson group ID for duet/trio (optional)
534
+ * @param {number} data.created_at - Unix timestamp (ms) — дата записи студента
534
535
  * @returns {Promise<object>}
535
536
  */
536
537
  async createStudent(data) {
@@ -975,6 +976,19 @@ class SalaryAPI {
975
976
  return await this.client.get('/api/v1/admin/refunds', { params });
976
977
  }
977
978
 
979
+ // ===== FORECAST ENDPOINTS =====
980
+
981
+ /**
982
+ * Get teacher salary forecast for upcoming months (Admin only)
983
+ * @param {number} [monthsAhead=6] - Number of months to forecast (1-12)
984
+ * @returns {Promise<object>}
985
+ */
986
+ async getTeacherExpensesForecast(monthsAhead = 6) {
987
+ return await this.client.get("/api/v1/forecast/teacher-expenses", {
988
+ params: { months_ahead: monthsAhead },
989
+ });
990
+ }
991
+
978
992
  // ===== CUSTOM REQUEST =====
979
993
 
980
994
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nazar-salary",
3
- "version": "3.2.5",
3
+ "version": "3.2.7",
4
4
  "description": "Frontend library for Nazar Salary API",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",