import type { Node, Edge } from '@xyflow/react'; import type { NPCConfiguration, DialogueConfiguration } from './npc'; // Define the types of nodes available in the modular system export type NodeType = | 'basicInfo' | 'battleConfig' | 'party' | 'interaction' | 'variables' | 'dialogue' | 'output'; // Data structure for each node type export interface BasicInfoNodeData extends Record { type: 'basicInfo'; resourceIdentifier: string; names: string[]; hitbox: string | { width: number; height: number }; modelScale?: number; aspects?: string[]; isInvulnerable?: boolean; canDespawn?: boolean; isMovable?: boolean; isLeashable?: boolean; allowProjectileHits?: boolean; hideNameTag?: boolean; } export interface BattleConfigNodeData extends Record { type: 'battleConfig'; canBattle?: boolean; canChallenge?: boolean; battleTheme?: string; victoryTheme?: string; defeatTheme?: string; simultaneousBattles?: boolean; healAfterwards?: boolean; } export interface PartyNodeData extends Record { type: 'party'; partyConfig: NPCConfiguration['party']; } export interface InteractionNodeData extends Record { type: 'interaction'; interactionType: string; interactionData?: Record; dialogueReference?: string; scriptReference?: string; } export interface VariablesNodeData extends Record { type: 'variables'; configVariables: NPCConfiguration['config']; } export interface DialogueNodeData extends Record { type: 'dialogue'; dialogueConfig: DialogueConfiguration | null; } export interface OutputNodeData extends Record { type: 'output'; previewData?: NPCConfiguration; } // Union type for all node data types export type ModularNodeData = | BasicInfoNodeData | BattleConfigNodeData | PartyNodeData | InteractionNodeData | VariablesNodeData | DialogueNodeData | OutputNodeData; // Extended Node type with our custom data export type ModularNode = Node; // Workflow state that contains all nodes and edges export interface WorkflowState { nodes: ModularNode[]; edges: Edge[]; npcConfig: NPCConfiguration; dialogueConfig: DialogueConfiguration | null; } // Node template for creating new nodes export interface NodeTemplate { type: NodeType; label: string; icon: string; description: string; color: string; defaultData: Partial; }