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

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

const hook = createTailorDBHook(permission);

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