import type { TailorTypeGqlPermission, TailorTypePermission } from "@tailor-platform/sdk";

const loggedInUserCondition = [[{ user: "_loggedIn" }, "=", true]] as const;

export const defaultPermission: TailorTypePermission = {
  create: [{ conditions: loggedInUserCondition, permit: true }],
  read: [{ conditions: loggedInUserCondition, permit: true }],
  update: [{ conditions: loggedInUserCondition, permit: true }],
  delete: [{ conditions: loggedInUserCondition, permit: true }],
};

export const defaultGqlPermission: TailorTypeGqlPermission = [
  {
    conditions: loggedInUserCondition,
    actions: ["read", "aggregate"],
    permit: true,
  },
];
