import { implement } from "../../../../../../packages/rpc/src/index.ts";
import { catalogService } from "../../../../packages/shared/src/index.ts";

/** Private service consumed by the workspace's web app. */
export default implement(
  catalogService,
  {
    getProduct: ({ sku }) => ({ sku, name: "WRNexus Starter", priceCents: 4900 }),
  },
  {
    selfApp: "admin",
    // Demo policy. Use the admin app's database-backed permission store in production.
    checkPermission: (permission, subject) =>
      permission === "catalog:read" && subject?.subjectId === "demo-user",
  },
);
