import { msg } from "@lit/localize"; import type { DateTime, LimitedResource, Resource, User } from "@src/tems"; if ( !window.orbit && !import.meta.env.STORYBOOK && !import.meta.env.BASE_URL.includes("cypress") ) { await new Promise((resolve) => { document.addEventListener("orbit-ready", () => { resolve(true); }); }); } export const RDFTYPE_TEMS = window.orbit?.client.rdf_tems_scope || "https://tems-dataspace.eu/owl#"; export interface NamedResource extends LimitedResource { name: string | null; } export const RDFTYPE_IMAGE = `${RDFTYPE_TEMS}Image`; export interface Image extends NamedResource { url: string | null; iframe: boolean | null; } export const RDFTYPE_LICENCE = `${RDFTYPE_TEMS}Licence`; export interface Licence extends NamedResource { short_desc: string | null; description: string | null; url: string | null; } export const RDFTYPE_ASSET = `${RDFTYPE_TEMS}Asset`; export interface Asset extends NamedResource { size: string | null; format: NamedResource | null; categories: NamedResource[] | null; } export const RDFTYPE_LOCATION = `${RDFTYPE_TEMS}Location`; export interface Location extends NamedResource { address: string | null; city: string | null; state: string | null; country: string | null; latitude: string | null; longitude: string | null; elevation: number | null; } export const RDFTYPE_SERVICE = `${RDFTYPE_TEMS}Service`; export interface Service extends NamedResource { description: string | null; long_description: string | null; categories: NamedResource[] | null; activation_status: boolean | null; activation_date: DateTime | null; licence: Licence | null; is_in_app: boolean | null; is_external: boolean | null; is_api: boolean | null; images: Image[] | null | []; release_date: DateTime | null; last_update: DateTime | null; developper: Image | null; contact_url: string | null; documentation_url: string | null; } export const RDFTYPE_OFFER = `${RDFTYPE_TEMS}Offer`; export interface Offer extends NamedResource { description: string | null; kind: "subscription" | "purchase"; } export const RDFTYPE_DATAOFFER = `${RDFTYPE_TEMS}DataOffer`; export interface DataOffer extends NamedResource { description: string | null; provider: Provider | null; services: Service[] | null | []; offers: Offer[] | null | []; image: Image | null; categories: NamedResource[] | null; } export const RDFTYPE_PROVIDER = `${RDFTYPE_TEMS}Provider`; export interface Provider extends NamedResource { description: string | null; data_offers: DataOffer[] | null | []; services: Service[] | null | []; contact_url: string | null; image: Image | null; categories: NamedResource[] | null; } export const RDFTYPE_OBJECT = `${RDFTYPE_TEMS}Object`; export interface TemsObject extends LimitedResource { title: string | null; description: string | null; copyright: string | null; website: string | null; licences: Licence[] | null; images: Image[] | null | []; providers: Provider[] | null | []; owners?: User[]; } export const RDFTYPE_MEDIA_OBJECT = `${RDFTYPE_TEMS}MediaObject`; export interface Object_MediaObject extends TemsObject { keywords: NamedResource[] | null | []; assets: Asset[] | null | []; publication_date: DateTime | null; language: NamedResource | null; } export const RDFTYPE_FACT_CHECKING_OBJECT = `${RDFTYPE_TEMS}FactChecking`; export interface Object_MediaObject_FactChecking extends Object_MediaObject { location: Location | null; organisation: string | null; person: string | null; version: string | null; affiliation: NamedResource | null; topics: NamedResource[] | null | []; } export const RDFTYPE_SOCIETY_OBJECT = `${RDFTYPE_TEMS}CivilSociety`; export interface Object_MediaObject_CivilSociety extends Object_MediaObject { editor: string | null; original_languages: string | null; contributors: string | null; publication_service: string | null; type: NamedResource | null; } export const RDFTYPE_STORIES_OBJECT = `${RDFTYPE_TEMS}Story`; export interface Object_MediaObject_Stories extends Object_MediaObject { editor: string | null; original_languages: string | null; contributors: string | null; publication_service: string | null; type: NamedResource | null; } export const RDFTYPE_INTERACTIVE_INFOGRAPHICS_OBJECT = `${RDFTYPE_TEMS}InteractiveInfographic`; export interface Object_MediaObject_InteractiveInfographics extends Object_MediaObject { instruction: string | null; } export const RDFTYPE_3D_OBJECT = `${RDFTYPE_TEMS}3DObject`; export interface Object_3DObject extends TemsObject { keywords: NamedResource[] | null | []; categories: NamedResource[] | null; time_period: string | null; country: string | null; location: Location | null; actual_representation: string | null; format: NamedResource | null; file_size: string | null; year: number | null; texture: string | null; texture_formats: string | null; texture_resolution: string | null; polygons: number | null; is_low_polygons?: boolean | null; // < 10k ai: boolean | null; allow_ai: boolean | null; prices: string | null; rights_holder: string | null; creator: string | null; } export const RDFTYPE_SENTIMENT = `${RDFTYPE_TEMS}Sentiment`; export interface Sentiment extends LimitedResource { keyword: string; location: Location | null; iframe: string; topics: NamedResource[] | null | []; providers: Provider[] | null | []; } export interface ValidM18Object { object: Resource; } const typeMap: Record = {}; typeMap[RDFTYPE_3D_OBJECT] = msg("3D Object"); typeMap[RDFTYPE_FACT_CHECKING_OBJECT] = msg("Fact Checking"); typeMap[RDFTYPE_SOCIETY_OBJECT] = msg("Civil Society"); typeMap[RDFTYPE_STORIES_OBJECT] = msg("Story"); typeMap[RDFTYPE_INTERACTIVE_INFOGRAPHICS_OBJECT] = msg("Interactive Infographic"); typeMap[RDFTYPE_3D_OBJECT] = msg("3D Object"); export { typeMap };