import Foundation

extension UserDefaults {
    
    /// user token saved in device memory
    static var userToken: String? {
        get {
            UserDefaults.standard.string(forKey: "token")
        }
        
        set {
            UserDefaults.standard.set(newValue, forKey: "token")
        }
    }
    
    /// user id saved in device memory
    static var userId: String? {
        get {
            UserDefaults.standard.string(forKey: "userId")
        }
        
        set {
            UserDefaults.standard.set(newValue, forKey: "userId")
        }
    }
    
    /// person id saved in device memory
    static var personId: String? {
        get {
            UserDefaults.standard.string(forKey: "personID")
        }
        
        set {
            UserDefaults.standard.set(newValue, forKey: "personID")
        }
    }
    
    /// person name saved in device memory
    static var personName: String? {
        get {
            UserDefaults.standard.string(forKey: "personName")
        }
        
        set {
            UserDefaults.standard.set(newValue, forKey: "personName")
        }
    }
    
    /// unit id saved in device memory
    static var unitId: String? {
        get {
            UserDefaults.standard.string(forKey: "unitId")
        }
        
        set {
            UserDefaults.standard.set(newValue, forKey: "unitId")
        }
    }
    
    /// loggout date saved in device memory
    static var dateLoggout: String? {
        get {
            UserDefaults.standard.string(forKey: "dateLoggout")
        }
        
        set {
            UserDefaults.standard.set(newValue, forKey: "dateLoggout")
        }
    }
}
