@Serializable
enum class Grade (val mark: Int){
A(5),
B(4),
C(3),
F(2);
companion object {
val list = listOf(A, B, C, F)
}
}
@Serializable
class GradeInfo(
val studentId: StudentId,
val grade: Grade?
)
@Serializable
class Lesson(
val name: String,
val students: Array<GradeInfo> = emptyArray()
) {
fun addStudent(studentId: StudentId) =
Lesson(
name,
students + GradeInfo (studentId, null)
)
}