import React from 'react';

/*
	Context for the new resource viewer. Please consult which properties are always available and which
	functions can be called by all child components at all times.

	Note: the ResourceViewer is the provider of this context and uses it's state to keep the context updated

	Note: components that also (can) exist outside this context should still receive certain properties via the props
*/

export const ResourceViewerContext = React.createContext({
    contextChange: null, // fill in this field to give a hint to components what has been changed to the context
    singleResource: null, // just show a single resource instead of a result set
    mediaEvents: null, // Used for communication between media player and components

    recipe: null, // TODO remove later, now still used by the AVPlayer
    user: null, // who is viewing the resource
    userProjects: null, // a list of user projects
    query: null, // the user's query before arriving at this resource
    collectionConfig: null, // mapping functions for the resource (unique instance per collection)
    resource: null, // main object to be displayed in the resource viewer; instance of SearchResult

    activeProject: null, // which project is active
    setActiveProject: project => {
        console.debug('implement this context function in the ResourceViewer');
    },
    activeMediaObject: null, // which media object is active
    setActiveMediaObject: (mediaObject, segment) => {
        console.debug('implement this context function in the ResourceViewer');
    },

    annotationClient: null //any component can call the annotation client for doing annotation stuff
});
