// shared
export { defineCommand, type Command } from "./shared/defineCommand";
export { ok, err, type Result, type ValueOf, type ErrorOf } from "./shared/result";
export { defineQuery, type Query } from "./shared/defineQuery";
export { definePermissions } from "./shared/definePermissions";
export { requirePermission } from "./shared/requirePermission";
export { createDomainError, InsufficientPermissionError } from "./shared/errors";
export type {
  CommandContext,
  QueryContext,
  ReadonlyDB,
  PaginationInput,
  PaginatedResult,
} from "./shared/types";
export { buildPaginatedResult, DEFAULT_PAGE_SIZE } from "./shared/pagination";
export type {
  InferSchema,
  Selectable,
  Insertable,
  Updateable,
  FieldsToInsertable,
  EmptyFields,
} from "./shared/entityTypes";

// primitives
export { defineModule as definePrimitivesModule } from "./modules/primitives/module";
export {
  permissions as primitivesPermissions,
  own as primitivesOwn,
  all as primitivesAll,
} from "./modules/primitives/lib/permissions.generated";
// user-management
export { defineModule as defineUserManagementModule } from "./modules/user-management/module";
export {
  permissions as userManagementPermissions,
  own as userManagementOwn,
  all as userManagementAll,
} from "./modules/user-management/lib/permissions.generated";
// item-management
export { defineModule as defineItemManagementModule } from "./modules/item-management/module";
export {
  permissions as itemManagementPermissions,
  own as itemManagementOwn,
  all as itemManagementAll,
} from "./modules/item-management/lib/permissions.generated";
// audit
export {
  defineModule as defineAuditModule,
  companyStub as auditCompanyStub,
} from "./modules/audit/module";
export {
  permissions as auditPermissions,
  own as auditOwn,
  all as auditAll,
} from "./modules/audit/lib/permissions.generated";
// business-partner
export { defineModule as defineBusinessPartnerModule } from "./modules/business-partner/module";
export {
  permissions as businessPartnerPermissions,
  own as businessPartnerOwn,
  all as businessPartnerAll,
} from "./modules/business-partner/lib/permissions.generated";
// coa-management
export { defineModule as defineCoaManagementModule } from "./modules/coa-management/module";
export {
  permissions as coaManagementPermissions,
  own as coaManagementOwn,
  all as coaManagementAll,
} from "./modules/coa-management/lib/permissions.generated";
// inventory
export { defineModule as defineInventoryModule } from "./modules/inventory/module";
export {
  permissions as inventoryPermissions,
  own as inventoryOwn,
  all as inventoryAll,
} from "./modules/inventory/lib/permissions.generated";
// organization
export { defineModule as defineOrganizationModule } from "./modules/organization/module";
export {
  permissions as organizationPermissions,
  own as organizationOwn,
  all as organizationAll,
} from "./modules/organization/lib/permissions.generated";
// product-management
export { defineModule as defineProductManagementModule } from "./modules/product-management/module";
export {
  permissions as productManagementPermissions,
  own as productManagementOwn,
  all as productManagementAll,
} from "./modules/product-management/lib/permissions.generated";
// purchase
export { defineModule as definePurchaseModule } from "./modules/purchase/module";
export {
  permissions as purchasePermissions,
  own as purchaseOwn,
  all as purchaseAll,
} from "./modules/purchase/lib/permissions.generated";
// sales
export { defineModule as defineSalesModule } from "./modules/sales/module";
export {
  permissions as salesPermissions,
  own as salesOwn,
  all as salesAll,
} from "./modules/sales/lib/permissions.generated";
