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

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

const hook = createTailorDBHook(policyFieldRule);

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