# Path: api/util/dynamic.py
# def getWorkingDirs():
# def setProjectPath(dir=None):
# def get_current_ip():
# def get_hostname():
# def script_info():


import requests, json
from flask import Flask, render_template, request, jsonify, make_response
from  api.util import dynamic
'''
@Summary: Server for GUI pages and user navigation throughout site
@Author: mackhendricks
'''


app = Flask(__name__)

# Configurations
app.config.from_object('config')

if ('API_SERVER_URL' in app.config) and len(app.config['API_SERVER_URL']) > 0:
    API_SERVER = app.config['API_SERVER_URL']
else: #Assume the the server is located on the local server
    ip = dynamic.get_current_ip()
    API_SERVER = "http://{}:7777".format(ip)
    app.config['API_SERVER_URL'] = API_SERVER

print("API Server:" + API_SERVER) # Print the API Server URL on the console

# TODO: Define what vars to store here, API_SERVER isn't really sensitive data but username is
class GUI:
    ''' Container for encapsulation / data-hiding of configuration variables.
        Variables that are sensitive but used during operation, load here.
        GUI is created when gui_server.py starts and destroyed on shut down. '''

    def __init__(self, user_name=None, api_server_url=None):
        self.__user_name = user_name
        self.__api_server_url = api_server_url

# Path: api/util/dynamic.py
# def getWorkingDirs():
# def setProjectPath(dir=None):
# def get_current_ip():
# def get_hostname():
# def script_info():


# Path: gui/gui_server.py
import requests, json
from flask import Flask, render_template, request, jsonify, make_response
from  api.util import dynamic

'''
@Summary: Server for GUI pages and user navigation throughout site
@Author: mackhendricks
'''


app = Flask(__name__)

# Configurations
app.config.from_object('config')

if ('API_SERVER_URL' in app.config) and len(app.config['API_SERVER_URL']) > 0:
    API_SERVER = app.config['API_SERVER_URL']
else: #Assume the the server is located on the local server
    ip = dynamic.get_current_ip()
    API_SERVER = "http://{}:7777".format(ip)
    app.config['API_SERVER_URL'] = API_SERVER

print("API Server:" + API_SERVER) # Print the API Server URL on the console

# TODO: Define what vars to store here, API_SERVER isn't really sensitive data but username is
class GUI:
    ''' Container for encapsulation / data-hiding of configuration variables.
        Variables that are sensitive but used during operation, load here.
        GUI is created when gui_server.py starts and destroyed on shut down. '''

    def __init__(self, user_name=None, api_server_url=None):
        self.__user_name = user_name
        self.__api_server_url = api_server_url

        print("GUI configuration variables initialized")