File size: 4,739 Bytes
3929396
 
 
 
1b0e2d2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3929396
 
 
1b0e2d2
 
d644c25
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1b0e2d2
 
 
d644c25
 
1b0e2d2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3929396
 
 
1b0e2d2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3929396
 
 
1b0e2d2
 
3929396
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import type { FitCategory } from "./candidate-fit";

export type { FitCategory };

export type CourseLevel =
  | "Diploma"
  | "Certificate"
  | "Associate"
  | "Undergraduate"
  | "Postgraduate"
  | "Masters"
  | "Doctorate"
  | "Postdoctoral";

export type CourseType =
  | "Engineering"
  | "Medicine"
  | "Bachelor's"
  | "Master's"
  | "Masters Integrated"
  | "PhD"
  | "Business"
  | "Law"
  | "Arts & Humanities"
  | "Science"
  | "Technology"
  | "Other";

export type CandidateType = "in-state" | "out-of-state" | "out-of-country";

export interface SearchCriteria {
  courseLevel: CourseLevel | "";
  courseType: CourseType | "";
  specialization: string;
  countries: string[];
  candidateType: CandidateType | "";
  lastQualification: string;
  lastSchool: string;
  curriculum: string;
  subjects: string;
  grades: string;
  budgetMax: string;
  additionalNotes: string;
}

/**
 * Wire format accepted by the search API: the same shape as `SearchCriteria`,
 * but with the form's literal unions widened to plain strings so request
 * validation does not have to re-declare them.
 */
export type SearchCriteriaInput = Omit<
  SearchCriteria,
  "courseLevel" | "courseType" | "candidateType"
> & {
  courseLevel: string;
  courseType: string;
  candidateType: string;
};

export interface UniversityCourseResult {
  id: string;
  universityName: string;
  universityLocation: string;
  courseName: string;
  courseLevel: string;
  courseType: string;
  specialization: string;
  country: string;
  qsWorldRanking: number | null;
  tuitionFee: string;
  admissionRequirements: string;
  courseUrl: string;
  duration: string;
  language: string;
  intakePeriod: string;
  scholarshipInfo: string;
  /** How this course fits the candidate profile used for the search. */
  fit?: FitCategory;
  fitReason?: string;
}

export interface CourseSearchOutcome {
  results: UniversityCourseResult[];
  warning?: string;
}

export type ImportantDateCategory =
  | "application_open"
  | "application_deadline"
  | "entrance_exam"
  | "scholarship"
  | "offer_or_result"
  | "fee_payment"
  | "session_start"
  | "orientation"
  | "other";

export interface ImportantDate {
  label: string;
  category: ImportantDateCategory;
  /** ISO calendar date (YYYY-MM-DD) when it could be resolved, else null. */
  date: string | null;
  /** The date exactly as the university wrote it, e.g. "15 June 2026". */
  dateText: string;
  details: string;
  sourceUrl: string;
}

export interface ImportantDatesReport {
  dates: ImportantDate[];
  sources: Array<{ title: string; url: string }>;
  /** Registrable host the search was restricted to, e.g. "bits-pilani.ac.in". */
  host: string | null;
  checkedAt: string;
  summary: string;
  method: "model" | "heuristic";
}

export interface ShortlistedCourse {
  id: string;
  user_id: string;
  important_dates: ImportantDatesReport | null;
  important_dates_checked_at: string | null;
  university_name: string;
  university_location: string | null;
  course_name: string;
  course_level: string | null;
  course_type: string | null;
  specialization: string | null;
  country: string | null;
  qs_world_ranking: number | null;
  tuition_fee: string | null;
  admission_requirements: string | null;
  course_url: string | null;
  duration: string | null;
  language: string | null;
  intake_period: string | null;
  scholarship_info: string | null;
  notes: string | null;
  fit: FitCategory | null;
  fit_reason: string | null;
  fit_source: "auto" | "manual" | null;
  is_manual: boolean;
  created_at: string;
  updated_at: string;
}

export interface ShortlistInsert {
  university_name: string;
  university_location?: string;
  course_name: string;
  course_level?: string;
  course_type?: string;
  specialization?: string;
  country?: string;
  qs_world_ranking?: number | null;
  tuition_fee?: string;
  admission_requirements?: string;
  course_url?: string;
  duration?: string;
  language?: string;
  intake_period?: string;
  scholarship_info?: string;
  notes?: string;
  fit?: FitCategory | null;
  fit_reason?: string;
  fit_source?: "auto" | "manual";
  is_manual?: boolean;
}

export interface ShortlistShare {
  id: string;
  owner_id: string;
  owner_email: string;
  invite_email: string;
  permission: "read" | "comment" | "edit" | "delete";
  created_at: string;
}

export interface ShortlistComment {
  id: string;
  course_id: string;
  author_id: string;
  author_email: string;
  body: string;
  created_at: string;
}

export interface ApplicationDocument {
  id: string;
  course_id: string;
  label: string;
  details: string | null;
  required: boolean;
  storage_path: string | null;
  file_name: string | null;
  uploaded_at: string | null;
  created_at: string;
}