import { t } from "@tailor-platform/sdk";
import { defineSchema } from "@tailor-platform/sdk/seed";
import { createTailorDBHook, createStandardSchema } from "@tailor-platform/sdk/test";
import { auditableEntity } from "../../src/modules-db";

const schemaType = t.object({
  ...auditableEntity.pickFields(["id","createdAt"], { optional: true }),
  ...auditableEntity.omitFields(["id","createdAt"]),
});

const hook = createTailorDBHook(auditableEntity);

export const schema = defineSchema(
  createStandardSchema(schemaType, hook),
  {
    indexes: [
      {"name":"auditableentity_entityName_unique_idx","columns":["entityName"],"unique":true},
    ],
  }
);
