#pragma once
#include "../vector/vector.h"
#include "../domain/domain.h"

typedef struct {
    Vector* elements;
} Repository;

/*
    Constructor for the Repository
    Input: -
    Output: a pointer to the newly created repository
*/
Repository* _Repository_Constructor();

/*
    Destructor for the Repository
    Input: repository - Repository*
    Output: -
*/
void _Repository_Destructor(Repository* repository);

/*
    Adds an element to the repository
    Input: repository - Repository*
           material - Material* - the element to be added
    Output: 1 - if the element was added
            0 - if the element was not added
*/
int _Repository_add(Repository* repository, Material* material);

/*
    Deletes an element from the repository
    Input: repository - Repository*
           material - Material* - the element to be deleted
    Output: 1 - if the element was deleted
            0 - if the element was not deleted
*/
int _Repository_delete(Repository* repository, Material* material);

/*
    Updates an element from the repository
    Input: repository - Repository*
           material - Material* - the element to be updated
    Output: 1 - if the element was updated
            0 - if the element was not updated
*/
int _Repository_update(Repository* repository, Material* material);

/*
    Gets the lenght of the repository
    Input: repository - Repository*
    Output: int - the lenght of the repository
*/
int _Repository_getLenght(Repository* repository);

/*
    Gets an element from the repository
    Input: repository - Repository*
           index - int - the index of the element to be returned
    Output: Material* - the element at the given index
            NULL - if the element was not found
*/
Material* _Repository_getItem(Repository* repository,int index);
