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

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

const hook = createTailorDBHook(changeDetail);

export const schema = defineSchema(
  createStandardSchema(schemaType, hook),
  {
    foreignKeys: [
      {"column":"auditEntryId","references":{"table":"AuditEntry","column":"id"}},
    ],
  }
);
