Spaces:
Sleeping

File size: 22,962 Bytes
0b355ec
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
const axios = require('axios');
const logger = require('../utils/logger');
const { redisUtils } = require('../utils/redis');

class UGAService {
  constructor() {
    this.baseUrls = {
      elc: process.env.ELC_API_URL || 'https://elc.uga.edu/api',
      athena: process.env.ATHENA_API_URL || 'https://athena.uga.edu/api',
      myid: process.env.MYID_API_URL || 'https://myid.uga.edu/api',
      directory: process.env.UGA_DIRECTORY_API || 'https://directory.uga.edu/api'
    };
    
    this.cacheTimeout = 300; // 5 minutes
  }

  // MyID Authentication Service
  async authenticateWithMyID(credentials) {
    try {
      const response = await axios.post(`${this.baseUrls.myid}/authenticate`, {
        username: credentials.username,
        password: credentials.password
      }, {
        headers: {
          'Content-Type': 'application/json',
          'User-Agent': 'UGA-Chatbot/1.0'
        },
        timeout: 10000
      });

      if (response.data.success) {
        // Cache user session
        await redisUtils.setex(
          `auth:${credentials.username}`,
          3600, // 1 hour
          response.data.user
        );

        return {
          success: true,
          user: response.data.user,
          token: response.data.token
        };
      }

      return { success: false, error: 'Invalid credentials' };

    } catch (error) {
      logger.error('MyID authentication error:', error.message);
      return {
        success: false,
        error: 'Authentication service unavailable'
      };
    }
  }

  // eLC Integration
  async getElcCourses(userId, token) {
    try {
      const cacheKey = `elc:courses:${userId}`;
      
      // Check cache first
      const cached = await redisUtils.get(cacheKey);
      if (cached) {
        return { success: true, data: cached };
      }

      const response = await axios.get(`${this.baseUrls.elc}/courses`, {
        headers: {
          'Authorization': `Bearer ${token}`,
          'Content-Type': 'application/json'
        },
        timeout: 15000
      });

      const courses = response.data;
      
      // Cache for 5 minutes
      await redisUtils.setex(cacheKey, this.cacheTimeout, courses);

      return { success: true, data: courses };

    } catch (error) {
      logger.error('eLC courses fetch error:', error.message);
      return {
        success: false,
        error: 'Unable to fetch course information',
        fallback: this.getElcFallbackInfo()
      };
    }
  }

  async getElcAssignments(userId, courseId, token) {
    try {
      const cacheKey = `elc:assignments:${userId}:${courseId}`;
      
      const cached = await redisUtils.get(cacheKey);
      if (cached) {
        return { success: true, data: cached };
      }

      const response = await axios.get(`${this.baseUrls.elc}/courses/${courseId}/assignments`, {
        headers: {
          'Authorization': `Bearer ${token}`,
          'Content-Type': 'application/json'
        },
        timeout: 15000
      });

      const assignments = response.data;
      
      // Cache for 2 minutes (more frequent updates for assignments)
      await redisUtils.setex(cacheKey, 120, assignments);

      return { success: true, data: assignments };

    } catch (error) {
      logger.error('eLC assignments fetch error:', error.message);
      return {
        success: false,
        error: 'Unable to fetch assignment information'
      };
    }
  }

  // Athena Integration
  async getAthenaStudentInfo(userId, token) {
    try {
      const cacheKey = `athena:student:${userId}`;
      
      const cached = await redisUtils.get(cacheKey);
      if (cached) {
        return { success: true, data: cached };
      }

      const response = await axios.get(`${this.baseUrls.athena}/student/${userId}`, {
        headers: {
          'Authorization': `Bearer ${token}`,
          'Content-Type': 'application/json'
        },
        timeout: 15000
      });

      const studentInfo = {
        ...response.data,
        // Remove sensitive information
        ssn: undefined,
        financialDetails: undefined
      };
      
      // Cache for 10 minutes
      await redisUtils.setex(cacheKey, 600, studentInfo);

      return { success: true, data: studentInfo };

    } catch (error) {
      logger.error('Athena student info fetch error:', error.message);
      return {
        success: false,
        error: 'Unable to fetch student information',
        fallback: this.getAthenaFallbackInfo()
      };
    }
  }

  async getAthenaGrades(userId, semester, token) {
    try {
      const cacheKey = `athena:grades:${userId}:${semester}`;
      
      const cached = await redisUtils.get(cacheKey);
      if (cached) {
        return { success: true, data: cached };
      }

      const response = await axios.get(`${this.baseUrls.athena}/grades/${userId}`, {
        params: { semester },
        headers: {
          'Authorization': `Bearer ${token}`,
          'Content-Type': 'application/json'
        },
        timeout: 15000
      });

      const grades = response.data;
      
      // Cache for 5 minutes
      await redisUtils.setex(cacheKey, this.cacheTimeout, grades);

      return { success: true, data: grades };

    } catch (error) {
      logger.error('Athena grades fetch error:', error.message);
      return {
        success: false,
        error: 'Unable to fetch grade information'
      };
    }
  }

  // Campus Services
  async getCampusServices() {
    try {
      const cacheKey = 'campus:services';
      
      const cached = await redisUtils.get(cacheKey);
      if (cached) {
        return { success: true, data: cached };
      }

      // Static campus services data (would normally come from UGA API)
      const services = {
        dining: {
          locations: [
            { name: 'The Niche', hours: '7:00 AM - 11:00 PM', location: 'Memorial Hall' },
            { name: 'ECV Dining Commons', hours: '7:00 AM - 10:00 PM', location: 'East Campus Village' },
            { name: 'O-House', hours: '7:00 AM - 12:00 AM', location: 'Oglethorpe House' },
            { name: 'Village Summit', hours: '7:00 AM - 10:00 PM', location: 'Village Summit' }
          ]
        },
        transportation: {
          busRoutes: [
            { name: 'Campus Transit', description: 'Main campus loop' },
            { name: 'Athens Transit', description: 'City-wide service' },
            { name: 'UGA Parking', description: 'Parking deck information' }
          ]
        },
        libraries: [
          { name: 'Miller Learning Center', hours: '24/7 during semester', services: ['Study spaces', 'Computer labs', 'Printing'] },
          { name: 'Main Library', hours: 'M-F: 7:30 AM - 2:00 AM', services: ['Research assistance', 'Archives', 'Special collections'] },
          { name: 'Science Library', hours: 'M-F: 7:30 AM - 12:00 AM', services: ['STEM resources', 'Group study rooms'] }
        ],
        recreation: {
          ramsey: {
            name: 'Ramsey Student Center',
            hours: 'M-F: 5:30 AM - 12:00 AM',
            facilities: ['Fitness equipment', 'Swimming pool', 'Basketball courts', 'Rock climbing wall']
          }
        }
      };

      // Cache for 30 minutes
      await redisUtils.setex(cacheKey, 1800, services);

      return { success: true, data: services };

    } catch (error) {
      logger.error('Campus services fetch error:', error.message);
      return {
        success: false,
        error: 'Unable to fetch campus services information'
      };
    }
  }

  // IT Support Information
  async getITSupport() {
    try {
      const cacheKey = 'it:support';
      
      const cached = await redisUtils.get(cacheKey);
      if (cached) {
        return { success: true, data: cached };
      }

      const support = {
        eits: {
          phone: '706-542-3106',
          email: 'helpdesk@uga.edu',
          hours: 'M-F: 8:00 AM - 5:00 PM',
          location: 'Boyd GSRC, Room 420',
          services: [
            'MyID account issues',
            'eLC technical support',
            'Athena access problems',
            'Email setup',
            'WiFi connectivity',
            'Software installation'
          ]
        },
        commonIssues: {
          'MyID Password Reset': 'Visit https://myid.uga.edu or call EITS',
          'ArchPass Setup': 'Download Duo Mobile app and follow setup instructions',
          'eLC Access Issues': 'Clear browser cache or try different browser',
          'Athena Off-Campus': 'Use VPN or contact EITS for alternative access',
          'WiFi Problems': 'Forget and reconnect to UGA-WiFi network'
        }
      };

      // Cache for 1 hour
      await redisUtils.setex(cacheKey, 3600, support);

      return { success: true, data: support };

    } catch (error) {
      logger.error('IT support fetch error:', error.message);
      return {
        success: false,
        error: 'Unable to fetch IT support information'
      };
    }
  }

  // Academic Calendar
  async getAcademicCalendar(year) {
    try {
      const cacheKey = `calendar:${year}`;
      
      const cached = await redisUtils.get(cacheKey);
      if (cached) {
        return { success: true, data: cached };
      }

      // Academic calendar data (would normally come from UGA API)
      const calendar = {
        fall2024: {
          registration: 'March 25 - August 23, 2024',
          classes: 'August 19 - December 6, 2024',
          finals: 'December 9 - 16, 2024',
          breaks: ['November 25-29 (Thanksgiving)']
        },
        spring2025: {
          registration: 'October 21, 2024 - January 10, 2025',
          classes: 'January 13 - April 25, 2025',
          finals: 'April 28 - May 5, 2025',
          breaks: ['March 10-14 (Spring Break)']
        },
        summer2025: {
          registration: 'February 17 - May 16, 2025',
          classes: 'May 19 - August 1, 2025',
          finals: 'July 28 - August 1, 2025'
        }
      };

      // Cache for 1 day
      await redisUtils.setex(cacheKey, 86400, calendar);

      return { success: true, data: calendar };

    } catch (error) {
      logger.error('Academic calendar fetch error:', error.message);
      return {
        success: false,
        error: 'Unable to fetch academic calendar'
      };
    }
  }

  // Student Registration Services
  async getRegistrationInfo(userId, token) {
    try {
      const cacheKey = `registration:${userId}`;
      
      const cached = await redisUtils.get(cacheKey);
      if (cached) {
        return { success: true, data: cached };
      }

      const registrationInfo = {
        registrationWindow: {
          opens: 'March 25, 2025 at 8:00 AM',
          priority: 'Based on credit hours and classification',
          location: 'Athena Student Information System'
        },
        process: {
          steps: [
            'Log into Athena with your MyID',
            'Navigate to Student Services',
            'Select Course Registration',
            'Search for courses by subject, course number, or keyword',
            'Add courses to your shopping cart',
            'Review schedule for time conflicts',
            'Complete registration'
          ]
        },
        tips: [
          'Plan multiple schedules in case courses are full',
          'Use the waitlist feature for closed courses',
          'Check prerequisites before registering',
          'Meet with your academic advisor',
          'Register as soon as your window opens'
        ],
        importantDates: {
          advising: 'March 1-20, 2025',
          registration: 'March 25 - August 23, 2025',
          addDrop: 'First week of classes',
          withdrawalDeadline: 'Mid-semester'
        }
      };

      // Cache for 30 minutes
      await redisUtils.setex(cacheKey, 1800, registrationInfo);

      return { success: true, data: registrationInfo };

    } catch (error) {
      logger.error('Registration info fetch error:', error.message);
      return {
        success: false,
        error: 'Unable to fetch registration information'
      };
    }
  }

  // Financial Aid Services
  async getFinancialAidInfo(userId, token) {
    try {
      const cacheKey = `financial-aid:${userId}`;
      
      const cached = await redisUtils.get(cacheKey);
      if (cached) {
        return { success: true, data: cached };
      }

      const financialAid = {
        office: {
          location: 'Terrell Hall, Room 220',
          phone: '706-542-6147',
          email: 'osfa@uga.edu',
          hours: 'M-F: 8:00 AM - 5:00 PM'
        },
        applications: {
          fafsa: {
            name: 'Free Application for Federal Student Aid (FAFSA)',
            deadline: 'March 1 (priority deadline)',
            website: 'https://studentaid.gov/h/apply-for-aid/fafsa',
            schoolCode: '001598'
          },
          ugaScholarships: {
            name: 'UGA Scholarship Application',
            deadline: 'January 1',
            website: 'https://scholarships.uga.edu'
          }
        },
        aidTypes: [
          {
            type: 'Federal Pell Grant',
            description: 'Need-based grant that does not need to be repaid',
            maxAmount: '$7,395 per year'
          },
          {
            type: 'HOPE Scholarship',
            description: 'Merit-based scholarship for Georgia residents',
            requirements: '3.0 GPA and Georgia residency'
          },
          {
            type: 'Zell Miller Scholarship',
            description: 'Full tuition scholarship for top Georgia students',
            requirements: '3.7 GPA and 1200+ SAT or 26+ ACT'
          },
          {
            type: 'Federal Work-Study',
            description: 'Part-time employment program for students',
            details: 'On-campus and community service positions'
          }
        ],
        deadlines: {
          fafsa: 'March 1 (priority)',
          verification: '30 days after notification',
          acceptanceResponse: 'May 1 for fall semester'
        }
      };

      // Cache for 4 hours
      await redisUtils.setex(cacheKey, 14400, financialAid);

      return { success: true, data: financialAid };

    } catch (error) {
      logger.error('Financial aid info fetch error:', error.message);
      return {
        success: false,
        error: 'Unable to fetch financial aid information'
      };
    }
  }

  // Housing Services
  async getHousingInfo(userId, token) {
    try {
      const cacheKey = `housing:${userId}`;
      
      const cached = await redisUtils.get(cacheKey);
      if (cached) {
        return { success: true, data: cached };
      }

      const housing = {
        office: {
          name: 'University Housing',
          location: 'Buford Drive',
          phone: '706-542-1421',
          email: 'housing@uga.edu',
          website: 'https://housing.uga.edu'
        },
        application: {
          deadline: 'May 1 for fall semester',
          deposit: '$300 (refundable)',
          portal: 'MyHousing portal',
          process: [
            'Submit housing application online',
            'Pay housing deposit',
            'Complete roommate matching (optional)',
            'Receive housing assignment',
            'Complete check-in process'
          ]
        },
        dormitories: [
          {
            name: 'East Campus Village',
            type: 'Suite-style',
            occupancy: '2-4 students per suite',
            amenities: ['Dining hall', 'Fitness center', 'Study lounges']
          },
          {
            name: 'Oglethorpe House',
            type: 'Traditional',
            occupancy: '2 students per room',
            amenities: ['Community bathrooms', 'Study areas', 'Laundry']
          },
          {
            name: 'Village Summit',
            type: 'Apartment-style',
            occupancy: '4 students per apartment',
            amenities: ['Private bathrooms', 'Kitchen', 'Living area']
          },
          {
            name: 'Memorial Hall',
            type: 'Traditional',
            occupancy: '2-3 students per room',
            amenities: ['Historic building', 'Central campus location']
          }
        ],
        costs: {
          traditional: '$5,800 - $6,800 per year',
          suite: '$7,200 - $8,200 per year',
          apartment: '$8,500 - $9,500 per year'
        }
      };

      // Cache for 2 hours
      await redisUtils.setex(cacheKey, 7200, housing);

      return { success: true, data: housing };

    } catch (error) {
      logger.error('Housing info fetch error:', error.message);
      return {
        success: false,
        error: 'Unable to fetch housing information'
      };
    }
  }

  // Meal Plan Services
  async getMealPlanInfo(userId, token) {
    try {
      const cacheKey = `meal-plans:${userId}`;
      
      const cached = await redisUtils.get(cacheKey);
      if (cached) {
        return { success: true, data: cached };
      }

      const mealPlans = {
        office: {
          name: 'UGA Dining Services',
          phone: '706-542-1381',
          email: 'dining@uga.edu',
          website: 'https://dining.uga.edu'
        },
        plans: [
          {
            name: 'Bulldog Plan',
            cost: '$2,890 per semester',
            meals: 'Unlimited dining hall visits',
            flex: '$100 Bulldog Bucks',
            bestFor: 'Students who eat 3+ meals daily on campus'
          },
          {
            name: 'Dawg Plan',
            cost: '$2,590 per semester',
            meals: '200 meals per semester',
            flex: '$200 Bulldog Bucks',
            bestFor: 'Students with moderate dining needs'
          },
          {
            name: 'Pup Plan',
            cost: '$2,290 per semester',
            meals: '150 meals per semester',
            flex: '$300 Bulldog Bucks',
            bestFor: 'Students who eat off-campus frequently'
          },
          {
            name: 'Commuter Plan',
            cost: '$1,200 per semester',
            meals: '50 meals per semester',
            flex: '$400 Bulldog Bucks',
            bestFor: 'Commuter students and off-campus residents'
          }
        ],
        locations: [
          {
            name: 'The Niche',
            type: 'All-you-can-eat dining',
            location: 'Memorial Hall',
            hours: '7:00 AM - 11:00 PM'
          },
          {
            name: 'ECV Dining Commons',
            type: 'All-you-can-eat dining',
            location: 'East Campus Village',
            hours: '7:00 AM - 10:00 PM'
          },
          {
            name: 'Village Summit Food Court',
            type: 'Retail dining',
            location: 'Village Summit',
            hours: '7:00 AM - 12:00 AM'
          },
          {
            name: 'Bulldog Cafe',
            type: 'Coffee and light meals',
            location: 'Miller Learning Center',
            hours: '7:00 AM - 10:00 PM'
          }
        ],
        bullDogBucks: {
          description: 'Flexible spending account for dining',
          locations: 'Dining halls, cafes, vending machines',
          rollover: 'Up to $100 per semester',
          refundable: 'At graduation or withdrawal'
        }
      };

      // Cache for 2 hours
      await redisUtils.setex(cacheKey, 7200, mealPlans);

      return { success: true, data: mealPlans };

    } catch (error) {
      logger.error('Meal plan info fetch error:', error.message);
      return {
        success: false,
        error: 'Unable to fetch meal plan information'
      };
    }
  }

  // Student Accounts and Billing
  async getBillingInfo(userId, token) {
    try {
      const cacheKey = `billing:${userId}`;
      
      const cached = await redisUtils.get(cacheKey);
      if (cached) {
        return { success: true, data: cached };
      }

      const billing = {
        office: {
          name: 'Student Accounts',
          location: 'Lustrat House',
          phone: '706-542-3142',
          email: 'bursar@uga.edu',
          hours: 'M-F: 8:00 AM - 5:00 PM'
        },
        paymentMethods: [
          'Online via ArchPass portal',
          'Phone: 1-800-407-3864',
          'Mail: Check or money order',
          'In-person: Cash, check, or money order'
        ],
        paymentPlans: {
          semesterPlan: {
            description: 'Pay in full by due date',
            discount: 'No additional fees'
          },
          monthlyPlan: {
            description: 'Spread payments over 4-5 months',
            fee: '$25 enrollment fee per semester'
          }
        },
        importantDates: {
          fall2024: {
            billAvailable: 'July 1, 2024',
            paymentDue: 'August 15, 2024'
          },
          spring2025: {
            billAvailable: 'December 1, 2024',
            paymentDue: 'January 10, 2025'
          }
        },
        tuitionFees: {
          inState: {
            undergraduate: '$11,180 per year',
            graduate: '$11,180 per year'
          },
          outOfState: {
            undergraduate: '$29,844 per year',
            graduate: '$29,844 per year'
          },
          additionalFees: '$2,556 per year'
        }
      };

      // Cache for 4 hours
      await redisUtils.setex(cacheKey, 14400, billing);

      return { success: true, data: billing };

    } catch (error) {
      logger.error('Billing info fetch error:', error.message);
      return {
        success: false,
        error: 'Unable to fetch billing information'
      };
    }
  }

  // Fallback information when APIs are unavailable
  getElcFallbackInfo() {
    return {
      message: 'eLC system is currently unavailable. Here are some helpful tips:',
      tips: [
        'Access eLC at https://elc.uga.edu',
        'Use your MyID credentials to log in',
        'Check your course announcements and assignments',
        'Submit assignments before deadlines',
        'Contact your instructor for course-specific questions'
      ]
    };
  }

  getAthenaFallbackInfo() {
    return {
      message: 'Athena system is currently unavailable. Here are alternative resources:',
      resources: [
        'Visit Athena at https://athena.uga.edu',
        'Check registration dates on the academic calendar',
        'Contact your advisor for academic planning',
        'Visit the Registrar\'s Office for transcript requests',
        'Call EITS at 706-542-3106 for technical issues'
      ]
    };
  }

  // Utility method to check system status
  async getSystemStatus() {
    const systems = ['elc', 'athena', 'myid'];
    const status = {};

    for (const system of systems) {
      try {
        await axios.get(`${this.baseUrls[system]}/health`, { timeout: 5000 });
        status[system] = 'operational';
      } catch (error) {
        status[system] = 'unavailable';
      }
    }

    return status;
  }
}

module.exports = new UGAService();