UnitsListModel.swift 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. //
  2. // UnitsListModel.swift
  3. // LMS
  4. //
  5. // Created by Suraj Kumar Mandal on 06/09/22.
  6. //
  7. // let unitsList = try? newJSONDecoder().decode(UnitsList.self, from: jsonData)
  8. import Foundation
  9. // MARK: - UnitsListModel
  10. class UnitsListModel: Codable {
  11. var createdBy, createdDate, lastModifiedBy, lastModifiedDate: String?
  12. var id: Int?
  13. var academicYear, name, status: String?
  14. var intervention: Intervention?
  15. var level: UnitsLevel?
  16. var comments: String?
  17. init(createdBy: String?, createdDate: String?, lastModifiedBy: String?, lastModifiedDate: String?, id: Int?, academicYear: String?, name: String?, status: String?, intervention: Intervention?, level: UnitsLevel?, comments: String?) {
  18. self.createdBy = createdBy
  19. self.createdDate = createdDate
  20. self.lastModifiedBy = lastModifiedBy
  21. self.lastModifiedDate = lastModifiedDate
  22. self.id = id
  23. self.academicYear = academicYear
  24. self.name = name
  25. self.status = status
  26. self.intervention = intervention
  27. self.level = level
  28. self.comments = comments
  29. }
  30. }
  31. // MARK: - Intervention
  32. class Intervention: Codable {
  33. var id, incrementor: Int?
  34. var interventionId, interventionName: String?
  35. var interventionLevels: [String]?
  36. var beneficiaryIds: [Int]?
  37. var deleted, active: Bool?
  38. var status: String?
  39. var interventionSchoolMappings, mappedProgramHeads: JSONNull?
  40. init(id: Int?, incrementor: Int?, interventionId: String?, interventionName: String?, interventionLevels: [String]?, beneficiaryIds: [Int]?, deleted: Bool?, active: Bool?, status: String?, interventionSchoolMappings: JSONNull?, mappedProgramHeads: JSONNull?) {
  41. self.id = id
  42. self.incrementor = incrementor
  43. self.interventionId = interventionId
  44. self.interventionName = interventionName
  45. self.interventionLevels = interventionLevels
  46. self.beneficiaryIds = beneficiaryIds
  47. self.deleted = deleted
  48. self.active = active
  49. self.status = status
  50. self.interventionSchoolMappings = interventionSchoolMappings
  51. self.mappedProgramHeads = mappedProgramHeads
  52. }
  53. }
  54. // MARK: - Level
  55. class UnitsLevel: Codable {
  56. var id, interventionTableId: Int?
  57. var interventionLevels: String?
  58. init(id: Int?, interventionTableId: Int?, interventionLevels: String?) {
  59. self.id = id
  60. self.interventionTableId = interventionTableId
  61. self.interventionLevels = interventionLevels
  62. }
  63. }