import { randomUUID } from "crypto";
import { CacheData } from "../../api/react";
import { MakeswiftComponentType } from "../../components/builtin/constants";
function createRootComponent(elements, rootId) {
  return {
    key: rootId ?? randomUUID(),
    type: MakeswiftComponentType.Root,
    props: {
      children: {
        columns: [
          {
            deviceId: "desktop",
            value: {
              count: 12,
              spans: elements?.map(() => [12])
            }
          }
        ],
        elements
      }
    }
  };
}
const isDocument = (elementDataOrDocument) => "snippets" in elementDataOrDocument || "fonts" in elementDataOrDocument || "meta" in elementDataOrDocument || "seo" in elementDataOrDocument;
function createMakeswiftPageSnapshot(elementDataOrDocument, {
  cacheData = {},
  locale = null
} = {}) {
  return {
    document: isDocument(elementDataOrDocument) ? elementDataOrDocument : {
      id: "test-page-id",
      site: { id: "test-site-id" },
      data: elementDataOrDocument,
      snippets: [],
      fonts: [],
      meta: {},
      seo: {},
      localizedPages: [],
      locale
    },
    cacheData: {
      ...CacheData.empty(),
      ...cacheData
    }
  };
}
function createMakeswiftComponentSnapshot(elementData, {
  cacheData = {},
  locale = null
} = {}) {
  return {
    key: randomUUID(),
    document: {
      id: "test-component-id",
      name: "Test Component Document",
      siteId: "test-site-id",
      data: elementData,
      inheritsFromParent: false,
      locale
    },
    meta: {
      allowLocaleFallback: false,
      requestedLocale: locale
    },
    cacheData: {
      ...CacheData.empty(),
      ...cacheData
    }
  };
}
export {
  createMakeswiftComponentSnapshot,
  createMakeswiftPageSnapshot,
  createRootComponent
};
//# sourceMappingURL=element-data.js.map