from flask import Flask, jsonify, Response, request
from game import Game

app = Flask(__name__)

my_game = Game()

@app.route('/GETQUESTION', methods=['GET'])
def get_question():
    question = my_game.get_question()
    return jsonify(question)

## USEFUL ?
# @app.route('/connection', methods=['GET'])
# def connection():
#     return Response(status=200)

@app.route('/teamsize', methods=['POST'])
def teamsize():
    team_size = request.json
    my_game.set_teamsize(team_size.get('teamsize'))
    return Response(status=200)

@app.route('/scoreboard', methods=['GET'])
def scoreboard():
    new_score = my_game.scoreboard
    return new_score

@app.route('/check', methods=['GET'])
def check():
    pass

@app.route('/reset', methods=['GET'])
def reset():
    my_game.reset_game()
    return Response(status=200)

## IDEA
@app.route('/GETSCORES', methods=['POST'])
def get_scores():
    pass


def main():
    ## ASUS Router
    # app.run(host='192.168.50.79', port=5555, debug=True)

    ## Postman
    app.run(host='127.0.0.1', port=5555, debug=True)
   


if __name__ == '__main__':
    main()
        
        
