//
//  AuthFunc.swift
//  WOKA
//
//  Created by Bilal on 26/04/2024.
//

import Foundation
import AVFoundation
import UIKit

class AuthFunc{
    
    /**
     This is not for external use!
     This should only be used for login, registration, Auth Process process & userData Extraction.
     */
    
    var player: AVQueuePlayer?
    var playerLooper: AVPlayerLooper?
    var userType = UserType.adult
    var languageSelected = LocalizedEnum.english
    
    var authID = String()
    var authPass = String()
    
    //This is temporary variable. Make it emtpy when the registration is finished.
    var regData = UserRegPostModel()
    
    // Singleton instance of AuthFunc
    static let shareInstance = AuthFunc()
    
    // Returns the device's UUID
    func getDeviceUUID() -> String{
        /* 
         UIDevice.current.name             // e.g. "My iPhone"
         UIDevice.current.model            // e.g. @"iPhone", @"iPod touch"
         UIDevice.current.localizedModel   // localized version of model
         UIDevice.current.systemName       // e.g. @"iOS"
         UIDevice.current.systemVersion    // e.g. @"15.5"
         */
        return UIDevice.current.identifierForVendor!.uuidString
    }
    
    // Sets authentication ID and password from the app's info dictionary
    func setAuthIDPass(){
        if let id = Bundle.main.infoDictionary?["API_KEY_ID"] as? String{
            authID = id
        }
        
        if let pass = Bundle.main.infoDictionary?["API_KEY_PASS"] as? String{
            authPass = pass
        }
    }
}

// MARK: - Language Enum

enum LocalizedEnum : String , CaseIterable{
    case hindi = "hi"
    case english = "en"
}

// MARK: - Enum representing different user types

enum UserType {
    case adult
    case kid
}
