diff --git a/frontend/src/types/index.ts b/frontend/src/types/index.ts index b44ccc84..e301c06e 100644 --- a/frontend/src/types/index.ts +++ b/frontend/src/types/index.ts @@ -98,3 +98,4 @@ export * from './script-builder' export * from './integrations' export * from './notification' export type * from './public-templates' +export * from './network-diagram' diff --git a/frontend/src/types/network-diagram.ts b/frontend/src/types/network-diagram.ts new file mode 100644 index 00000000..cfca8cc0 --- /dev/null +++ b/frontend/src/types/network-diagram.ts @@ -0,0 +1,130 @@ +export interface DeviceProperties { + hostname: string | null + ip: string | null + subnet: string | null + vendor: string | null + model: string | null + role: string | null + vlan: string | null + notes: string | null + status: 'unknown' | 'online' | 'offline' | 'degraded' +} + +export interface DiagramNode { + id: string + type: string + label: string + position: { x: number; y: number } + properties: DeviceProperties +} + +export interface DiagramEdge { + id: string + source: string + target: string + label: string | null + connectionType: string + speed: string | null + notes: string | null +} + +export interface DeviceTypeResponse { + id: string + slug: string + label: string + category: string + is_system: boolean + team_id: string | null + sort_order: number + created_at: string +} + +export interface DeviceTypeCreate { + slug: string + label: string + category: string + sort_order?: number +} + +export interface NetworkDiagramResponse { + id: string + team_id: string + name: string + client_name: string | null + asset_name: string | null + description: string | null + nodes: DiagramNode[] + edges: DiagramEdge[] + thumbnail_url: string | null + is_archived: boolean + created_by: string | null + created_at: string + updated_at: string +} + +export interface NetworkDiagramListItem { + id: string + name: string + client_name: string | null + description: string | null + node_count: number + created_by: string | null + created_at: string + updated_at: string +} + +export interface NetworkDiagramCreate { + name: string + client_name?: string | null + asset_name?: string | null + description?: string | null + nodes?: DiagramNode[] + edges?: DiagramEdge[] +} + +export interface NetworkDiagramUpdate { + name?: string + client_name?: string | null + asset_name?: string | null + description?: string | null + nodes?: DiagramNode[] + edges?: DiagramEdge[] +} + +export interface AIGenerateRequest { + description: string + client_name?: string | null + mode: 'replace' | 'merge' + existingBounds?: { minX: number; maxX: number; minY: number; maxY: number } | null +} + +export interface AIGenerateResponse { + nodes: DiagramNode[] + edges: DiagramEdge[] + suggestedName: string | null + notes: string | null +} + +export interface DiagramImportData { + schemaVersion: number + name: string + client_name?: string | null + description?: string | null + nodes: DiagramNode[] + edges: DiagramEdge[] +} + +export interface DiagramImportResponse { + diagram: NetworkDiagramResponse + warnings: string[] +} + +export interface DiagramExportResponse { + schemaVersion: number + name: string + client_name: string | null + description: string | null + nodes: DiagramNode[] + edges: DiagramEdge[] + exportedAt: string +}