| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169 |
- //
- // LNProfileResponse.swift
- // Lanu
- //
- // Created by OneeChan on 2025/11/12.
- //
- import Foundation
- import AutoCodable
- enum LNUserGender: Int, Decodable {
- case unknow = 0
- case male = 1
- case female = 2
-
- var desc: String {
- switch self {
- case .unknow: .init(key: "A00016")
- case .male: .init(key: "A00014")
- case .female: .init(key: "A00015")
- }
- }
- }
- @AutoCodable
- class LNUserInterestVO: Decodable, Equatable {
- var code: String = ""
- var name: String = ""
-
- init(code: String, name: String) {
- self.code = code
- self.name = name
- }
-
- static func == (lhs: LNUserInterestVO, rhs: LNUserInterestVO) -> Bool {
- lhs.code == rhs.code
- && lhs.name == rhs.name
- }
- }
- @AutoCodable
- class LNUserProfileVO: Decodable, Copyable {
- var avatar: String = ""
- var nickname: String = ""
- var age: Int = 0
- var gender: LNUserGender = .unknow
- var star: Double = 0.0
- var area: String = ""
- var userNo: String = ""
- var languageNames: [String] = []
- var photos: [String] = []
- var intro: String = ""
- var playmate: Bool = false
- var skills: [LNGameMateSkillVO] = []
- var follow: Bool = false
- var fansCount: Int = 0
- var voiceBar: String = ""
- var birthday: Int = 0
- var rated: Bool = false
- var interests: [LNUserInterestVO] = []
-
- var isAvailable: Bool {
- !avatar.isEmpty
- && !nickname.isEmpty
- }
-
- init() { }
-
- func update(_ info: LNUserProfileVO) -> Bool {
- if avatar != info.avatar
- || userNo != info.userNo
- || nickname != info.nickname
- || age != info.age
- || gender != info.gender
- || star != info.star
- || area != info.area
- || languageNames != info.languageNames
- || photos != info.photos
- || intro != info.intro
- || playmate != info.playmate
- || skills != info.skills
- || fansCount != info.fansCount
- || voiceBar != info.voiceBar
- || birthday != info.birthday
- || interests != info.interests
- {
- userNo = info.userNo
- avatar = info.avatar
- nickname = info.nickname
- age = info.age
- gender = info.gender
- star = info.star
- area = info.area
- languageNames = info.languageNames
- photos = info.photos
- intro = info.intro
- playmate = info.playmate
- skills = info.skills
- fansCount = info.fansCount
- voiceBar = info.voiceBar
- birthday = info.birthday
- interests = info.interests
-
- return true
- }
- return false
- }
- }
- @AutoCodable
- class LNUserRelationStatVO: Decodable {
- var fansCount: Int = 0
- var followCount: Int = 0
- var visitCount: Int = 0
-
- init() { }
- }
- enum LNUserVoiceBarState: Int, Decodable {
- case none = 0
- case review = 1
- case done = 2
- }
- @AutoCodable
- class LNUserVoiceStateVO: Decodable {
- var status: LNUserVoiceBarState = .none
- var voiceBar: String = ""
- var voiceBarDuration: Int = 0
-
- init() { }
- }
- @AutoCodable
- class LNMyProfileResponseVO: Decodable {
- var userProfile: LNUserProfileVO?
- var userFollowStat: LNUserRelationStatVO?
- var userVoice: LNUserVoiceStateVO?
- }
- @AutoCodable
- class LNUsersProfileResponse: Decodable {
- var list: [LNUserProfileVO] = []
- }
- @AutoCodable
- class LNProfileRandomInfoVO: Decodable {
- var nicknames: [String] = []
- var avatars: [String] = []
-
- init() { }
- }
- @AutoCodable
- class LNRandomProfileResponse: Decodable {
- var male: LNProfileRandomInfoVO = LNProfileRandomInfoVO()
- var female: LNProfileRandomInfoVO = LNProfileRandomInfoVO()
- }
- @AutoCodable
- class LNUserOnlineStateVO: Decodable {
- var userNo: String = ""
- var online: Bool = false
- }
- @AutoCodable
- class LNUserOnlineStateResponse: Decodable {
- var list: [LNUserOnlineStateVO] = []
- }
|