#pragma once

#include "DeepPluckFactoryCategories.h"
#include "DeepPluckPresetCodec.h"
#include <functional>
#include <vector>

namespace deeppluck
{
struct FactoryContentEntry
{
    juce::String stableId, category, name, author, version, relativePath, sha256;
    DeepPluckParameterValues values {};
};

struct FactoryLibrary
{
    std::vector<FactoryContentEntry> entries;
    bool awaitingCuration = true;
    juce::String error;
};

using FactoryFileReader = std::function<juce::String (const juce::String& relativePath)>;
// Control-thread only. Empty technical catalogue is legal; requireFinal rejects it.
[[nodiscard]] bool validateFactoryLibrary (
    const juce::AudioProcessorValueTreeState& state, const juce::String& manifest,
    const FactoryFileReader& readFile, bool requireFinal, FactoryLibrary& result);
[[nodiscard]] FactoryLibrary loadEmbeddedFactoryLibrary (const juce::AudioProcessorValueTreeState& state);
}
