#pragma once

#include <functional>
#include <map>
#include <optional>
#include <string>
#include <vector>

#include <fesa/core/source_location.hpp>

namespace fesa {

struct DeckRecord final {
    std::string keyword;
    std::map<std::string, std::string, std::less<>> parameters;
    std::vector<std::vector<std::string>> data;
    SourceLocation source;
    std::vector<SourceLocation> data_sources;
};

struct ParsedPart final {
    std::string name;
    std::vector<DeckRecord> records;
    SourceLocation source;
};

struct ParsedInstance final {
    std::string name;
    std::string part_name;
    std::vector<std::vector<std::string>> transform_data;
    std::vector<SourceLocation> transform_sources;
    SourceLocation source;
};

struct ParsedAssembly final {
    std::string name;
    std::vector<ParsedInstance> instances;
    std::vector<DeckRecord> records;
    SourceLocation source;
};

struct ParsedDeck final {
    std::vector<DeckRecord> global_records;
    std::vector<ParsedPart> parts;
    std::optional<ParsedAssembly> assembly;
};

}  // namespace fesa
