//
//  APIEndPoints.swift
//  WOKA
//
//  Created by MacBook Pro on 06/05/24.
//

import Foundation

// enum to check envirnments
enum EnvironmentCheck{
    case staging
    case production
}

struct APIEndPoints {
    
    // Private init to prevent external initialization
    private init() {}
    
    struct BaseURL {
        static let staging = "https://wokaland.com/admin/api/"
        static let production = "https://simplitend.com"
    }
    
    struct Auth {
        static let check_exist_email = makeURL(path: "check_exist_email")
        
        /*
         Login User
         */
        static let login = makeURL(path: "login")
        static let login_proceed = makeURL(path: "login_proceed")
        static let guest_login = makeURL(path: "guest_login")
        
        
        static let user_email_verification = makeURL(path: "user_email_verification")
        static let validate_otp = makeURL(path: "validate_otp")
        static let interest_topic_listing = makeURL(path: "interest_topic_listing")
        static let check_exist_username = makeURL(path: "check_exist_username")
        static let avatar_listing = makeURL(path: "avatar_listing")
        static let child_registration = makeURL(path: "child_registration")
        static let get_linked_child = makeURL(path: "get_linked_child")
        
        /*
         Password forgot api's
         */
        static let forgot_password_send_otp = makeURL(path: "forgot_password_send_otp")
        static let forgot_password_verify_otp = makeURL(path: "forgot_password_verify_otp")
        static let update_password = makeURL(path: "update_password")
    }
    
    // Other endpoint categories...
    struct Links {
        static let privacyPolicy = "https://www.simplitend.com/privacy-policy"
        static let termsAndCondition = "https://www.simplitend.com/terms-and-conditions"
        // Other links...
    }
    
    // Helper method to construct full URL from base URL and path
    private static func makeURL(path: String) -> URL {
        guard let baseURL = baseURLForCurrentEnvironment() else {
            fatalError("Base URL not configured for current environment")
        }
        return baseURL.appendingPathComponent(path)
    }
    
    // Helper method to get base URL based on current environment
    private static func baseURLForCurrentEnvironment() -> URL? {
        // Determine environment (e.g., staging, production) and return appropriate base URL
        return URL(string: BaseURL.staging)
    }
}
