import type * as c4 from '@likec4/core';
import type { AstNode, AstNodeDescription, DiagnosticInfo, LangiumDocument, MultiMap } from 'langium';
import type { ConditionalPick, SetRequired, ValueOf, Writable } from 'type-fest';
import type { Diagnostic } from 'vscode-languageserver-types';
import type { LikeC4Grammar } from './generated/ast';
import * as ast from './generated/ast';
import type { IsValidFn } from './validation';
export { ast };
declare const idattr: unique symbol;
declare module './generated/ast' {
    interface Element {
        [idattr]?: c4.Fqn | undefined;
    }
    interface ElementView {
        [idattr]?: c4.ViewId | undefined;
    }
    interface DynamicView {
        [idattr]?: c4.ViewId | undefined;
    }
    interface DeploymentView {
        [idattr]?: c4.ViewId | undefined;
    }
    interface DeploymentNode {
        [idattr]?: c4.Fqn | undefined;
    }
    interface DeployedInstance {
        [idattr]?: c4.Fqn | undefined;
    }
}
type ParsedElementStyle = {
    shape?: c4.ElementShape;
    icon?: c4.IconUrl;
    color?: c4.Color;
    border?: c4.BorderStyle;
    opacity?: number;
    multiple?: boolean;
};
export interface ParsedAstSpecification {
    tags: Set<c4.Tag>;
    elements: Record<c4.ElementKind, {
        technology?: string;
        notation?: string;
        style: ParsedElementStyle;
    }>;
    relationships: Record<c4.RelationshipKind, {
        technology?: string;
        notation?: string;
        color?: c4.Color;
        line?: c4.RelationshipLineType;
        head?: c4.RelationshipArrowType;
        tail?: c4.RelationshipArrowType;
    }>;
    colors: Record<c4.CustomColor, {
        color: c4.HexColorLiteral;
    }>;
    deployments: Record<c4.DeploymentNodeKind, c4.DeploymentNodeKindSpecification>;
}
export interface ParsedAstElement {
    id: c4.Fqn;
    astPath: string;
    kind: c4.ElementKind;
    title: string;
    description?: string;
    technology?: string;
    tags?: c4.NonEmptyArray<c4.Tag>;
    links?: c4.NonEmptyArray<ParsedLink>;
    style: ParsedElementStyle;
    metadata?: {
        [key: string]: string;
    };
}
export interface ParsedAstRelation {
    id: c4.RelationId;
    astPath: string;
    source: c4.Fqn;
    target: c4.Fqn;
    kind?: c4.RelationshipKind;
    tags?: c4.NonEmptyArray<c4.Tag>;
    title: string;
    description?: string;
    technology?: string;
    color?: c4.Color;
    line?: c4.RelationshipLineType;
    head?: c4.RelationshipArrowType;
    tail?: c4.RelationshipArrowType;
    links?: c4.NonEmptyArray<ParsedLink>;
    navigateTo?: c4.ViewId;
    metadata?: {
        [key: string]: string;
    };
}
export type ParsedAstDeployment = c4.DeploymentElement;
export declare namespace ParsedAstDeployment {
    type Node = c4.DeploymentNode;
    type Instance = c4.DeployedInstance;
}
export type ParsedAstDeploymentRelation = c4.DeploymentRelation & {
    astPath: string;
};
export type ParsedAstGlobals = Writable<c4.ModelGlobals>;
export interface ParsedAstElementView {
    __: 'element';
    id: c4.ViewId;
    viewOf?: c4.Fqn;
    extends?: c4.ViewId;
    astPath: string;
    title: string | null;
    description: string | null;
    tags: c4.NonEmptyArray<c4.Tag> | null;
    links: c4.NonEmptyArray<ParsedLink> | null;
    rules: c4.ViewRule[];
    manualLayout?: c4.ViewManualLayout;
}
export interface ParsedAstDynamicView {
    __: 'dynamic';
    id: c4.ViewId;
    astPath: string;
    title: string | null;
    description: string | null;
    tags: c4.NonEmptyArray<c4.Tag> | null;
    links: c4.NonEmptyArray<ParsedLink> | null;
    steps: c4.DynamicViewStepOrParallel[];
    rules: Array<c4.DynamicViewRule>;
    manualLayout?: c4.ViewManualLayout;
}
export interface ParsedAstDeploymentView {
    __: 'deployment';
    id: c4.ViewId;
    astPath: string;
    title: string | null;
    description: string | null;
    tags: c4.NonEmptyArray<c4.Tag> | null;
    links: c4.NonEmptyArray<ParsedLink> | null;
    rules: Array<c4.DeploymentViewRule>;
}
export type ParsedAstView = ParsedAstElementView | ParsedAstDynamicView | ParsedAstDeploymentView;
export declare const ViewOps: {
    writeId<T extends ast.LikeC4View>(node: T, id: c4.ViewId): T;
    readId(node: ast.LikeC4View): c4.ViewId | undefined;
};
export interface ParsedLink {
    title?: string;
    url: string;
}
export declare const ElementOps: {
    writeId(node: ast.Element | ast.DeploymentElement, id: c4.Fqn | null): ast.DeploymentElement | ast.Element;
    readId(node: ast.Element | ast.DeploymentElement): any;
};
export interface DocFqnIndexAstNodeDescription extends AstNodeDescription {
    fqn: c4.Fqn;
}
export interface DeploymentAstNodeDescription extends AstNodeDescription {
    fqn: string;
}
export type LikeC4AstNode = ValueOf<ConditionalPick<ast.LikeC4AstType, AstNode>>;
type LikeC4DocumentDiagnostic = Diagnostic & DiagnosticInfo<LikeC4AstNode>;
export interface LikeC4DocumentProps {
    diagnostics?: Array<LikeC4DocumentDiagnostic>;
    c4Specification?: ParsedAstSpecification;
    c4Elements?: ParsedAstElement[];
    c4Relations?: ParsedAstRelation[];
    c4Globals?: ParsedAstGlobals;
    c4Views?: ParsedAstView[];
    c4Deployments?: ParsedAstDeployment[];
    c4DeploymentRelations?: ParsedAstDeploymentRelation[];
    c4fqnIndex?: MultiMap<c4.Fqn, DocFqnIndexAstNodeDescription>;
}
type LikeC4GrammarDocument = Omit<LangiumDocument<LikeC4Grammar>, 'diagnostics'>;
export interface LikeC4LangiumDocument extends LikeC4GrammarDocument, LikeC4DocumentProps {
}
export interface FqnIndexedDocument extends SetRequired<LikeC4LangiumDocument, 'c4fqnIndex'> {
}
export interface ParsedLikeC4LangiumDocument extends LikeC4GrammarDocument, Required<LikeC4DocumentProps> {
}
export declare function isLikeC4LangiumDocument(doc: LangiumDocument): doc is LikeC4LangiumDocument;
export declare function isFqnIndexedDocument(doc: LangiumDocument): doc is FqnIndexedDocument;
export declare function isParsedLikeC4LangiumDocument(doc: LangiumDocument): doc is ParsedLikeC4LangiumDocument;
export declare function streamModel(doc: LikeC4LangiumDocument): Generator<any, void, unknown>;
export declare function streamDeploymentModel(doc: LikeC4LangiumDocument): Generator<any, void, unknown>;
export declare function resolveRelationPoints(node: ast.Relation): {
    source: ast.Element;
    target: ast.Element;
};
export declare function parseAstOpacityProperty({ value }: ast.OpacityProperty): number;
export declare function toElementStyle(props: Array<ast.StyleProperty> | undefined, isValid: IsValidFn): ParsedElementStyle;
export declare function toRelationshipStyle(props: ast.RelationshipStyleProperty[] | undefined, isValid: IsValidFn): {
    color?: c4.Color;
    line?: c4.RelationshipLineType;
    head?: c4.RelationshipArrowType;
    tail?: c4.RelationshipArrowType;
};
export declare function toRelationshipStyleExcludeDefaults(props: ast.SpecificationRelationshipKind['props'] | undefined, isValid: IsValidFn): {
    tail?: any;
    head?: any;
    line?: any;
    color?: any;
};
export declare function toColor(astNode: ast.ColorProperty): c4.Color | undefined;
export declare function toAutoLayout(rule: ast.ViewRuleAutoLayout): c4.ViewRuleAutoLayout;
export declare function toAstViewLayoutDirection(c4: c4.ViewRuleAutoLayout['direction']): ast.ViewLayoutDirection;
export declare function elementExpressionFromPredicate(predicate: ast.ElementPredicate): ast.ElementExpression;
