import { MultiLanguageString, Timestamp, Gender, } from './common'; import {SchoolId} from './school'; import {ClientId} from './client'; import {ClassId} from './class'; import {FamilyId} from './family'; import {UserId} from './user'; import {Image, ImageV2} from './fileManager'; import {Record as AttendanceRecord} from './attendance'; export type StudentId = string; export type StudentType = "baby" | "toddler" | "kindy" | "elementary" | "jhs" | "hs" | "college" | "uni" | "adult" | "other"; export type StudentGrade = "none" | "g1" | "g2" | "g3" | "g4" | "g5" | "g6" | "g7" | "g8" | "g9" | "g10" | "g11" | "g12" | "g13" | "g14" | "g15" | "g16"; export type EducationType = "none" | "hoikuen" | "youchien" | "preschool" | "elementary" | "jhs" | "hs" | "college" | "uni" | "adult"| "other"; export type HealthCategory = "hw" | "temp"; export type HealthType = "height" | "weight" | "temperature"; export type HealthBloodType = "none" | "O+" | "O-" | "A+" | "A-" | "B+" | "B-" | "AB+" | "AB-"; /** * DB: /schoolData/{sid}/students/{studentId} */ export interface Student { fid?: FamilyId; isUser: boolean; name: MultiLanguageString | string; photoUrl?: string; uid: StudentId | UserId; status: string; // ? attendance / reset by cf end of day //ToDo } /** * dbRef: studentData/{studentId} */ export interface StudentData { cid: ClientId; id: StudentId; fid: FamilyId; attendance: { [date: Timestamp]: { [id: string]: AttendanceRecord; }; }; health: { [Key in HealthCategory]: { [date: Timestamp]: object; // TODO }; }; homework: { [date: Timestamp]: { [id: string]: object; // TODO }; }; medical: StudentMedicalV2; // ToDo profile: StudentProfile; } /** * dbRef: studentData/{studentId}/profile */ export interface StudentProfile { id: string; avatar: Image; name: MultiLanguageString | string; fName: MultiLanguageString | string; lName: MultiLanguageString | string; gender: Gender; birthday: Timestamp; educationType: EducationType; grade: StudentGrade; joinedAt: Timestamp; email: string; phoneMobile: string; isUser: boolean; } /** * @deprecated */ export enum StudentTypeV2 { BABY = "studentType.baby", TODDLER = "studentType.toddler", KINDY = "studentType.kindy", ELEMENTARY = "studentType.elementary", JHS = "studentType.jhs", HS = "studentType.hs", COLLEGE = "studentType.college", UNI = "studentType.uni", ADULT = "studentType.adult", OTHER = "studentType.other", } /** * dbRef: student/{studentId} * @deprecated */ export interface StudentV2 { cid: ClientId; id: StudentId; medical: StudentMedicalV2; metadata: StudentMetadataV2; profile: StudentProfileV2; } /** * dbRef: student/{studentId}/medical * @deprecated */ export interface StudentMedicalV2 { allergies: { [key: string]: boolean; }; bloodType: HealthBloodType; insuranceCardBackUrl: string; insuranceCardFrontUrl: string; insuranceCardNumber: string; medicalDoctorName: string; medicalHospitalName: string; medicalHospitalPhone: string; proneTo: { [key: string]: boolean; }; } /** * dbRef: student/{studentId}/metadata * @deprecated */ export interface StudentMetadataV2 { active: boolean; cid: ClientId; classes: { [classId: ClassId]: boolean; }; createdAt: Timestamp; createdBy: UserId; fid: FamilyId; // V3 family: FamilyId; guardians: { [userId: UserId]: boolean; }; id: StudentId; inviteCodes: { guardian: { code: string; expiresAt: Timestamp; qrCode: string; school: SchoolId; usedCount: number; userType: "guardian"; }; }; isUser: boolean; school: SchoolId; studentType: StudentType; } /** * dbRef: student/{studentId}/profile * @deprecated */ export interface StudentProfileV2 { avatar: ImageV2; // V2 firstNameFurigana: string; // V2 firstNameKanji: string; // V2 firstNameRomaji: string; // V2 lastNameFurigana: string; // V2 lastNameKanji: string; // V2 lastNameRomaji: string; // V2 nameFurigana: string; // V2 nameKanji: string; // V2 nameRomaji: string; // V2 primaryGuardianEmail: string; // V2 primaryStudentEmail: string; // V2 email: string; phoneMobile: string; studentId: string; // V2 id: string; // V3 // avatar: IStudentProfileAvatar; name: MultiLanguageString; // V3 fName: MultiLanguageString; // V3 lName: MultiLanguageString; // V3 gender: "male" | "female"; birthday: Timestamp; educationType: EducationType; grade: StudentGrade; joinedAt: Timestamp; }