//
// Created by Kyle Cook on 4/9/17.
//

#ifndef AG_GEN_ASSET_GROUP_H
#define AG_GEN_ASSET_GROUP_H

#include <vector>

#include "quality.h"
#include "topology.h"

#include <boost/archive/tmpdir.hpp>
#include <boost/archive/text_iarchive.hpp>
#include <boost/archive/text_oarchive.hpp>

#include <boost/serialization/base_object.hpp>
#include <boost/serialization/utility.hpp>
#include <boost/serialization/list.hpp>
#include <boost/serialization/assume_abstract.hpp>
#include <boost/serialization/string.hpp>
#include <boost/serialization/vector.hpp>


#include <boost/serialization/is_bitwise_serializable.hpp>

/** AssetGroup class
 * @brief Holds information about multiple Assets
 * @details Holds the hypothetical qualities and topologies of
 *          multiple Assets as well as a vector of the number IDs of the Assets.
 *          It also implements a print method for the qualities and topologies
 *          and for the Assets.
 */
class AssetGroup {
    std::vector<Quality> hypothetical_qualities;
    std::vector<Topology> hypothetical_topologies;

    friend std::ostream & operator << (std::ostream &os, const AssetGroup &agr);
    friend class boost::serialization::access;

    std::vector<size_t> perm;

    template<class Archive>
    void serialize(Archive &ar, const unsigned int /* file_version */){
        ar & hypothetical_qualities & hypothetical_topologies & perm;
    }

  public:
    /**
     * @brief Constructor for AssetGroup
     * @details Initializes values of AssetGroup
     *
     * @param hypo_quals The hypothetical qualities of Assets
     * @param hypo_topos The hyptothetcial topologies of Assets
     * @param pperm IDs of the Assets
     */
    AssetGroup();
    AssetGroup(std::vector<Quality> hypo_quals,
               std::vector<Topology> hypo_topos, std::vector<size_t> pperm)
        : hypothetical_qualities(move(hypo_quals)),
          hypothetical_topologies(move(hypo_topos)), perm(move(pperm)) {}

    std::vector<size_t> get_perm() const { return perm; }

    std::vector<Quality> get_hypo_quals() const {
        return hypothetical_qualities;
    }

    std::vector<Topology> get_hypo_topos() const {
        return hypothetical_topologies;
    }

    void print_facts();
    void print_group();
    int size();
};

#endif // AG_GEN_ASSET_GROUP_H
