//
//  Constant.swift


import Foundation
import UIKit


let isProductionMode = true



let APPNAME = (Bundle.main.infoDictionary?["CFBundleDisplayName"] as? String) ?? Bundle.main.infoDictionary?["CFBundleName"] as? String
let APPVERSION = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String

let LWUserDefaultsShared = UserDefaults.standard
//var objCurrentJob:MIJobListModel? = nil
var isEditItemFlow = false

let TRUE = "1"
let FALSE = "0"

let navTitleFont : CGFloat = 17
var CellPhoneNumberLimit : Int = 20
let CURRENTUSEROBJECT = "currentuserdata"
let DEVICE_TYPE = "ios"
let kDEVICE_TOKEN = "device_token"
let USER_TYPE = "USER_TYPE"
let IS_LOGIN = "IS_LOGIN"

//Google Api Key
let API_KEY = ""

let APP_GROUP_IDENTIFIER = isProductionMode ? "group.com.livepic.picwidget" : "group.com.LpWtkP5g"


let ACCEPTABLE_CHARACTERS = "abcdefghijklmnopqrstuvwxyz0123456789_."

// ---------------------------------------
// DATE FORMAT
// ———————————————————————————————————————
let DateFormat_0 : String = "dd/MM/yyyy"
let DateFormat_1 : String = "MM.dd.yyyy"
let DateFormat_2 : String = "dd MMM, yyyy"
let DateFormat_3 : String = "yyyy-MM-dd"
let DateFormat_4 : String = "dd\nEEE"
let DateFormat_5 : String = "E, d MMM"


let TimeFormat_0 : String = "hh:mm a"
let TimeFormat_1 : String = "HH:mm"

let DateTimeFormater : String = "yyyy-MM-dd HH:mm:ss"
let ServerDateTimeFormater:String = "yyyy-MM-dd'T'HH:mm:ss.SSSZ"


let NEW_ITEM = "New Item"
let SIGNATURE = "Signature"
let COMPLETE_STAGE = "Complete Stage"
let SCAN_ITEM = "Scan Item"

let APP_NAME = "Live Pic"
let APP_NAME_WITH_WIDGET = "\(APP_NAME) Widget"

let WIDGET_DESC = "See latest pic from your favorite people on your Home Screen"

let APP_ID = "1630749313"
let APP_STORE_LINK = "https://apps.apple.com/app/id\(APP_ID)"
let APP_REVIEW_LINK = "https://itunes.apple.com/app/id\(APP_ID)?action=write-review"

let version = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String

struct Constant{
    static let OTP_value = "BvSg0HmSGkuVYgTPBRHLSU2zQJmtQdHMJtg441e30PBZ8Xhcwq"
    static let loginAttemptCount = 2
}

struct ScreenSize{
    
    static let SCREEN_WIDTH = UIScreen.main.bounds.size.width
    static let SCREEN_HEIGHT = UIScreen.main.bounds.size.height
    static let SCREEN_MAX_LENGTH = max(ScreenSize.SCREEN_WIDTH, ScreenSize.SCREEN_HEIGHT)
    static let SCREEN_MIN_LENGTH = min(ScreenSize.SCREEN_WIDTH, ScreenSize.SCREEN_HEIGHT)
    
}

//struct DeviceType{
//
//    static let IS_IPHONE_4_OR_LESS =  UIDevice.current.userInterfaceIdiom == .phone && ScreenSize.SCREEN_MAX_LENGTH < 568.0
//    static let IS_IPHONE_5 = UIDevice.current.userInterfaceIdiom == .phone && ScreenSize.SCREEN_MAX_LENGTH == 568.0
//    static let IS_IPHONE_6 = UIDevice.current.userInterfaceIdiom == .phone && ScreenSize.SCREEN_MAX_LENGTH == 667.0
//    static let IS_IPHONE_6P = UIDevice.current.userInterfaceIdiom == .phone && ScreenSize.SCREEN_MAX_LENGTH == 736.0
//    static let IS_IPHONE_X = UIDevice.current.userInterfaceIdiom == .phone && ScreenSize.SCREEN_MAX_LENGTH == 812.0
//    static let ISPAD = UIDevice.current.userInterfaceIdiom == .pad ? true : false
//}

struct DeviceType{
    static let IS_IPHONE_13_MINI =  UIDevice.current.userInterfaceIdiom == .phone && ScreenSize.SCREEN_MAX_LENGTH == 812.0
    static let IS_IPHONE_8 = UIDevice.current.userInterfaceIdiom == .phone && ScreenSize.SCREEN_MAX_LENGTH == 667.0
    static let IS_IPHONE_8P = UIDevice.current.userInterfaceIdiom == .phone && ScreenSize.SCREEN_MAX_LENGTH == 736.0
    static let IS_IPHONE_13_PRO = UIDevice.current.userInterfaceIdiom == .phone && ScreenSize.SCREEN_MAX_LENGTH == 844.0
    static let IS_IPHONE_11 = UIDevice.current.userInterfaceIdiom == .phone && ScreenSize.SCREEN_MAX_LENGTH == 896.0
    static let IS_IPHONE_13_PRO_MAX = UIDevice.current.userInterfaceIdiom == .phone && ScreenSize.SCREEN_MAX_LENGTH == 926.0
    static let ISPAD = UIDevice.current.userInterfaceIdiom == .pad ? true : false
}

struct APIName {
    static let signin_with_number = "signinwithnumber2"
    static let otp_verification = "otpverification"
    static let send_image = "sendimage"
    static let friend_list = "friendlist"
    static let send_friend_request = "sendfriendrequest"
    static let accept_friend_request = "acceptfriendrequest"
    static let widget_image_list = "widgetimagelist"
    static let pending_friend_request = "pendingfriendrequest"
    static let update_profile = "updateprofile"
    static let guest_login = "guestlogin"
    static let country_code = "countrycode"
    static let received_friend_request = "receivedfriendrequest"
    static let auto_log_in = "autologin"
    static let logout = "logout"
    static let deleteAccount = "deleteusers"
    static let unfriend = "unfriend"
    static let resend_otp = "resendotp2"
    static let latest_image = "latestimage"
    static let resend_image = "resendimage"
    static let delete_image = "imagedelete"
    static let update_device_token = "updatedevicetoken"
    static let get_sent_friend_list = "get-sent-friend-list"
    static let cancel_pending_request = "cancelpendingrequest"
    static let get_status_history = "get-status-history"
    static let login = "login"
    static let user_verification_status = "user_verification_status"
}

struct API_Param_Name {
    //SignIn with Number API
    static let phone = "phone"
    static let country_code = "country_code"
    static let device_unique_id = "device_unique_id"
    static let device_token = "device_token"
    static let device_type = "device_type"
    static let device_name = "device_name"
    static let ip = "ip"
    static let app_version = "app_version"
    static let page = "page"
    static let per_page_limite = "per_page_limite"
    static let OTP_key = "S6Lp8D307iwqaS2ORCEs"
    static let otp_count = "otp_count"
    
    //Verify OTP
    static let otp = "otp"
    static let number_is_verified = "number_is_verified"
    //Upload Widget API
    static let image = "image"
    static let image_id = "image_id"
    
    //Accept Friend Request API
    static let request_id = "request_id"
    static let status = "status"
    static let friend_id = "friends_id"
    static let unfriend_id = "friend_id"
    static let dataset = "dataset"
    
    //Update Profile API
    static let first_name = "first_name"
    static let last_name = "last_name"
}

struct Alert_Message{
    static let PhotoPermissionTitle = "Photo Access Denied"
    static let PhotoPermissionDiscription = "Please enable Photos permission for the \(APP_NAME_WITH_WIDGET) app from the Settings app."
    static let OpenSettings = "Open Settings"
    static let Cancel = "Cancel"
    
    static let CameraPermissionTitle = "Camera Access Denied"
    static let CameraPermissionDiscription = "Please enable Camera permission for the \(APP_NAME_WITH_WIDGET) app from the Settings app."
    
    static let Resend = "Resend"
    static let Share = "Share"
    static let Delete = "Delete"
    static let Remove = "Remove"
    static let Ok = "Ok"
    static let SignOut = "Sign Out"
    
    static let removeAlertMsg = "You'll no longer be able to send pictures to each other on Live Pic. Your history will be recoverable if your re- add each other"
    
    static let addFriendAlertTitle = "Invalid Phone Number"
    static let signOutMessage = "Are you sure you want to sign out?"
    
    static let addFriend = "Add Friends"
    static let friendAlertTitle = "Try adding a friend first!"
    static let friendAlertDesc = "Once a friend accepts your friend request, you can take a picture and send it to their home screen."
    
    static let Update = "Update"
    
    static let otpMessage = "Make sure you entered the verification code correctly and try again."
    static let otpTitle = "Couldn't verify number"
    
    static let networkAlertMsg = "Make sure your device is connected to the Internet and try again."
    
    static let loginAlert = "App cannot send texts to the given number. Please confirm number."
    
    static let contactPermissionTitle = "Contact Access Denied"
    static let contactPermissionDesc = "Please enable Contact permission for the \(APP_NAME_WITH_WIDGET) app from the Settings app."
    
    static let deleteHistoryMsg = "This will only delete the photo from your personal history. Anyone who you sent it to will still be able to view it."
    static let deleteTitle = "Delete picture?"
    
    static let deleteAccTitle = "Delete Account"
    static let deleteAccDesc = "Deleting your account will remove all of your information from our database. This cannot be undone."
    static let validPhoneNumber = "Please enter a valid phone number"
}

struct PushNotification{
    static let notificationType = "notificationType"
    static let accept = "accept"
    static let received = "received"
    static let img_received = "image_received"
}

struct StoryboardName {
    static let mainStoryboard = "LWHome"
    static let LandingStoryboard = "LWLanding"
}

struct APICipherKeyData {
    static let defaultCipherKey = "RJZhSVZs4YDHBuQrZh0dUD2Dhs87XXxmnTy9JzI8xHTUZ72uOOOdYfOmBzLcx7EWTew5je92YagaqyLzlG7QvdJCxoBQbWleW87m"
    static let startIndex = 31
    static let endIndex = 31 + 32
}

struct ServiceURL {
    static let terms = "https://livepic.cc/terms-of-use.html"
    static let privacyPolicy = "https://livepic.cc/privacy-policy.html"
    static let supportMail = "support@livepic.cc"
}

struct RatingPopupCnt {
    static let captureCnt = 5
    static let photoPickerCnt = 9
    static let backToHomeFromSettingCnt = 3
}

struct AdvertisementIds {
   
    //This All are Advertisement Test Id, replace it with your one."ca-app-pub-3940256099942544/5575463023"
    static let AppOpen = isProductionMode ? "ca-app-pub-1217786710342539/8782386573" : "ca-app-pub-3940256099942544/5575463023"//"ca-app-pub-3940256099942544/5662855259"
    static let Banner =  isProductionMode ? "ca-app-pub-1217786710342539/1971180617" : "ca-app-pub-3940256099942544/2934735716"
    static let Interstitial = isProductionMode ? "ca-app-pub-1217786710342539/6172535106" : "ca-app-pub-3940256099942544/4411468910"

}

func isFirstLaunch() -> Bool {
    if !UserDefaults.standard.bool(forKey: "HasLaunched") {
        UserDefaults.standard.set(true, forKey: "HasLaunched")
        UserDefaults.standard.synchronize()
        return true
    }
    return false
}

