/**
 * @file BagInterface.h
 * @authors Created by Frank M. Carrano and Timothy M. Henry
 *          Modifications/updates by Jim Daehn <jdaehn@missouristate.edu>
 *          TODO: Add your name here
 * @brief Listing 1-1.
 * @version 0.1
 * @date 2021-09-08
 * 
 * @copyright Copyright (c) 2017 Pearson Education, Hoboken, New Jersey.
 * 
 */

#ifndef BAG_INTERFACE_
#define BAG_INTERFACE_

#include <random>  // Added for pseudo-random number generation needed for Part 2
#include <vector>

template <class ItemType>
class BagInterface
{
public:
    /**
     * @brief Gets the current number of entries in this bag.
     * 
     * @return The integer number of entries currently in the bag. 
     */
    virtual int getCurrentSize() const = 0;

    /**
     * @brief Sees whether this bag is empty.
     * 
     * @return True if the bag is empty, or false if not.
     */
    virtual bool isEmpty() const = 0;

    /**
     * @brief Adds a new entry to this bag.
     * @post If successful, newEntry is stored in the bag and the 
     *       count of items in the bag has increased by 1.
     * 
     * @param newEntry The object to be added as a new entry.
     * @return True if addition was successful, or false if not.
     */
    virtual bool add(const ItemType &newEntry) = 0;

    /**
     * @brief Removes one occurrence of a given entry from this bag, 
     *        if possible.
     * @post  If successful, anEntry has been removed from the bag
              and the count of items in the bag has decreased by 1.

     * @param anEntry The entry to be removed.
     * @return True if removal was successful, or false if not. 
     */
    virtual bool remove(const ItemType &anEntry) = 0;

    /**
     * @brief TODO: Part 2a - Declare a new pure virtual member function named
     *        remove that has a return type of ItemType and no parameters.
     * 
     * @return A randomly removed item from this bag.
     */


    /**
     * @brief Removes all entries from this bag.
     * @post  Bag contains no items, and the count of items is 0.
     * 
     */
    virtual void clear() = 0;

    /**
     * @brief Counts the number of times a given entry appears in bag.
     * 
     * @param anEntry The entry to be counted.
     * @return The number of times anEntry appears in the bag.
     */
    virtual int getFrequencyOf(const ItemType &anEntry) const = 0;

    /**
     * @brief Tests whether this bag contains a given entry.
     * 
     * @param anEntry The entry to locate.
     * @return True if bag contains anEntry, or false otherwise.
     */
    virtual bool contains(const ItemType &anEntry) const = 0;

    /**
     * @brief Empties and then fills a given vector with all entries that
              are in this bag.
     * 
     * @return A vector containing all the entries in the bag. 
     */
    virtual std::vector<ItemType> toVector() const = 0;

    /**
     * @brief Destroy the Bag Interface object
     * 
     */
    virtual ~BagInterface() = default;

}; // end BagInterface
#endif
