import { dataBuilder } from "@helpers/datas/dataBuilder"; import { lorem } from "@helpers/ui/lipsum"; import type { objectParameters } from "@mocks/object.mock"; import { get_random_mediaObject, sampleMediaObject, } from "@mocks/objects/mediaObject.mock"; import { type Object_MediaObject_InteractiveInfographics, RDFTYPE_INTERACTIVE_INFOGRAPHICS_OBJECT, RDFTYPE_MEDIA_OBJECT, RDFTYPE_OBJECT, } from "@src/rdf"; export const sampleInteractiveInfographicsObject: Object_MediaObject_InteractiveInfographics = { ...sampleMediaObject, "@type": [ RDFTYPE_OBJECT, RDFTYPE_MEDIA_OBJECT, RDFTYPE_INTERACTIVE_INFOGRAPHICS_OBJECT, ], instruction: "Sample Instruction", }; export const get_random_interactiveInfographicsObject = ( parameters: objectParameters = {} ): Object_MediaObject_InteractiveInfographics => { const removables: string[] = []; const replacements: Object_MediaObject_InteractiveInfographics = { ...get_random_mediaObject(parameters), "@type": [ RDFTYPE_OBJECT, RDFTYPE_MEDIA_OBJECT, RDFTYPE_INTERACTIVE_INFOGRAPHICS_OBJECT, ], instruction: lorem.generateSentences(1), }; if (parameters.allowRemovables) { const removableGenerator = (key: string) => { // Between 0 and 25% chance if (Math.random() < Math.random() * 0.25) { removables.push(key); } }; removableGenerator("instruction"); } return dataBuilder( sampleInteractiveInfographicsObject, removables, replacements, true ) as Object_MediaObject_InteractiveInfographics; };