/**
 * Sync Serialization - JSONL format serialization and parsing
 *
 * Handles conversion between Element/Dependency objects and JSONL format.
 * All timestamps are normalized to ISO 8601 format.
 */
import type { Element, Dependency } from '@stoneforge/core';
import type { SerializedElement, SerializedDependency } from './types.js';
/**
 * Serialize an element to JSONL format
 *
 * @param element - Element to serialize
 * @returns JSON string ready for JSONL file
 */
export declare function serializeElement(element: Element): string;
/**
 * Parse a JSONL line into an element
 *
 * @param line - JSON string from JSONL file
 * @returns Parsed element
 * @throws ValidationError if parsing fails
 */
export declare function parseElement(line: string): Element;
/**
 * Try to parse a JSONL line into an element
 *
 * @param line - JSON string from JSONL file
 * @returns Parsed element or null if invalid
 */
export declare function tryParseElement(line: string): Element | null;
/**
 * Serialize a dependency to JSONL format
 *
 * @param dependency - Dependency to serialize
 * @returns JSON string ready for JSONL file
 */
export declare function serializeDependency(dependency: Dependency): string;
/**
 * Parse a JSONL line into a dependency
 *
 * @param line - JSON string from JSONL file
 * @returns Parsed dependency
 * @throws ValidationError if parsing fails
 */
export declare function parseDependency(line: string): Dependency;
/**
 * Try to parse a JSONL line into a dependency
 *
 * @param line - JSON string from JSONL file
 * @returns Parsed dependency or null if invalid
 */
export declare function tryParseDependency(line: string): Dependency | null;
/**
 * Serialize multiple elements to JSONL content
 *
 * @param elements - Elements to serialize
 * @returns JSONL content (multiple lines)
 */
export declare function serializeElements(elements: Element[]): string;
/**
 * Serialize multiple dependencies to JSONL content
 *
 * @param dependencies - Dependencies to serialize
 * @returns JSONL content (multiple lines)
 */
export declare function serializeDependencies(dependencies: Dependency[]): string;
/**
 * Parse JSONL content into elements
 *
 * @param content - JSONL content (multiple lines)
 * @returns Array of parsed elements and any errors
 */
export declare function parseElements(content: string): {
    elements: Element[];
    errors: ParseError[];
};
/**
 * Parse JSONL content into dependencies
 *
 * @param content - JSONL content (multiple lines)
 * @returns Array of parsed dependencies and any errors
 */
export declare function parseDependencies(content: string): {
    dependencies: Dependency[];
    errors: ParseError[];
};
/**
 * Parse error info
 */
export interface ParseError {
    /** Line number (1-indexed) */
    line: number;
    /** Error message */
    message: string;
    /** Truncated line content */
    content: string;
}
/**
 * Sort elements for export ordering
 *
 * Order by:
 * 1. Type (entities first for references)
 * 2. Creation time
 * 3. ID (for stability)
 *
 * @param elements - Elements to sort
 * @returns Sorted elements (new array)
 */
export declare function sortElementsForExport(elements: Element[]): Element[];
/**
 * Sort dependencies for export ordering
 *
 * Order by:
 * 1. Creation time
 * 2. Blocked ID
 * 3. Blocker ID
 * 4. Type (for stability)
 *
 * @param dependencies - Dependencies to sort
 * @returns Sorted dependencies (new array)
 */
export declare function sortDependenciesForExport(dependencies: Dependency[]): Dependency[];
/**
 * Check if an object looks like a serialized element
 * (less strict than isElement, for initial parsing)
 */
export declare function isSerializedElement(value: unknown): value is SerializedElement;
/**
 * Check if an object looks like a serialized dependency
 */
export declare function isSerializedDependency(value: unknown): value is SerializedDependency;
//# sourceMappingURL=serialization.d.ts.map