from ui.ui import ui
from repositories.textfile import TextFileRepository
from repositories.memory import MemoryRepository
from repositories.binaryfile import BinaryFileRepository
from repositories.jsonfile import JsonFileRepository
from repositories.database import DatabaseRepository

if __name__=="__main__":
    repos={
    "textfile":TextFileRepository,
    "memory":MemoryRepository,
    "binaryfile":BinaryFileRepository,
    "jsonfile":JsonFileRepository,
    "database":DatabaseRepository
    }
    repo=None
    with open("src/settings.properties") as f:
        for line in f:
            if line.strip().startswith("repository"):
                repo=repos.get(line.split("\"",3)[1].strip(),MemoryRepository)()
                break
    ui=ui(repo)
    ui()


