import { S as StringEnum } from "./use-page-data.BgY0vKG4.js";
import { Type } from "@sinclair/typebox";
const airtableFields = Type.Array(Type.Object({
  id: Type.String(),
  name: Type.String(),
  type: Type.String()
}));
Type.Object({
  id: Type.String(),
  name: Type.String(),
  description: Type.String(),
  primaryFieldId: Type.String(),
  fields: airtableFields
});
const airtableOptions = Type.Object({
  externalUrl: Type.Optional(Type.String()),
  baseId: Type.String({
    pattern: "^app[A-Za-z0-9]+$",
    description: 'Airtable Base ID starting with "app"'
  }),
  baseName: Type.Optional(Type.String({ description: "Airtable Base Name" })),
  tableId: Type.String({
    pattern: "^tbl[A-Za-z0-9]+$",
    description: 'Airtable Table ID starting with "tbl"'
  }),
  tableName: Type.Optional(Type.String({ description: "Table name as shown in Airtable interface" })),
  fields: Type.Optional(airtableFields)
});
StringEnum([
  "number",
  "checkbox",
  "date",
  "dateTime",
  "email",
  "url",
  "singleLineText",
  "multilineText",
  "singleSelect",
  "multipleSelects"
]);
const googleSheetsOptions = Type.Object({
  spreadsheetId: Type.String(),
  spreadsheetUrl: Type.Optional(Type.String()),
  spreadsheetName: Type.Optional(Type.String()),
  externalUrl: Type.Optional(Type.String())
});
const notionOptions = Type.Object({
  url: Type.Optional(Type.String()),
  id: Type.String({
    pattern: "^[A-Za-z0-9\\-]+$",
    description: "Notion Database ID"
  }),
  name: Type.String({ description: "Notion Database Name" }),
  properties: Type.Any()
});
StringEnum([
  "airtable",
  "google-sheets",
  "notion",
  "internal"
]);
const internalDatarecord = Type.Object({
  provider: Type.Literal("internal"),
  schema: Type.Object({}, {
    title: "Schema",
    additionalProperties: true,
    description: "JSON Schema. Always of type 'object' and representing a row that will be saved in the database.",
    examples: [{
      type: "object",
      properties: {
        firstname: {
          type: "string",
          title: "Firstname"
        },
        lastname: {
          type: "string",
          title: "Lastname"
        },
        email: {
          type: "string",
          format: "email",
          title: "Email"
        }
      },
      required: ["email"],
      title: "Newsletter Subscription"
    }]
  })
}, { examples: [{
  provider: "internal",
  schema: {
    type: "object",
    properties: {
      firstname: {
        type: "string",
        title: "Firstname"
      },
      lastname: {
        type: "string",
        title: "Lastname"
      },
      email: {
        type: "string",
        format: "email",
        title: "Email"
      }
    },
    required: ["email"],
    title: "Newsletter Subscription"
  },
  indexes: [{
    name: "email_index",
    fields: ["email"],
    unique: true
  }]
}] });
const commonDatarecordSchema = Type.Object({ schema: Type.Object({}, {
  additionalProperties: true,
  title: "Schema",
  description: "JSON Schema. Always of type 'object' and representing a row that will be saved.",
  examples: [{
    type: "object",
    properties: {
      firstname: {
        type: "string",
        title: "Firstname"
      },
      lastname: {
        type: "string",
        title: "Lastname"
      },
      email: {
        type: "string",
        format: "email",
        title: "Email"
      }
    },
    required: ["email"],
    title: "Newsletter Subscription"
  }]
}) });
const commonDatarecordMetadata = Type.Object({
  id: Type.String({
    title: "ID",
    description: "A unique identifier, e.g., 'newsletter_subscriptions'",
    comment: "A unique identifier, e.g., 'newsletter_subscriptions'"
  }),
  label: Type.String({
    title: "Name",
    description: "Human-friendly name",
    comment: "For example, 'Newsletter Subscriptions'"
  }),
  description: Type.Optional(Type.String({ title: "Description" }))
});
const genericDatarecord = Type.Composite([
  Type.Union([
    Type.Object({
      provider: Type.Literal("airtable"),
      options: airtableOptions
    }),
    Type.Object({
      provider: Type.Literal("google-sheets"),
      options: googleSheetsOptions
    }),
    Type.Object({
      provider: Type.Literal("notion"),
      options: notionOptions
    }),
    internalDatarecord
  ]),
  commonDatarecordMetadata,
  commonDatarecordSchema
]);
const datarecordsList = Type.Array(genericDatarecord);
export {
  datarecordsList as d
};
//# sourceMappingURL=types.CuOHUUHq.js.map
