CMSRedemptionAreaModel.swift 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. //
  2. // RedemptionAreaModel.swift
  3. // Model file generated using JSONExport: https://github.com/Ahmed-Ali/JSONExport
  4. import Foundation
  5. import ObjectMapper
  6. class CMSRedemptionAreaModel : NSObject, Mappable{
  7. var applyType : String?
  8. var content : [CMSRedemptionAreaContent]?
  9. var title : String?
  10. class func newInstance(map: Map) -> Mappable?{
  11. return CMSRedemptionAreaModel()
  12. }
  13. required init?(map: Map){}
  14. private override init(){}
  15. func mapping(map: Map)
  16. {
  17. applyType <- map["apply_type"]
  18. content <- map["content"]
  19. title <- map["title"]
  20. }
  21. }
  22. enum CMSRedemptionAreaContentType : String {
  23. case none = ""
  24. case banner = "banner"
  25. case specialOne = "subject_one"
  26. case specialTwo = "subject_two"
  27. case floor = "floor"
  28. }
  29. class CMSRedemptionAreaContent : NSObject, Mappable{
  30. var cmsRedemptionAreaContentType : CMSRedemptionAreaContentType?
  31. var areaType : String? {
  32. didSet{
  33. cmsRedemptionAreaContentType = CMSRedemptionAreaContentType(rawValue: areaType ?? "")
  34. }
  35. }
  36. var floorImg : String?
  37. var id : Int?
  38. var linkType : Int?
  39. var linkUrl : Int?
  40. var rule : [CMSRedemptionAreaRule]?
  41. var showType : Int?
  42. class func newInstance(map: Map) -> Mappable?{
  43. return CMSRedemptionAreaContent()
  44. }
  45. required init?(map: Map){}
  46. private override init(){}
  47. func mapping(map: Map)
  48. {
  49. areaType <- map["area_type"]
  50. floorImg <- map["floor_img"]
  51. id <- map["id"]
  52. linkType <- map["link_type"]
  53. linkUrl <- map["link_url"]
  54. rule <- map["rule"]
  55. showType <- map["show_type"]
  56. }
  57. }
  58. class CMSRedemptionAreaRule : NSObject, Mappable{
  59. // banner
  60. var url : String?
  61. var linkUrl : String?
  62. var redemptionAreaBannerType : RedemptionAreaBannerType?
  63. var linkType : Int? {
  64. didSet {
  65. redemptionAreaBannerType = RedemptionAreaBannerType(rawValue: linkType ?? 0)
  66. }
  67. }
  68. // floor
  69. var id : Int?
  70. var img : String?
  71. var price : Int?
  72. var saleName : String?
  73. var stock : Int?
  74. var subtitle : String?
  75. var totalCount : Int?
  76. class func newInstance(map: Map) -> Mappable?{
  77. return CMSRedemptionAreaRule()
  78. }
  79. required init?(map: Map){}
  80. private override init(){}
  81. func mapping(map: Map)
  82. {
  83. // banner
  84. url <- map["url"]
  85. linkUrl <- map["link_url"]
  86. linkType <- map["link_type"]
  87. // floor
  88. id <- map["id"]
  89. img <- map["img"]
  90. price <- map["price"]
  91. saleName <- map["sale_name"]
  92. stock <- map["stock"]
  93. subtitle <- map["subtitle"]
  94. totalCount <- map["total_count"]
  95. }
  96. }