//
//  UserData.swift
//  OrderScheduling
//
//  Created by 中道 on 2023/8/7.
//

import Foundation

public let USER = UserData.default

open class UserData {
    public static let `default` = UserData()
    
    public var token : String? {
        return UserDefaults.standard.object(forKey: token_key) as? String
    }
    
    func setToken(token:String?) {
        UserDefaults.standard.set(token, forKey: token_key)
    }
    
    public var supplierType : Int? {
        return UserDefaults.standard.object(forKey: supplierType_key) as? Int
    }
    
    func setSupplierType(supplierType:Int?) {
        UserDefaults.standard.set(supplierType, forKey: supplierType_key)
    }
    
    func clear() {
        setToken(token: nil)
        setSupplierType(supplierType: nil)
        
    }
}
