import { dataBuilder } from "@helpers/datas/dataBuilder"; import { lorem } from "@helpers/ui/lipsum"; import { type Licence, RDFTYPE_LICENCE } from "@src/rdf"; export const licence: Licence = { "@id": "store://local.sample-object/licences/1/", "@type": RDFTYPE_LICENCE, creation_date: "2024-11-11T12:54:52.359000Z", update_date: "2024-11-14T08:04:47.631017Z", name: "Sample Licence", short_desc: "Sample Short Description", description: "Sample Description", url: "https://example.com", }; export const get_random_licence = (): Licence => { const removables: string[] = []; const replacements: Licence = { "@id": `store://local.sample-object/${Math.floor(Math.random() * 1000)}/`, creation_date: new Date( Date.now() - Math.random() * 365 * 24 * 60 * 60 * 1000, ).toISOString(), update_date: new Date( Date.now() - Math.random() * 30 * 24 * 60 * 60 * 1000, ).toISOString(), name: lorem.generateSentences(1), short_desc: lorem.generateSentences(Math.floor(Math.random() * 2) + 1), description: lorem.generateParagraphs(Math.floor(Math.random() * 2) + 1), url: `https://example.com/${Math.floor(Math.random() * 1000)}`, }; const removableGenerator = (key: string) => { // Between 0 and 25% chance if (Math.random() < Math.random() * 0.25) { removables.push(key); } }; removableGenerator("name"); removableGenerator("short_desc"); removableGenerator("description"); removableGenerator("url"); return dataBuilder(licence, removables, replacements, true) as Licence; };