from HCR import *
from PIR import *
from DataList import DataList
from File import File
from MySQL import *
from MongoDB import *
import sys

try:
    file = File.readData()
except Exception as e:
    file = []

newSQL = MySQL()
newMongo = MongoDB()
newSQL.Conexion()
newMongo.mongoConexion()

sensorList = newSQL.getSensors()


class Sensors:

    def __init__(self):
        self.instancesList = DataList()
        self.createInstances()

    def createInstances(self):
        for o in sensorList:
            if self.instancesList.getData(None, o['name']) is None:
                if o['name'][0:3] == 'dht':
print("-------Club Deportivo--------")
print("| 1 | Registrar Persona     |")
print("| 2 | Guardar Persona       |")
print("| 3 | Registrar prestamo    |")
print("| 4 | Registrar Productos   |")
print("| 5 | Guardar Prestamo      |")
print("| 6 | Registrar Devolución  |")
print("| 7 | Crear Excel Personas  |")
print("| 8 | Crear Excel Prestamos |")
print("| 9 | Crear Excel Materiales|")
print("| 10| Cerrar Aplicación     |")
print("-----------------------------")
#Conexion a base de datos
newdb = MySQL()
print(newdb.Conexion())
newdb.createTablePerson()
newdb.createTablaMateriales()
#------------------------------
#Conexion a MongoDB
newMongo = MongoDB()
print(newMongo.mongoConexion())

newMongo.createDataBase(input("Ingresa el nombre de la base de Datos: "))
newMongo.crearTabla(input("Ingresa el nombre de la Tabla: "))
newMongo.actualizarFecha(int(input("Ingresa el ID: ")))
print(newMongo.actualizarFecha)
#------------------------------
numero = 0
respuesta = "s"
#--------------------------------------------------------------------------------------