import { Css, Position as CyPosition } from 'cytoscape';
import { FC } from 'react';
import { GraphModel } from '../GraphModel';
export interface ModelItem {
    id: string;
    attributes: ModelAttributeSet;
}
export interface ModelNode extends ModelItem, Partial<NodeDecoration> {
}
export interface ModelEdge extends ModelItem, Partial<EdgeDecoration> {
    source: string;
    target: string;
}
export declare type ModelAttributeSet = Record<string, ModelAttributeValue>;
export declare type ModelAttributeValue = unknown;
export declare type ModelGraphData = {
    nodes: Record<string, ModelNode>;
    edges: Record<string, ModelEdge>;
};
export interface GraphRenderer<O extends GraphRendererOptions> {
    render: FC<{
        graphModel: GraphModel;
        onChange: (model: GraphModel | ((model2: GraphModel) => GraphModel)) => void;
        onViewNode?: (node: DecoratedNode) => void;
        options: O;
    }>;
    defaultOptions: O;
    layouts: PresetGraphLayout[];
}
export interface GraphRendererOptions {
    width?: number | 'full-width';
    height: number | 'full-height';
}
export interface ItemDecoration {
    label?: string;
    size: number;
    color: string;
    opacity: number;
}
export interface NodeDecoration extends ItemDecoration {
    icon?: string;
    shape: NodeShape;
    strokeColor: string;
    strokeSize: number;
}
export interface EdgeDecoration extends ItemDecoration {
    sourceArrow: boolean;
    targetArrow: boolean;
    style: EdgeStyle;
}
export interface DecorationFunction<T extends ItemDecoration, S = Partial<T>> {
    (): S;
}
export declare type NodeDecorationFunction = DecorationFunction<NodeDecoration>;
export declare type EdgeDecorationFunction = DecorationFunction<EdgeDecoration>;
export interface NodeDecorationCreator {
    getDecorationOverrides: NodeDecorationFunction;
}
export interface EdgeDecorationCreator {
    getDecorationOverrides: EdgeDecorationFunction;
}
export declare type DecoratedNode = ModelNode & NodeDecorationCreator;
export declare type DecoratedEdge = ModelEdge & EdgeDecorationCreator;
export declare type NodeDecorator = (node: ModelNode) => Partial<NodeDecoration>;
export declare type EdgeDecorator = (edge: ModelEdge) => Partial<EdgeDecoration>;
export declare type NodeShape = Css.NodeShape;
export declare type EdgeStyle = Css.LineStyle;
export declare type PresetGraphLayout = 'force-directed' | 'circle' | 'grid' | 'cola';
export interface CustomGraphLayout {
    name: string;
    runLayout(model: GraphModel, options: GraphLayoutOptions): Record<string, NodePosition>;
    stopLayout(): void;
}
export declare type GraphLayout = PresetGraphLayout | CustomGraphLayout;
export declare type NodePosition = CyPosition;
export interface GraphLayoutOptions {
    boundingBox: BoundingBox;
}
export interface BoundingBox {
    x1: number;
    y1: number;
    w: number;
    h: number;
}
export declare type GraphCommand = ZoomInCommand | ZoomOutCommand | RefitCommand | LayoutCommand;
export interface ZoomInCommand {
    type: 'ZoomIn';
}
export interface ZoomOutCommand {
    type: 'ZoomOut';
}
export interface RefitCommand {
    type: 'Refit';
}
export interface LayoutCommand {
    type: 'Layout';
}
export interface JSONGraphNode {
    label?: string;
    metadata?: Record<string, unknown>;
}
export interface JSONGraphEdge {
    id?: string;
    source: string;
    target: string;
    relation?: string;
    directed?: boolean;
    label?: string;
    metadata?: Record<string, unknown>;
}
export interface JSONGraph {
    nodes: Record<string, JSONGraphNode>;
    edges: JSONGraphEdge[];
}
export interface JSONGraphData {
    graph?: JSONGraph;
    graphs?: JSONGraph[];
}
