# Interfaces S–U

Import these from `@grafloria/engine`.

## Interfaces

### `SyncMetrics`

```ts
interface SyncMetrics
```

**Properties**

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `totalSyncs` | `number` |  | Total syncs performed |
| `textToVisual` | `number` |  | Text → Visual syncs |
| `visualToText` | `number` |  | Visual → Text syncs |
| `errors` | `number` |  | Sync errors |
| `conflicts` | `number` |  | Conflicts resolved |
| `averageSyncTime` | `number` |  | Average sync time (ms) |
| `sessionDuration` | `number` |  | Session duration (ms) |

### `SyncOptions`

```ts
interface SyncOptions
```

**Properties**

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `debounceMs?` | `number` |  | Debounce delay in milliseconds (default: 300) |
| `debug?` | `boolean` |  | Enable debug logging |
| `autoLayout?` | `boolean` |  | Auto-apply layout after text changes |
| `generatorOptions?` | `GeneratorOptions` |  | Generator options for visual→text sync |
| `transformerOptions?` | `TransformOptions` |  | Transformer options for text→visual sync |

### `SyncState`

```ts
interface SyncState
```

**Properties**

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `active` | `boolean` |  | Is sync currently active |
| `lastEditSource` | `EditSource` |  | Last edit source |
| `lastSyncDirection` | `SyncDirection` |  | Last sync direction |
| `syncing` | `boolean` |  | Sync in progress |
| `pendingCount` | `number` |  | Number of pending syncs |
| `stats` | `{ textToVisualCount: number; visualToTextCount: number; conflictsResolved: number; lastSyncTime: number; }` |  | Statistics |

### `SyncStatus`

```ts
interface SyncStatus
```

**Properties**

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `status` | `'idle' \| 'syncing' \| 'error' \| 'conflict'` |  | Current status |
| `message` | `string` |  | Status message |
| `lastSync?` | `Date` |  | Last sync timestamp |
| `lastSyncDuration?` | `number` |  | Last sync duration (ms) |
| `error?` | `string` |  | Error message if status is 'error' |

### `Token`

Represents a single token from the lexical analysis

```ts
interface Token
```

**Properties**

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `type` | `TokenType` |  |  |
| `value` | `string` |  |  |
| `line` | `number` |  |  |
| `column` | `number` |  |  |
| `startIndex` | `number` |  |  |
| `endIndex` | `number` |  |  |

### `TransformOptions`

```ts
interface TransformOptions
```

**Properties**

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `defaultNodeSize?` | `{ width: number; height: number }` |  | Default node size if not specified |
| `nodeSpacing?` | `number` |  | Spacing between auto-positioned nodes |
| `startPosition?` | `{ x: number; y: number }` |  | Starting position for auto-positioned nodes |
| `autoPosition?` | `boolean` |  | Auto-generate positions (true) or use default position for all (false) |
| `diagramName?` | `string` |  | Name for the generated diagram |

### `UmlSpec`

```ts
interface UmlSpec
```

**Properties**

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `classes` | `UmlSpecClass[]` |  |  |
| `relationships` | `UmlSpecRelationship[]` |  |  |
