export type SchemetaRequest<TPayload = unknown, TOptions = Record<string, unknown>> = {
  payload: TPayload;
  options?: TOptions;
};

export type SchemetaEnvelope = {
  api_version?: string;
  schema_version?: string;
  request_id?: string;
};

export type CompileResponse = SchemetaEnvelope & {
  ok?: boolean;
  errors?: unknown[];
  warnings?: unknown[];
  svg?: string;
  layout?: {
    width?: number;
    height?: number;
    placed?: Array<Record<string, unknown>>;
  };
  layout_metrics?: Record<string, number>;
  topology?: Record<string, unknown>;
  focus_map?: Record<string, unknown>;
};

export type AnalyzeResponse = SchemetaEnvelope & {
  ok?: boolean;
  errors?: unknown[];
  warnings?: unknown[];
  topology?: Record<string, unknown>;
};

export type LayoutActionResponse = SchemetaEnvelope & {
  ok?: boolean;
  model?: Record<string, unknown>;
  compile?: CompileResponse;
};
