import { LatLng } from "leaflet"; import { ItemFormPopupProps } from "./Components/Map/Subcomponents/ItemFormPopup"; export interface UtopiaMapProps { height?: string, width?: string, center?: LatLng, zoom?: number, tags?: Tag[], children?: React.ReactNode, } export interface LayerProps { data?: Item[], children?: React.ReactNode, name: string, menuIcon: string, menuColor: string, menuText: string, markerIcon: string, markerShape: string, markerDefaultColor: string, api?: ItemsApi, setItemFormPopup?: React.Dispatch>, itemFormPopup?: ItemFormPopupProps | null } export class Item { id: string ; name: string; text: string; position: Geometry; date_created?: string; date_updated?: string | null; start?: string; end?: string; api?: ItemsApi; tags?: Tag[]; [key: string]: any; constructor(id:string,name:string,text:string,position:Geometry, layer?: LayerProps, api?: ItemsApi){ this.id = id; this.name = name; this.text = text; this.position = position; this.layer = layer; this.api = api; } } export class Geometry { type: string; coordinates: number[]; constructor(lng: number, lat: number) { this.coordinates = [lng,lat]; this.type = "Point"; } } export interface Tag { color: string; id: string; } export interface ItemsApi { getItems(): Promise, createItem?(item : T): Promise, updateItem?(item : T): Promise, deleteItem?(id : number | string): Promise, } export interface UserApi { register(email: string, password: string, userName: string): Promise, login(email: string, password: string): Promise, logout(): Promise, getUser(): Promise, getToken(): Promise, updateUser(user: UserItem): Promise } export type UserItem = { id?: string; avatar: string; first_name: string; description: string; email: string; password?: string; }