/**
 * @brief Classes for making square Sierpinski carpet.
 * 
 * @author Yunhai Li (liyunhai1016@hotmail.com)
 * 
 * @copyright Copyright (c) 2025, TBPLaS develop team.
 */
#ifndef TBPLAS_TESTS_MASK_H
#define TBPLAS_TESTS_MASK_H

#include <list>

#include "base/datatypes.h"
#include "builder/primitive.h"

namespace tbplas::tests {
using base::complex_t;
using builder::Orbital;
using builder::PrimitiveCell;
using model_t = PrimitiveCell<complex_t>;

class Box {
public:
    int i0 = 0;
    int j0 = 0;
    int i1 = 0;
    int j1 = 0;
    bool empty = false;

    explicit Box(
        const int& pi0,
        const int& pj0,
        const int& pi1,
        const int& pj1,
        const bool& pempty)
        : i0(pi0)
        , j0(pj0)
        , i1(pi1)
        , j1(pj1)
        , empty(pempty)
    {
    }
};

class Mask {
private:
    std::list<Box> boxes_;
    int num_grid_ = 0;

public:
    explicit Mask(const Box& starting_box, int num_grid, int num_iter);
    [[nodiscard]] std::list<Box> partition_box(const Box& box) const;
    void etch_prim_cell(model_t& prim_cell, const int& width) const;
    void etch_orbitals(std::vector<Orbital>& orbital_list, const int& width) const;
};
} // namespace tbplas::tests
#endif