models.go 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. package schedule
  2. type DayType uint8
  3. const (
  4. SUNDAY DayType = 0
  5. MONDAY DayType = 1
  6. TUESDAY DayType = 2
  7. WEDNESDAY DayType = 3
  8. THURSDAY DayType = 4
  9. FRIDAY DayType = 5
  10. SATURDAY DayType = 6
  11. )
  12. type SubgroupType uint8
  13. const (
  14. A SubgroupType = 0
  15. B SubgroupType = 1
  16. ALL SubgroupType = 2
  17. )
  18. type SubjectType uint8
  19. const (
  20. THEORETICAL SubjectType = 0
  21. PRACTICAL SubjectType = 1
  22. )
  23. type Generator struct {
  24. Day DayType
  25. Debug bool
  26. Groups map[string]*Group
  27. Teachers map[string]*Teacher
  28. Blocked map[string]bool
  29. Reserved Reserved
  30. }
  31. type Reserved struct {
  32. Teachers map[string][]bool
  33. Cabinets map[string][]bool
  34. }
  35. type Schedule struct {
  36. Day DayType
  37. Group string
  38. Table []Row
  39. }
  40. type Row struct {
  41. Subject [ALL]string
  42. Teacher [ALL]string
  43. Cabinet [ALL]string
  44. }
  45. type Teacher struct {
  46. Name string `json:"name"`
  47. Cabinets []Cabinet `json:"cabinets"`
  48. }
  49. type Cabinet struct {
  50. Name string `json:"name"`
  51. IsComputer bool `json:"is_computer"`
  52. }
  53. type Group struct {
  54. Name string
  55. Quantity uint // students count
  56. Subjects map[string]*Subject
  57. }
  58. type Subject struct {
  59. Name string
  60. Teacher string
  61. Teacher2 string
  62. IsComputer bool
  63. SaveWeek uint
  64. Theory uint
  65. Practice Subgroup
  66. WeekLessons Subgroup
  67. }
  68. type Subgroup struct {
  69. A uint
  70. B uint
  71. }
  72. type GroupJSON struct {
  73. Name string `json:"name"`
  74. Quantity uint `json:"quantity"`
  75. Subjects []SubjectJSON `json:"subjects"`
  76. }
  77. type SubjectJSON struct {
  78. Name string `json:"name"`
  79. Teacher string `json:"teacher"`
  80. IsComputer bool `json:"is_computer"`
  81. Lessons LessonsJSON `json:"lessons"`
  82. }
  83. type LessonsJSON struct {
  84. Theory uint `json:"theory"`
  85. Practice uint `json:"practice"`
  86. Week uint `json:"week"`
  87. }