import sys
import os
from pathlib import Path
from typing import Dict, Any
import requests

modules_paths = ['.', '../../../modules/']
for modules_path in modules_paths:
    if os.path.exists(modules_path):
        sys.path.insert(1, modules_path)

# import _add_use_case_scripts.car_sharing.tables.add_user as user

from _add_use_case_scripts.car_sharing.tables import  add_car, add_hash, add_offer, add_publication, add_travel, add_user

# import _add_use_case_scripts.car_sharing.tables.add_user as user
# from _add_use_case_scripts.car_sharing.tables import add_car
# from _add_use_case_scripts.car_sharing.tables import add_hash
# from _add_use_case_scripts.car_sharing.tables import add_publication
# from _add_use_case_scripts.car_sharing.tables import add_offer
# from _add_use_case_scripts.car_sharing.tables import add_travel

import network_constants as nc
from security.token_manager import TokenManager



def add_use_case(use_case: str):
    use_case = "car-sharing"

    jwt = TokenManager.getInstance().getToken()
    url = f"https://articonf1.itec.aau.at:30420/api/use-cases"
    response = requests.post(
            url,
            verify=False, 
            proxies = { "http":None, "https":None },
            headers = { "Authorization": f"Bearer {jwt}"},
            json = {"name": use_case}
        )
    
    print(url+": "+str(response.content))
        

if __name__ == "__main__":
    use_case = "car-sharing"
    
    # disable ssl warnings :) 
    requests.packages.urllib3.disable_warnings() 

    add_use_case(use_case)
    add_user.main(use_case)
    add_car.main(use_case)
    add_hash.main(use_case)
    add_offer.main(use_case)
    add_publication.main(use_case)
    add_travel.main(use_case)
    