//
//  QSLMineViewModel.swift
//  QuickSearchLocation
//
//  Created by Destiny on 2024/4/16.
//

import Foundation

class QSLMineViewModel: NSObject {
    
    struct UX {
        static let funcCellHeight = 44.0.rpx
    }
    
    var funcViewHeight = 72.0.rpx
    
    var funcLists = [["image":"mine_func_about","title":"关于我们"],
                     ["image":"mine_func_logoff","title":"注销账号"],
                     ["image":"mine_func_logout","title":"退出登录"]]
    
    override init() {
        super.init()
        
        initFuncData()
    }
}

extension QSLMineViewModel {
    
    func initFuncData() {
   
        if !QSLBaseManager.shared.isLogin() {
            // 未登录
            funcLists = [
                ["image":"mine_func_emergency","title":"添加紧急联系人"],
//                ["image":"mine_func_share","title":"分享好友"],
//                ["image":"mine_func_advice","title":"用户反馈"],
//                ["image":"mine_func_contact","title":"联系客服"],
                ["image":"mine_func_auth","title":"权限设置"],
                ["image":"mine_func_about","title":"关于我们"],
            ]
        } else {
            // 登录
            funcLists = [
                ["image":"mine_func_emergency","title":"添加紧急联系人"],
//                ["image":"mine_func_share","title":"分享好友"],
//                ["image":"mine_func_advice","title":"用户反馈"],
//                ["image":"mine_func_contact","title":"联系客服"],
                ["image":"mine_func_auth","title":"权限设置"],
                ["image":"mine_func_about","title":"关于我们"],
                ["image":"mine_func_logoff","title":"注销账号"],
                ["image":"mine_func_logout","title":"退出登录"]
            ]
        }
        
        funcViewHeight = 28.0.rpx + Double(funcLists.count) * UX.funcCellHeight
    }
}
