//  ************************************************************************************************
//
//  BornAgain: simulate and fit reflection and scattering
//
//! @file      Sample/Multilayer/LayerStack.h
//! @brief     Defines class LayerStack.
//!
//! @homepage  http://www.bornagainproject.org
//! @license   GNU General Public License v3 or higher (see COPYING)
//! @copyright Forschungszentrum Jülich GmbH 2024
//! @authors   Scientific Computing Group at MLZ (see CITATION, AUTHORS)
//
//  ************************************************************************************************

#ifndef BORNAGAIN_SAMPLE_MULTILAYER_LAYERSTACK_H
#define BORNAGAIN_SAMPLE_MULTILAYER_LAYERSTACK_H

#include "Sample/Multilayer/ILayer.h"
#include <memory>
#include <vector>

class Layer;

class LayerStack : public ILayer {
public:
    LayerStack(size_t num_periods = 1);
    ~LayerStack() override;

    void addLayer(const Layer& layer);
    void addStack(const LayerStack& substack);

#ifndef SWIG
    LayerStack* clone() const override;

    std::vector<std::unique_ptr<Layer>> flatClones() const override;
    size_t numberOfPeriods() const { return m_n_periods; }

    const std::vector<std::unique_ptr<const ILayer>>& sublayers() const { return m_sublayers; }

private:
    void addSublayer(const ILayer& sublayer);

    const size_t m_n_periods;
    std::vector<std::unique_ptr<const ILayer>> m_sublayers;
#endif // SWIG
};

#endif // BORNAGAIN_SAMPLE_MULTILAYER_LAYERSTACK_H
