export type InitialMindmapAssetRefreshPayload = {
  id: string;
  document_id: string;
  asset_type: "mindmap";
  file_name: string;
  file_url: string;
};

export function buildInitialMindmapAssetRefreshPayload(input: {
  ok: boolean;
  docId: string;
  mindmapId: string;
}): InitialMindmapAssetRefreshPayload | null {
  if (!input.ok) {
    return null;
  }
  const fileName = `mindmap-${input.mindmapId}.json`;
  return {
    id: input.mindmapId,
    document_id: input.docId,
    asset_type: "mindmap",
    file_name: fileName,
    file_url: `/documents/${input.docId}/${fileName}`,
  };
}
