LNProfileResponse.swift 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. //
  2. // LNProfileResponse.swift
  3. // Lanu
  4. //
  5. // Created by OneeChan on 2025/11/12.
  6. //
  7. import Foundation
  8. import AutoCodable
  9. enum LNUserGender: Int, Decodable {
  10. case unknow = 0
  11. case male = 1
  12. case female = 2
  13. var desc: String {
  14. switch self {
  15. case .unknow: .init(key: "A00016")
  16. case .male: .init(key: "A00014")
  17. case .female: .init(key: "A00015")
  18. }
  19. }
  20. }
  21. @AutoCodable
  22. class LNUserInterestVO: Decodable, Equatable {
  23. var code: String = ""
  24. var name: String = ""
  25. init(code: String, name: String) {
  26. self.code = code
  27. self.name = name
  28. }
  29. static func == (lhs: LNUserInterestVO, rhs: LNUserInterestVO) -> Bool {
  30. lhs.code == rhs.code
  31. && lhs.name == rhs.name
  32. }
  33. }
  34. @AutoCodable
  35. class LNUserProfileVO: Decodable, Copyable {
  36. var avatar: String = ""
  37. var nickname: String = ""
  38. var age: Int = 0
  39. var gender: LNUserGender = .unknow
  40. var star: Double = 0.0
  41. var area: String = ""
  42. var userNo: String = ""
  43. var languageNames: [String] = []
  44. var photos: [String] = []
  45. var intro: String = ""
  46. var playmate: Bool = false
  47. var skills: [LNGameMateSkillVO] = []
  48. var follow: Bool = false
  49. var fansCount: Int = 0
  50. var voiceBar: String = ""
  51. var birthday: Int = 0
  52. var rated: Bool = false
  53. var interests: [LNUserInterestVO] = []
  54. var isAvailable: Bool {
  55. !avatar.isEmpty
  56. && !nickname.isEmpty
  57. }
  58. init() { }
  59. func update(_ info: LNUserProfileVO) -> Bool {
  60. if avatar != info.avatar
  61. || userNo != info.userNo
  62. || nickname != info.nickname
  63. || age != info.age
  64. || gender != info.gender
  65. || star != info.star
  66. || area != info.area
  67. || languageNames != info.languageNames
  68. || photos != info.photos
  69. || intro != info.intro
  70. || playmate != info.playmate
  71. || skills != info.skills
  72. || fansCount != info.fansCount
  73. || voiceBar != info.voiceBar
  74. || birthday != info.birthday
  75. || interests != info.interests
  76. {
  77. userNo = info.userNo
  78. avatar = info.avatar
  79. nickname = info.nickname
  80. age = info.age
  81. gender = info.gender
  82. star = info.star
  83. area = info.area
  84. languageNames = info.languageNames
  85. photos = info.photos
  86. intro = info.intro
  87. playmate = info.playmate
  88. skills = info.skills
  89. fansCount = info.fansCount
  90. voiceBar = info.voiceBar
  91. birthday = info.birthday
  92. interests = info.interests
  93. return true
  94. }
  95. return false
  96. }
  97. }
  98. @AutoCodable
  99. class LNUserRelationStatVO: Decodable {
  100. var fansCount: Int = 0
  101. var followCount: Int = 0
  102. var visitCount: Int = 0
  103. init() { }
  104. }
  105. enum LNUserVoiceBarState: Int, Decodable {
  106. case none = 0
  107. case review = 1
  108. case done = 2
  109. }
  110. @AutoCodable
  111. class LNUserVoiceStateVO: Decodable {
  112. var status: LNUserVoiceBarState = .none
  113. var voiceBar: String = ""
  114. var voiceBarDuration: Int = 0
  115. init() { }
  116. }
  117. @AutoCodable
  118. class LNMyProfileResponseVO: Decodable {
  119. var userProfile: LNUserProfileVO?
  120. var userFollowStat: LNUserRelationStatVO?
  121. var userVoice: LNUserVoiceStateVO?
  122. }
  123. @AutoCodable
  124. class LNUsersProfileResponse: Decodable {
  125. var list: [LNUserProfileVO] = []
  126. }
  127. @AutoCodable
  128. class LNProfileRandomInfoVO: Decodable {
  129. var nicknames: [String] = []
  130. var avatars: [String] = []
  131. init() { }
  132. }
  133. @AutoCodable
  134. class LNRandomProfileResponse: Decodable {
  135. var male: LNProfileRandomInfoVO = LNProfileRandomInfoVO()
  136. var female: LNProfileRandomInfoVO = LNProfileRandomInfoVO()
  137. }
  138. @AutoCodable
  139. class LNUserOnlineStateVO: Decodable {
  140. var userNo: String = ""
  141. var online: Bool = false
  142. }
  143. @AutoCodable
  144. class LNUserOnlineStateResponse: Decodable {
  145. var list: [LNUserOnlineStateVO] = []
  146. }