#pragma once
#include "../../repository/repository.h"

class AdminController {
    private:
        Repository* _repo;
    public:

        /*
        * Constructor for the AdminController class
        * Input: repo - Repository object
        * Output: adminController object
        */
        AdminController(Repository* repo);

        /*
        * Destructor for the AdminController class
        * Input: -
        * Output: -
        */
        ~AdminController();

        /*
        * Adds a trench coat to the repository
        * Input: size - integer
        *      colour - string
        *     price - integer
        *   quantity - integer
        * photograph - string
        * Output: -
        * Throws: AdminControllerException if: size<=0
        *                                      colour is empty  
        *                                      price<=0
        *                                      quantity<0
        *                                      photograph is empty
        *                                     trench coat already exists
        */
        void add(int size,const char* colour,int price,int quantity,const char* photograph);

        /*
        * Removes a trench coat from the repository
        * Input: size - integer
        *     colour - string
        * photograph - string
        * Output: -
        * Throws: AdminControllerException if: size<=0
        *                                     colour is empty
        *                                    photograph is empty
        *                                   trench coat does not exist
        */
        void remove(int size,const char* colour,const char* photograph);

        /*
        * Removes a trench coat from the repository
        * Input: index - integer
        * Output: -
        * Throws: RepoException if: index is out of bounds
        */
        void remove(int index);

        /*
        * Updates a trench coat from the repository. If the price or quantity is -1, it will not be updated
        * Input: size - integer
        *    colour - string
        *    price - integer
        * quantity - integer
        * photograph - string
        * Output: -
        * Throws: AdminControllerException if: size<=0
        *                                    colour is empty
        *                                   price!=-1 and price<=0
        *                                 quantity!=-1 and quantity<0
        *                               photograph is empty
        *                             trench coat does not exist
        */
        void update(int size,const char* colour,int price,int quantity,const char* photograph);

        /*
        * Returns the index of a trench coat in the repository. If it does not exist, it returns -1
        * Input: size - integer
        *    colour - string
        * photograph - string
        * Output: index - integer
        */
        int get(int size,const char* colour,const char* photograph);

        /*
        * Returns the number of trench coats in the repository
        * Input: -
        * Output: size - integer
        */
        int size();

        /*
        * Returns the trench coat at the given index
        * Input: index - integer
        * Output: trench coat - Trench object
        * Throws: RepoException if: index is out of bounds
        */
        Trench*& operator[](int index);

        /*
        * Returns an iterator for all the trench coats in the repository
        * Input: -
        * Output: iterator
        */
        Repository* getAll();
        
};