LNGameMateResponse.swift 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562
  1. //
  2. // LNGameMateResponse.swift
  3. // Lanu
  4. //
  5. // Created by OneeChan on 2025/11/20.
  6. //
  7. import Foundation
  8. import AutoCodable
  9. @AutoCodable
  10. class LNGameMateListItemVO: Decodable {
  11. var id: String = ""
  12. var online: Bool = false
  13. var orderCount: Int = 0
  14. var distance: Double = 0.0
  15. var avatar: String = ""
  16. var nickname: String = ""
  17. var userNo: String = ""
  18. var age: Int = 0
  19. var gender: LNUserGender = .unknow
  20. var star: Double = 0.0
  21. var area: String = ""
  22. var summary: String = ""
  23. var images: [String] = []
  24. var voiceBar: String = ""
  25. var price: Double = 0
  26. var unit: String = ""
  27. var labels: [String] = []
  28. var categoryName: String = ""
  29. var categoryIcon: String = ""
  30. var newcomer: Bool = false
  31. }
  32. @AutoCodable
  33. class LNGameMateListResponse: Decodable {
  34. var list: [LNGameMateListItemVO] = []
  35. var next: String = ""
  36. }
  37. enum LNGameCategoryType: Int, Decodable {
  38. case normal = 0
  39. case offline = 1
  40. case user = 2
  41. }
  42. @AutoCodable
  43. class LNGameCategoryItemVO: Decodable {
  44. var code: String = ""
  45. var name: String = ""
  46. var icon: String = ""
  47. var categoryType: LNGameCategoryType = .normal
  48. init(code: String, name: String, icon: String, categoryType: LNGameCategoryType) {
  49. self.code = code
  50. self.name = name
  51. self.icon = icon
  52. self.categoryType = categoryType
  53. }
  54. }
  55. @AutoCodable
  56. class LNGameTypeItemVO: Decodable {
  57. var code: String = ""
  58. var name: String = ""
  59. var icon: String = ""
  60. var categoryType: LNGameCategoryType = .normal
  61. var children: [LNGameCategoryItemVO] = []
  62. }
  63. @AutoCodable
  64. class LNGameTypeListResponse: Decodable {
  65. var list: [LNGameTypeItemVO] = []
  66. }
  67. @AutoCodable
  68. class LNGameMateSkillVO: Decodable, Equatable {
  69. var id: String = ""
  70. var name: String = ""
  71. var icon: String = ""
  72. var price: Double = 0
  73. var unit: String = ""
  74. var cover: String = ""
  75. static func == (lhs: LNGameMateSkillVO, rhs: LNGameMateSkillVO) -> Bool {
  76. lhs.id == rhs.id
  77. && lhs.name == rhs.name
  78. && lhs.icon == rhs.icon
  79. && lhs.price == rhs.price
  80. && lhs.unit == rhs.unit
  81. && lhs.cover == rhs.cover
  82. }
  83. init() { }
  84. }
  85. @AutoCodable
  86. class LNGameMateSkillListResponse: Decodable {
  87. var list: [LNGameMateSkillVO] = []
  88. }
  89. @AutoCodable
  90. class LNGameMateInfoResponse: Decodable {
  91. var avatar: String = ""
  92. var nickname: String = ""
  93. var age: Int = 0
  94. var gender: LNUserGender = .unknow
  95. var star: Double = 0.0
  96. var area: String = ""
  97. var cover: String = ""
  98. var userNo: String = ""
  99. var languageNames: [String] = []
  100. var photos: [String] = []
  101. var intro: String = ""
  102. var playmate: Bool = false
  103. var skills: [LNGameMateSkillVO] = []
  104. var follow: Bool = false
  105. var fansCount: Int = 0
  106. var voiceBar: String = ""
  107. var rated: Bool = false
  108. }
  109. @AutoCodable
  110. class LNGameMateSkillDetailVO: Decodable {
  111. var id: String = ""
  112. var avatar: String = ""
  113. var nickname: String = ""
  114. var age: Int = 0
  115. var gender: LNUserGender = .unknow
  116. var star: Double = 0.0
  117. var area: String = ""
  118. var cover: String = ""
  119. var userNo: String = ""
  120. var categoryName: String = ""
  121. var languageNames: [String] = []
  122. var summary: String = ""
  123. var images: [String] = []
  124. var voiceBar: String = ""
  125. var price: Double = 0
  126. var unit: String = ""
  127. var labels: [String] = []
  128. var categoryCode: String = ""
  129. var orderCount: Int = 0
  130. var online: Bool = false
  131. var follow: Bool = false
  132. var distance: Double = 0
  133. }
  134. @AutoCodable
  135. class LNGameMateSearchResultVO: Decodable {
  136. var userNo: String = ""
  137. var avatar: String = ""
  138. var nickname: String = ""
  139. var age: Int = 0
  140. var gender: LNUserGender = .unknow
  141. var follow: Bool = false
  142. var fansCount: Int = 0
  143. var online: Bool = false
  144. }
  145. @AutoCodable
  146. class LNGameMateSearchResponse: Decodable {
  147. var list: [LNGameMateSearchResultVO] = []
  148. var next: String = ""
  149. }
  150. @AutoCodable
  151. class LNJoinUsBindPhoneInfoVO: Decodable {
  152. var mobileCode: String = ""
  153. var mobileNum: String = ""
  154. }
  155. @AutoCodable
  156. class LNJoinUsBaseInfoVO: Decodable {
  157. var avatar: String = ""
  158. var nickname: String = ""
  159. var gender: LNUserGender = .unknow
  160. var birthday: String = ""
  161. var languageCodes: [String] = []
  162. var intro: String = ""
  163. init() { }
  164. }
  165. @AutoCodable
  166. class LNSkillFieldValidateLenLimit: Decodable {
  167. var min: Int = 0
  168. var max: Int = 0
  169. }
  170. @AutoCodable
  171. class LNSkillFieldValidateNumLimit: Decodable {
  172. var min: Double = 0
  173. var max: Double = 0
  174. }
  175. @AutoCodable
  176. class LNSkillFieldValidate: Decodable {
  177. var required: Bool = false
  178. var size: LNSkillFieldValidateLenLimit?
  179. var numLimit: LNSkillFieldValidateNumLimit?
  180. var arraySize: LNSkillFieldValidateLenLimit?
  181. var regex: String = ""
  182. init() { }
  183. }
  184. enum LNSkillFieldExampleType: Int, Decodable {
  185. case photo = 0
  186. case voice = 1
  187. }
  188. @AutoCodable
  189. class LNSkillFieldExample: Decodable {
  190. var type: LNSkillFieldExampleType = .photo
  191. var value: String = ""
  192. var title: String = ""
  193. var desc: String = ""
  194. init() { }
  195. }
  196. enum LNSkillFieldValueType: Int, Decodable {
  197. case unknown = -1
  198. case string = 0
  199. case int = 1
  200. case double = 2
  201. }
  202. enum LNSkillFieldInputType: Int, Decodable {
  203. case unknown = -1
  204. case singleLineText = 0
  205. case multiLineText = 1
  206. case singleSelection = 2
  207. case multiSelection = 3
  208. case number = 4
  209. case photo = 5
  210. // case date = 6
  211. case voice = 7
  212. }
  213. @AutoCodable
  214. class LNSkillFieldConstants: Decodable {
  215. var value: String = ""
  216. var key: String = ""
  217. }
  218. enum LNSkillEditStaticFieldCode: String {
  219. case fieldUnitPrice
  220. case fieldUnit
  221. }
  222. class LNSkillEditField: Decodable {
  223. var fieldCode: String = ""
  224. var value: (any Codable)? = nil
  225. var fieldName: String = ""
  226. var fieldDesc: String = ""
  227. var valueClassType: LNSkillFieldValueType = .string
  228. var type: LNSkillFieldInputType = .singleLineText
  229. var array: Bool = false
  230. var duration: Int = 0
  231. var constants: [LNSkillFieldConstants] = []
  232. var validate: LNSkillFieldValidate = LNSkillFieldValidate()
  233. var example: LNSkillFieldExample?
  234. enum CodingKeys: String, CodingKey {
  235. case fieldCode
  236. case value
  237. case fieldName
  238. case fieldDesc
  239. case valueClassType
  240. case type
  241. case array
  242. case duration
  243. case constants
  244. case validate
  245. case example
  246. }
  247. required init(from decoder: Decoder) throws {
  248. let container = try decoder.container(keyedBy: CodingKeys.self)
  249. if let value = try? container.decode(String.self, forKey: .fieldCode) {
  250. self.fieldCode = value
  251. }
  252. if let value = try? container.decode(String.self, forKey: .fieldName) {
  253. self.fieldName = value
  254. }
  255. if let value = try? container.decode(String.self, forKey: .fieldDesc) {
  256. self.fieldDesc = value
  257. }
  258. if let value = try? container.decode(LNSkillFieldValueType.self, forKey: .valueClassType) {
  259. self.valueClassType = value
  260. }
  261. if let value = try? container.decode(LNSkillFieldInputType.self, forKey: .type) {
  262. self.type = value
  263. }
  264. if let value = try? container.decode(Bool.self, forKey: .array) {
  265. self.array = value
  266. }
  267. if let value = try? container.decode(Int.self, forKey: .duration) {
  268. self.duration = value
  269. }
  270. if let value = try? container.decode([LNSkillFieldConstants].self, forKey: .constants) {
  271. self.constants = value
  272. }
  273. if let value = try? container.decode(LNSkillFieldValidate.self, forKey: .validate) {
  274. self.validate = value
  275. }
  276. if let value = try? container.decode(LNSkillFieldExample?.self, forKey: .example) {
  277. self.example = value
  278. }
  279. if array {
  280. switch valueClassType {
  281. case .string:
  282. value = try? container.decode([String].self, forKey: .value)
  283. case .int:
  284. value = try? container.decode([Int].self, forKey: .value)
  285. case .double:
  286. value = try? container.decode([Double].self, forKey: .value)
  287. case .unknown: break
  288. }
  289. } else {
  290. switch valueClassType {
  291. case .string:
  292. value = try? container.decode(String.self, forKey: .value)
  293. case .int:
  294. value = try? container.decode(Int.self, forKey: .value)
  295. case .double:
  296. value = try? container.decode(Double.self, forKey: .value)
  297. case .unknown: break
  298. }
  299. }
  300. }
  301. }
  302. @AutoCodable
  303. class LNCreateSkillInputFieldsVO: Decodable {
  304. var bizCategoryCode: String?
  305. var fields: [LNSkillEditField] = []
  306. var isAvailable: Bool {
  307. for field in fields {
  308. if field.valueClassType == .unknown
  309. || field.type == .unknown {
  310. return false
  311. }
  312. }
  313. return true
  314. }
  315. }
  316. @AutoCodable
  317. class LNJoinUsInputInfosResponse: Decodable {
  318. var underReview: Bool = false
  319. var step1Complete: Bool = false
  320. var step2Complete: Bool = false
  321. var step3Complete: Bool = false
  322. var setp1: LNJoinUsBindPhoneInfoVO?
  323. var setp2: LNJoinUsBaseInfoVO?
  324. var setp3: LNCreateSkillInputFieldsVO?
  325. }
  326. enum LNOrderAcceptWeekDay: Int, Decodable, CaseIterable {
  327. case sun = 1
  328. case mon = 2
  329. case tue = 3
  330. case wed = 4
  331. case thu = 5
  332. case fri = 6
  333. case sat = 7
  334. var text: String {
  335. let formatter = DateFormatter()
  336. formatter.locale = curLocal
  337. return formatter.weekdaySymbols[rawValue - 1]
  338. }
  339. }
  340. @AutoCodable
  341. class LNOrderAcceptConfig: Decodable {
  342. var timeRange: String = ""
  343. var weekNums: [LNOrderAcceptWeekDay] = []
  344. var autoWelcomeOpen: Bool = false
  345. init() { }
  346. }
  347. @AutoCodable
  348. class LNMySkillItemVO: Decodable {
  349. var id: String = ""
  350. var bizCategoryName: String = ""
  351. var categoryIcon: String = ""
  352. var price: Double = 0.0
  353. var unit: String = ""
  354. var open: Bool = false
  355. var bizCategoryCode: String = ""
  356. }
  357. @AutoCodable
  358. class LNMySkillListResponse: Decodable {
  359. var list: [LNMySkillItemVO] = []
  360. }
  361. @AutoCodable
  362. class LNGameMateManagerInfo: Decodable {
  363. var weekBeanIncome: Double = 0
  364. var exposureCountDay: Int = 0
  365. var visitorCount: Int = 0
  366. var playmateOpen: Bool = false
  367. var potentialUserCount: Int = 0
  368. }
  369. @AutoCodable
  370. class LNVisitorItemVO: Decodable {
  371. var userNO: String = ""
  372. var nickname: String = ""
  373. var avatar: String = ""
  374. var gender: LNUserGender = .unknow
  375. var age: Int = 0
  376. var online: Bool = false
  377. var visitTime: Int = 0
  378. var intro: String = ""
  379. init() { }
  380. }
  381. @AutoCodable
  382. class LNVisitorsListResponse: Decodable {
  383. var list: [LNVisitorItemVO] = []
  384. var next: String = ""
  385. }
  386. @AutoCodable
  387. class LNSkillEditFieldsResponse: Decodable {
  388. var bizCategoryName: String = ""
  389. var fields: [LNSkillEditField] = []
  390. var skillId = ""
  391. }
  392. @AutoCodable
  393. class LNSkillSwitchResponse: Decodable {
  394. var open: Bool = false
  395. var mainSkill: Bool = false
  396. }
  397. @AutoCodable
  398. class LNSkillFilterConstants: Decodable {
  399. var key: String = ""
  400. var value: String = ""
  401. var icon: String = ""
  402. }
  403. @AutoCodable
  404. class LNSkillFilterField: Decodable {
  405. var name: String = ""
  406. var fieldCode: String = ""
  407. var constants: [LNSkillFieldConstants] = []
  408. }
  409. @AutoCodable
  410. class LNSkillFilterConfig: Decodable {
  411. var code: String = ""
  412. var filterFields: [LNSkillFilterField] = []
  413. }
  414. @AutoCodable
  415. class LNSkillFilterConfigList: Decodable {
  416. var list: [LNSkillFilterConfig] = []
  417. }
  418. @AutoCodable
  419. class LNSkillCommentVO: Decodable {
  420. var time: Int = 0
  421. var avatar: String = ""
  422. var nickname: String = ""
  423. var star: Double = 0
  424. var userNo: String = ""
  425. var comment: String = ""
  426. }
  427. @AutoCodable
  428. class LNSkillCommentListResponse: Decodable {
  429. var list: [LNSkillCommentVO] = []
  430. var next: String = ""
  431. var total: Int = 0
  432. }
  433. enum LNAutoReplyState: Int, Decodable {
  434. case reviewing = 0
  435. case pass = 1
  436. case reject = 2
  437. }
  438. enum LNAutoReplyType: Int, Decodable {
  439. case text = 0
  440. case voice = 1
  441. }
  442. @AutoCodable
  443. class LNAutoReplyVO: Decodable {
  444. var id: String = ""
  445. var type: LNAutoReplyType = .text
  446. var status: LNAutoReplyState = .reviewing
  447. var textContent: String = ""
  448. var voiceUrl: String = ""
  449. var voiceDuration: Int = 0
  450. var reviewReason: String = ""
  451. init() { }
  452. }
  453. @AutoCodable
  454. class LNAutoReplyResponse: Decodable {
  455. var list: [LNAutoReplyVO] = []
  456. }
  457. @AutoCodable
  458. class LNAutoReplyQuotaResponse: Decodable {
  459. var userQuotaCount: Int = 0
  460. var playmateQuotaCount: Int = 0
  461. }
  462. @AutoCodable
  463. class LNPotentialUserVO: Decodable {
  464. var userNo: String = ""
  465. var avatar: String = ""
  466. var nickname: String = ""
  467. var age: Int = 0
  468. var gender: LNUserGender = .unknow
  469. var newRegister: Bool = false
  470. var online: Bool = false
  471. var contacted: Bool = false
  472. }
  473. @AutoCodable
  474. class LNPotentialUsersResponse: Decodable {
  475. var list: [LNPotentialUserVO] = []
  476. }
  477. @AutoCodable
  478. class LNRoomItemVO: Decodable {
  479. var roomId: String = ""
  480. var roomTitle: String = ""
  481. var roomCover: String = ""
  482. var user: LNRoomUserVO = LNRoomUserVO()
  483. init( ) { }
  484. }
  485. @AutoCodable
  486. class LNSearchRoomResponse: Decodable {
  487. var list: [LNRoomItemVO] = []
  488. var next: String = ""
  489. }
  490. @AutoCodable
  491. class LNMixSearchResponse: Decodable {
  492. var playmate: [LNGameMateSearchResultVO] = []
  493. var rooms: [LNRoomItemVO] = []
  494. }