import { Timestamp, MultiLanguageString, Address, } from './common'; import {StudentId, Student} from './student'; import {ClientId} from './client'; import {FamilyId} from './family'; import {UserId, Role, UserType, UserProfileV2} from './user'; import { QrCode } from './invite'; export type SchoolId = string; /** * dbRef: schoolData/{sid} */ export interface SchoolData { academicYears: AcademicYears; badges: Badges; invites: Invites; metadata: Metadata; profile: Profile; rooms: Rooms; settings: Settings; stats: Stats; users: Users; students: Students; } /** * dbRef: schoolData/{sid}/academicYears */ export type AcademicYearId = string; export type AcademicYears = { [yid: AcademicYearId]: AcademicYear; } export interface AcademicYear { dEnd: number; dStart: number; name: MultiLanguageString | string; } /** * dbRef: schoolData/{sid}/badges/{id} */ export type Badges = { [id: string]: number; } /** * dbRef: schoolData/{sid}/invites/{inviteId} */ export type Invites = { [id: string]: Invite; } export interface Invite { active: boolean; expiresAt: number; fid?: FamilyId; role: Role; studentId?: StudentId; type: UserType; qrCode: QrCode; } /** * dbRef: schoolData/{sid}/metadata */ export interface Metadata { cid: string; sid: string; createdAt: number; createdBy: string; } /** * DB: /schoolData/{sid}/profile */ export interface Profile { address: Address; bName: MultiLanguageString | string; // branchName sName: MultiLanguageString | string; // schoolName color: string; email: string; initials: string; logoUrl: string; // ? map?: { latitude: string; latitudeDelta: string; longitude: string; longitudeDelta: string; }; phoneOffice: string; phoneFax: string; sns: { [id: string]: string }; webUrl: string; } /** * dbRef: schoolData/{sid}/rooms/{roomId} */ export type RoomId = string; export type Rooms = { [id: RoomId]: Room; } export interface Room { color?: string; name: MultiLanguageString | string; photoUrl?: string; } /** * dbRef: schoolData/{sid}/settings */ export interface Settings { general: { default: { currency: string; locale: string; timezone: string; }; locales: { [ id: string ]: string } }; modules: { [id: string]: boolean } } /** * DB: /schoolData/{sid}/stats */ export interface Stats { current: { classes: number; families: number; guardians: number; staff: number; students: number; }, monthly: { [ id: string ] : { classes: number; families: number; students: number; users: number; announcements: number; events: number; } } } /** * DB: /schoolData/{sid}/students/{studentId} */ export type Students = { [uid: StudentId]: Student }; /** * DB: /schoolData/{sid}/users/{uid} */ export type Users = { [uid: UserId]: User }; export interface User { disabled: boolean; fid?: FamilyId; name: MultiLanguageString | string; photoUrl?: string; role: Role; // status: UserPresenceStatus; type: UserType; } /** * dbRef: school/{sid} * @deprecated */ export interface SchoolV2 { cid: ClientId; sid: SchoolId; nameJa: string; nameEn: string; branchNameJa: string; branchNameEn: string; companyNameJa: string; companyNameEn: string; createdAt: Timestamp; createdBy: UserId; stats: SchoolStatsV2; } /** * dbRef: schoolMetadata/{sid} * @deprecated */ export interface SchoolMetadataV2 { badges: { [id: string]: number; }; stats: { activeClasses: number; activeFamilies: number; activeGuardians: number; activeManagers: number; activeStaff: number; activeStudents: number; activeStudentUsers: number; }; } /** * dbRef: schoolProfile/{sid} * @deprecated */ export interface SchoolProfileV2 { address: { [lang: string]: { addressCity: string; // V2 addressLine1: string; // V2 addressLine2: string; // V2 addressPostCode: string; // V2 addressPrefecture: string; // V2 city?: string; country?: string; line1?: string; line2?: string; postCode?: string; prefecture?: string; }; }; blog: string; // V2 id: string; // V2 initials: string; branchNameEn: string; // V2 branchNameJa: string; // V2 email: string; logoUrl: string; // V2 map: { latitude: number; latitudeDelta: number; longitude: number; longitudeDelta: number; }; nameEn: string; // V2 nameJa: string; // V2 openDays: { [day: string]: { closeTime: string; open: boolean; openTime: string; }; }; phoneFax: string; phoneOffice: string; schoolColor: string; // V2 socialMedia: { // V2 [id: string]: string; }; website: string; // V2 // V3 blogURL?: string; branch?: MultiLanguageString; color?: string; logoURL?: string; name?: MultiLanguageString; sid?: string; sns?: { [id: string]: string; }; websiteURL?: string; } /** * dbRef: schoolSettings/{sid} * @deprecated */ export interface SchoolSettingsV2 { adminUsers?: { [userId: UserId]: boolean; }; id: SchoolId; cid: ClientId; officeUsers?: { [userId: UserId]: boolean; }; currency: string; language: string; timezone: string; } /** * dbRef: school/{sid}/stats * @deprecated */ export interface SchoolStatsV2 { total: { activeClasses: number; activeFamilies: number; activeGuardians: number; activeManagers: number; activeStaff: number; activeStudents: number; activeStudentUsers: number; activeTeachers: number; activeUsers: number; }; } /** * dbRef: schoolUsers/{sid} * @deprecated */ export interface SchoolUserV2 { active: boolean; archived: boolean; children?: { [studentId: StudentId]: boolean; } | null; cid: ClientId; family?: FamilyId | null; id: UserId; profile: UserProfileV2; school: SchoolId | null; userType: Role; }