#include<stdio.h>
#include<stdlib.h>
#include "domain/domain.h"
#include "vector/vector.h"
#include "UI/UI.h"
#include "repository/repository.h"
#include "controller/controller.h"
#include "undo_module/undo_controller/undo_controller.h"
#include "undo_module/function_call/functioncall.h"
#include "undo_module/operation/operation.h"
#include<string.h>
#include "tests/tests.h"


void add_materials(Controller* controller){
    char* name;
    char* supplier;
    name = (char*)malloc(255);
    supplier = (char*)malloc(255);
    strcpy(name,"Water");
    strcpy(supplier,"Bucovina");
    _Controller_add(controller,name,supplier,20,2,3,2025);
    name = (char*)malloc(255);
    supplier = (char*)malloc(255);
    strcpy(name,"Water");
    strcpy(supplier,"Dorna");
    _Controller_add(controller,name,supplier,5,16,10,2026);
    name = (char*)malloc(255);
    supplier = (char*)malloc(255);
    strcpy(name,"Flour");
    strcpy(supplier,"Boromir");
    _Controller_add(controller,name,supplier,25,16,10,2023);
    name = (char*)malloc(255);
    supplier = (char*)malloc(255);
    strcpy(name,"Flour");
    strcpy(supplier,"Titan");
    _Controller_add(controller,name,supplier,25,4,1,2023);
    name = (char*)malloc(255);
    supplier = (char*)malloc(255);
    strcpy(name,"Sugar");
    strcpy(supplier,"Margarita");
    _Controller_add(controller,name,supplier,25,7,11,2021);
    name = (char*)malloc(255);
    supplier = (char*)malloc(255);
    strcpy(name,"Sugar");
    strcpy(supplier,"Diamant");
    _Controller_add(controller,name,supplier,125,23,10,2021);
    name = (char*)malloc(255);
    supplier = (char*)malloc(255);
    strcpy(name,"Rum Extract");
    strcpy(supplier,"Diamant");
    _Controller_add(controller,name,supplier,65,23,10,2021);
    name = (char*)malloc(255);
    supplier = (char*)malloc(255);
    strcpy(name,"Vanilla Extract");
    strcpy(supplier,"Diamant");
    _Controller_add(controller,name,supplier,45,23,10,2025);
    name = (char*)malloc(255);
    supplier = (char*)malloc(255);
    strcpy(name,"Apples");
    strcpy(supplier,"Eco Fruits");
    _Controller_add(controller,name,supplier,95,4,9,2021);
    name = (char*)malloc(255);
    supplier = (char*)malloc(255);
    strcpy(name,"Plums");
    strcpy(supplier,"Eco Fruits");
    _Controller_add(controller,name,supplier,15,22,11,2021);
}

int main()
{   
    testAll();
    Repository* repository = _Repository_Constructor();
    UndoController* undo_controller = _UndoController_Constructor();
    Controller* controller = _Controller_Constructor(repository,undo_controller);
    UI ui = _UI_Constructor(controller);
    add_materials(controller);
    _UI_start(&ui);
    
    return 0;
}