import React from 'react';

import { ModelInstance } from './createModel';

export type ModelsContextType = Record<string, ModelInstance<any>>;

export const ModelsProvider: React.FC<{
    children: React.ReactNode;
    models: ModelsContextType;
}> = ({ children, models }) => {
    return (
        <>
            {Object.entries(models).map(([key, { Provider }]) => (
                <Provider key={key}>{children}</Provider>
            ))}
        </>
    );
};
