import { definePermissions } from "@tailor-platform/erp-kit/module";

export const { permissions, own, all, aliases } = definePermissions(
  "audit",
  [
    // Coarse query permissions
    "viewAuditHistory",
    "viewAuditSummary",
    "manageAuditPolicies",
    // Per-command permissions (included so aliases can map coarse → per-command)
    "activateAuditPolicy",
    "createAuditPolicy",
    "deactivateAuditPolicy",
    "deleteAuditPolicy",
    "logAuditEvent",
    "reactivateAuditPolicy",
    "registerAuditableEntity",
    "replaceAuditPolicy",
    "updateAuditPolicy",
  ] as const,
  {
    aliases: {
      manageAuditPolicies: [
        "manageAuditPolicies",
        "activateAuditPolicy",
        "createAuditPolicy",
        "deactivateAuditPolicy",
        "deleteAuditPolicy",
        "reactivateAuditPolicy",
        "registerAuditableEntity",
        "replaceAuditPolicy",
        "updateAuditPolicy",
      ],
      viewAuditHistory: ["viewAuditHistory"],
      viewAuditSummary: ["viewAuditSummary"],
      logAuditEvent: ["logAuditEvent"],
    },
  },
);
