/**
 * Saasuluk API (Cloudflare) — TypeScript SDK. AUTO-GENERATED by @suluk/sdk from the v4 contract (OpenAPI 4.0.0-candidate). Do not edit.
 *
 * Generated straight from the contract: 96 operations, fully typed. The contract's input JSON Schemas
 * are shipped AS DATA (`schemas`) and validated DIRECTLY by a generic, eval-free engine — never transpiled into a
 * single validator's source — so what runs is exactly what the contract stores (lossless). Each input is a STANDARD
 * SCHEMA (`.input`), so it drops into react-hook-form / TanStack Form / tRPC unchanged. Auth is wired via an
 * interceptor; every method carries the v4 facets as typed metadata — `.cost` (µ$), `.requires` (who can call it),
 * `.input` (the Standard Schema). Those are HINTS + a client-side guard, not enforcement — the server is the
 * security boundary.
 *
 *   import { createClient } from "./suluk-sdk";
 *   const api = createClient({ baseURL: "https://saasuluk.saastemly.com", token: () => localStorage.getItem("token") });
 *   const products = await api.product.list();
 *   const order = await api.checkout.order({ items: [{ productId: 1, qty: 2 }] }); // input validated before send
 *
 * Requires: `npm i ofetch @cfworker/json-schema`.
 */
import { ofetch, type FetchError } from "ofetch";
import { Validator } from "@cfworker/json-schema";

export type { FetchError };

/** The Standard Schema v1 interface — `.input` implements this, so any Standard-Schema-aware tool can consume it. */
export interface StandardSchemaV1<Output = unknown> {
  readonly "~standard": {
    readonly version: 1;
    readonly vendor: "suluk";
    readonly validate: (value: unknown) => StandardResult<Output>;
    readonly types?: { readonly output: Output };
  };
}
export type StandardIssue = { readonly message: string; readonly path: ReadonlyArray<string | number> };
export type StandardResult<O> = { readonly value: O } | { readonly issues: ReadonlyArray<StandardIssue> };

/** Thrown by a method when its input fails the contract's JSON Schema (only when `validate` is on). */
export class SulukValidationError extends Error {
  constructor(public readonly issues: ReadonlyArray<StandardIssue>) {
    super("Input failed contract validation: " + issues.map((i) => `${i.path.join(".") || "(root)"}: ${i.message}`).join("; "));
    this.name = "SulukValidationError";
  }
}

/** The contract's input JSON Schemas (2020-12), shipped AS DATA — introspectable, validated directly. */
export const schemas = {
  category_list_q: {"type":"object","properties":{"page":{"type":"integer","minimum":1,"maximum":9007199254740991},"perPage":{"type":"integer","minimum":1,"maximum":9007199254740991},"sort":{"type":"string","maxLength":1024,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f]*$"},"order":{"type":"string","enum":["asc","desc"]},"q":{"type":"string","maxLength":1024,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f]*$"}},"additionalProperties":false},
  category_create: {"type":"object","properties":{"id":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"name":{"type":"string","maxLength":100,"pattern":"^[^<>\\u0000-\\u001f\\u007f]*$"},"slug":{"type":"string","maxLength":80,"pattern":"^[a-z0-9]+(?:-[a-z0-9]+)*$"}},"required":["name","slug"],"additionalProperties":false},
  category_update: {"type":"object","properties":{"id":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"name":{"type":"string","maxLength":100,"pattern":"^[^<>\\u0000-\\u001f\\u007f]*$"},"slug":{"type":"string","maxLength":80,"pattern":"^[a-z0-9]+(?:-[a-z0-9]+)*$"}},"required":["name","slug"],"additionalProperties":false},
  product_list_q: {"type":"object","properties":{"page":{"type":"integer","minimum":1,"maximum":9007199254740991},"perPage":{"type":"integer","minimum":1,"maximum":9007199254740991},"sort":{"type":"string","maxLength":1024,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f]*$"},"order":{"type":"string","enum":["asc","desc"]},"q":{"type":"string","maxLength":1024,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f]*$"}},"additionalProperties":false},
  product_create: {"type":"object","properties":{"id":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"name":{"type":"string","maxLength":160,"pattern":"^[^<>\\u0000-\\u001f\\u007f]*$"},"slug":{"type":"string","maxLength":100,"pattern":"^[a-z0-9]+(?:-[a-z0-9]+)*$"},"description":{"anyOf":[{"type":"string","maxLength":1024,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f]*$"},{"type":"null"}]},"priceCents":{"type":"integer","minimum":0,"maximum":1000000000},"categoryId":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"inventory":{"type":"integer","minimum":0,"maximum":1000000},"imageUrl":{"anyOf":[{"type":"string","maxLength":1024,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f]*$"},{"type":"null"}]},"status":{"type":"string","enum":["draft","published"]},"stripePriceId":{"anyOf":[{"type":"string","maxLength":1024,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f]*$"},{"type":"null"}]}},"required":["name","slug"],"additionalProperties":false},
  product_update: {"type":"object","properties":{"id":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"name":{"type":"string","maxLength":160,"pattern":"^[^<>\\u0000-\\u001f\\u007f]*$"},"slug":{"type":"string","maxLength":100,"pattern":"^[a-z0-9]+(?:-[a-z0-9]+)*$"},"description":{"anyOf":[{"type":"string","maxLength":1024,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f]*$"},{"type":"null"}]},"priceCents":{"type":"integer","minimum":0,"maximum":1000000000},"categoryId":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"inventory":{"type":"integer","minimum":0,"maximum":1000000},"imageUrl":{"anyOf":[{"type":"string","maxLength":1024,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f]*$"},{"type":"null"}]},"status":{"type":"string","enum":["draft","published"]},"stripePriceId":{"anyOf":[{"type":"string","maxLength":1024,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f]*$"},{"type":"null"}]}},"required":["name","slug"],"additionalProperties":false},
  variant_list_q: {"type":"object","properties":{"page":{"type":"integer","minimum":1,"maximum":9007199254740991},"perPage":{"type":"integer","minimum":1,"maximum":9007199254740991},"sort":{"type":"string","maxLength":1024,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f]*$"},"order":{"type":"string","enum":["asc","desc"]},"q":{"type":"string","maxLength":1024,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f]*$"}},"additionalProperties":false},
  variant_create: {"type":"object","properties":{"id":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"productId":{"type":"integer","minimum":1,"maximum":1000000000000},"title":{"type":"string","maxLength":160,"pattern":"^[^<>\\u0000-\\u001f\\u007f]*$"},"priceCents":{"type":"integer","minimum":0,"maximum":1000000000},"inventory":{"type":"integer","minimum":0,"maximum":1000000}},"required":["productId","title"],"additionalProperties":false},
  variant_update: {"type":"object","properties":{"id":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"productId":{"type":"integer","minimum":1,"maximum":1000000000000},"title":{"type":"string","maxLength":160,"pattern":"^[^<>\\u0000-\\u001f\\u007f]*$"},"priceCents":{"type":"integer","minimum":0,"maximum":1000000000},"inventory":{"type":"integer","minimum":0,"maximum":1000000}},"required":["productId","title"],"additionalProperties":false},
  discountCode_list_q: {"type":"object","properties":{"page":{"type":"integer","minimum":1,"maximum":9007199254740991},"perPage":{"type":"integer","minimum":1,"maximum":9007199254740991},"sort":{"type":"string","maxLength":1024,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f]*$"},"order":{"type":"string","enum":["asc","desc"]},"q":{"type":"string","maxLength":1024,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f]*$"}},"additionalProperties":false},
  discountCode_create: {"type":"object","properties":{"id":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"code":{"type":"string","maxLength":40,"pattern":"^[A-Z0-9][A-Z0-9_-]*$"},"discountType":{"type":"string","enum":["percent","fixed"]},"discountValue":{"type":"integer","minimum":0,"maximum":1000000000},"isActive":{"type":"boolean"},"currentUses":{"type":"integer","minimum":0,"maximum":1000000000},"maxUses":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"expiresAt":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]}},"required":["code"],"additionalProperties":false},
  discountCode_update: {"type":"object","properties":{"id":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"code":{"type":"string","maxLength":40,"pattern":"^[A-Z0-9][A-Z0-9_-]*$"},"discountType":{"type":"string","enum":["percent","fixed"]},"discountValue":{"type":"integer","minimum":0,"maximum":1000000000},"isActive":{"type":"boolean"},"currentUses":{"type":"integer","minimum":0,"maximum":1000000000},"maxUses":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"expiresAt":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]}},"required":["code"],"additionalProperties":false},
  cart_list_q: {"type":"object","properties":{"page":{"type":"integer","minimum":1,"maximum":9007199254740991},"perPage":{"type":"integer","minimum":1,"maximum":9007199254740991},"sort":{"type":"string","maxLength":1024,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f]*$"},"order":{"type":"string","enum":["asc","desc"]},"q":{"type":"string","maxLength":1024,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f]*$"}},"additionalProperties":false},
  cart_create: {"type":"object","properties":{"id":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"customerId":{"anyOf":[{"type":"string","maxLength":1024,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f]*$"},{"type":"null"}]},"items":{"type":"string","maxLength":100000,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f\\u007f]*$"},"discountCode":{"anyOf":[{"type":"string","maxLength":1024,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f]*$"},{"type":"null"}]},"status":{"type":"string","enum":["active","converted","abandoned"]}},"additionalProperties":false},
  cart_update: {"type":"object","properties":{"id":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"customerId":{"anyOf":[{"type":"string","maxLength":1024,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f]*$"},{"type":"null"}]},"items":{"type":"string","maxLength":100000,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f\\u007f]*$"},"discountCode":{"anyOf":[{"type":"string","maxLength":1024,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f]*$"},{"type":"null"}]},"status":{"type":"string","enum":["active","converted","abandoned"]}},"additionalProperties":false},
  order_list_q: {"type":"object","properties":{"page":{"type":"integer","minimum":1,"maximum":9007199254740991},"perPage":{"type":"integer","minimum":1,"maximum":9007199254740991},"sort":{"type":"string","maxLength":1024,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f]*$"},"order":{"type":"string","enum":["asc","desc"]},"q":{"type":"string","maxLength":1024,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f]*$"}},"additionalProperties":false},
  order_create: {"type":"object","properties":{"id":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"customerId":{"anyOf":[{"type":"string","maxLength":1024,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f]*$"},{"type":"null"}]},"items":{"type":"string","maxLength":100000,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f\\u007f]*$"},"totalCents":{"type":"integer","minimum":0,"maximum":100000000000},"status":{"type":"string","enum":["pending","paid","shipped","cancelled"]},"discountCode":{"anyOf":[{"type":"string","maxLength":1024,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f]*$"},{"type":"null"}]},"stripePaymentIntentId":{"anyOf":[{"type":"string","maxLength":1024,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f]*$"},{"type":"null"}]},"createdAt":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]}},"additionalProperties":false},
  order_update: {"type":"object","properties":{"id":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"customerId":{"anyOf":[{"type":"string","maxLength":1024,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f]*$"},{"type":"null"}]},"items":{"type":"string","maxLength":100000,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f\\u007f]*$"},"totalCents":{"type":"integer","minimum":0,"maximum":100000000000},"status":{"type":"string","enum":["pending","paid","shipped","cancelled"]},"discountCode":{"anyOf":[{"type":"string","maxLength":1024,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f]*$"},{"type":"null"}]},"stripePaymentIntentId":{"anyOf":[{"type":"string","maxLength":1024,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f]*$"},{"type":"null"}]},"createdAt":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]}},"additionalProperties":false},
  review_list_q: {"type":"object","properties":{"page":{"type":"integer","minimum":1,"maximum":9007199254740991},"perPage":{"type":"integer","minimum":1,"maximum":9007199254740991},"sort":{"type":"string","maxLength":1024,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f]*$"},"order":{"type":"string","enum":["asc","desc"]},"q":{"type":"string","maxLength":1024,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f]*$"}},"additionalProperties":false},
  review_create: {"type":"object","properties":{"id":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"productId":{"type":"integer","minimum":1,"maximum":1000000000000},"customerId":{"anyOf":[{"type":"string","maxLength":1024,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f]*$"},{"type":"null"}]},"rating":{"type":"integer","minimum":1,"maximum":5},"title":{"type":"string","maxLength":160,"pattern":"^[^<>\\u0000-\\u001f\\u007f]*$"},"body":{"anyOf":[{"type":"string","maxLength":1024,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f]*$"},{"type":"null"}]},"status":{"type":"string","enum":["pending","published"]},"helpfulCount":{"type":"integer","minimum":0,"maximum":1000000000},"createdAt":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]}},"required":["productId","title"],"additionalProperties":false},
  review_update: {"type":"object","properties":{"id":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"productId":{"type":"integer","minimum":1,"maximum":1000000000000},"customerId":{"anyOf":[{"type":"string","maxLength":1024,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f]*$"},{"type":"null"}]},"rating":{"type":"integer","minimum":1,"maximum":5},"title":{"type":"string","maxLength":160,"pattern":"^[^<>\\u0000-\\u001f\\u007f]*$"},"body":{"anyOf":[{"type":"string","maxLength":1024,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f]*$"},{"type":"null"}]},"status":{"type":"string","enum":["pending","published"]},"helpfulCount":{"type":"integer","minimum":0,"maximum":1000000000},"createdAt":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]}},"required":["productId","title"],"additionalProperties":false},
  wishlistItem_list_q: {"type":"object","properties":{"page":{"type":"integer","minimum":1,"maximum":9007199254740991},"perPage":{"type":"integer","minimum":1,"maximum":9007199254740991},"sort":{"type":"string","maxLength":1024,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f]*$"},"order":{"type":"string","enum":["asc","desc"]},"q":{"type":"string","maxLength":1024,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f]*$"}},"additionalProperties":false},
  wishlistItem_create: {"type":"object","properties":{"id":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"customerId":{"anyOf":[{"type":"string","maxLength":1024,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f]*$"},{"type":"null"}]},"productId":{"type":"integer","minimum":1,"maximum":1000000000000},"variantId":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"addedAt":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]}},"required":["productId"],"additionalProperties":false},
  wishlistItem_update: {"type":"object","properties":{"id":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"customerId":{"anyOf":[{"type":"string","maxLength":1024,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f]*$"},{"type":"null"}]},"productId":{"type":"integer","minimum":1,"maximum":1000000000000},"variantId":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"addedAt":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]}},"required":["productId"],"additionalProperties":false},
  post_list_q: {"type":"object","properties":{"page":{"type":"integer","minimum":1,"maximum":9007199254740991},"perPage":{"type":"integer","minimum":1,"maximum":9007199254740991},"sort":{"type":"string","maxLength":1024,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f]*$"},"order":{"type":"string","enum":["asc","desc"]},"q":{"type":"string","maxLength":1024,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f]*$"}},"additionalProperties":false},
  post_create: {"type":"object","properties":{"id":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"title":{"type":"string","maxLength":200,"pattern":"^[^<>\\u0000-\\u001f\\u007f]*$"},"slug":{"type":"string","maxLength":120,"pattern":"^[a-z0-9]+(?:-[a-z0-9]+)*$"},"excerpt":{"anyOf":[{"type":"string","maxLength":1024,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f]*$"},{"type":"null"}]},"body":{"anyOf":[{"type":"string","maxLength":1024,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f]*$"},{"type":"null"}]},"status":{"type":"string","enum":["draft","published"]},"publishedAt":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"authorId":{"anyOf":[{"type":"string","maxLength":1024,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f]*$"},{"type":"null"}]},"coverImageUrl":{"anyOf":[{"type":"string","maxLength":1024,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f]*$"},{"type":"null"}]}},"required":["title","slug"],"additionalProperties":false},
  post_update: {"type":"object","properties":{"id":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"title":{"type":"string","maxLength":200,"pattern":"^[^<>\\u0000-\\u001f\\u007f]*$"},"slug":{"type":"string","maxLength":120,"pattern":"^[a-z0-9]+(?:-[a-z0-9]+)*$"},"excerpt":{"anyOf":[{"type":"string","maxLength":1024,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f]*$"},{"type":"null"}]},"body":{"anyOf":[{"type":"string","maxLength":1024,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f]*$"},{"type":"null"}]},"status":{"type":"string","enum":["draft","published"]},"publishedAt":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"authorId":{"anyOf":[{"type":"string","maxLength":1024,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f]*$"},{"type":"null"}]},"coverImageUrl":{"anyOf":[{"type":"string","maxLength":1024,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f]*$"},{"type":"null"}]}},"required":["title","slug"],"additionalProperties":false},
  faq_list_q: {"type":"object","properties":{"page":{"type":"integer","minimum":1,"maximum":9007199254740991},"perPage":{"type":"integer","minimum":1,"maximum":9007199254740991},"sort":{"type":"string","maxLength":1024,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f]*$"},"order":{"type":"string","enum":["asc","desc"]},"q":{"type":"string","maxLength":1024,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f]*$"}},"additionalProperties":false},
  faq_create: {"type":"object","properties":{"id":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"question":{"type":"string","maxLength":300,"pattern":"^[^<>\\u0000-\\u001f\\u007f]*$"},"answer":{"type":"string","maxLength":2000,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f\\u007f]*$"},"sortOrder":{"type":"integer","minimum":0,"maximum":100000},"isActive":{"type":"boolean"}},"required":["question","answer"],"additionalProperties":false},
  faq_update: {"type":"object","properties":{"id":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"question":{"type":"string","maxLength":300,"pattern":"^[^<>\\u0000-\\u001f\\u007f]*$"},"answer":{"type":"string","maxLength":2000,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f\\u007f]*$"},"sortOrder":{"type":"integer","minimum":0,"maximum":100000},"isActive":{"type":"boolean"}},"required":["question","answer"],"additionalProperties":false},
  newsletterSubscriber_list_q: {"type":"object","properties":{"page":{"type":"integer","minimum":1,"maximum":9007199254740991},"perPage":{"type":"integer","minimum":1,"maximum":9007199254740991},"sort":{"type":"string","maxLength":1024,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f]*$"},"order":{"type":"string","enum":["asc","desc"]},"q":{"type":"string","maxLength":1024,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f]*$"}},"additionalProperties":false},
  newsletterSubscriber_create: {"type":"object","properties":{"id":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"email":{"type":"string","format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"subscribedAt":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]}},"required":["email"],"additionalProperties":false},
  newsletterSubscriber_update: {"type":"object","properties":{"id":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"email":{"type":"string","format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"subscribedAt":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]}},"required":["email"],"additionalProperties":false},
  contactSubmission_list_q: {"type":"object","properties":{"page":{"type":"integer","minimum":1,"maximum":9007199254740991},"perPage":{"type":"integer","minimum":1,"maximum":9007199254740991},"sort":{"type":"string","maxLength":1024,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f]*$"},"order":{"type":"string","enum":["asc","desc"]},"q":{"type":"string","maxLength":1024,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f]*$"}},"additionalProperties":false},
  contactSubmission_create: {"type":"object","properties":{"id":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"name":{"type":"string","maxLength":120,"pattern":"^[^<>\\u0000-\\u001f\\u007f]*$"},"email":{"type":"string","format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"subject":{"type":"string","maxLength":200,"pattern":"^[^<>\\u0000-\\u001f\\u007f]*$"},"message":{"type":"string","maxLength":5000,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f\\u007f]*$"},"createdAt":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]}},"required":["name","email","subject","message"],"additionalProperties":false},
  contactSubmission_update: {"type":"object","properties":{"id":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"name":{"type":"string","maxLength":120,"pattern":"^[^<>\\u0000-\\u001f\\u007f]*$"},"email":{"type":"string","format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"subject":{"type":"string","maxLength":200,"pattern":"^[^<>\\u0000-\\u001f\\u007f]*$"},"message":{"type":"string","maxLength":5000,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f\\u007f]*$"},"createdAt":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]}},"required":["name","email","subject","message"],"additionalProperties":false},
  media_list_q: {"type":"object","properties":{"page":{"type":"integer","minimum":1,"maximum":9007199254740991},"perPage":{"type":"integer","minimum":1,"maximum":9007199254740991},"sort":{"type":"string","maxLength":1024,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f]*$"},"order":{"type":"string","enum":["asc","desc"]},"q":{"type":"string","maxLength":1024,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f]*$"}},"additionalProperties":false},
  media_create: {"type":"object","properties":{"id":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"url":{"type":"string","format":"uri"},"alt":{"type":"string","maxLength":300,"pattern":"^[^<>\\u0000-\\u001f\\u007f]*$"},"width":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"height":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]}},"required":["url","alt"],"additionalProperties":false},
  media_update: {"type":"object","properties":{"id":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"url":{"type":"string","format":"uri"},"alt":{"type":"string","maxLength":300,"pattern":"^[^<>\\u0000-\\u001f\\u007f]*$"},"width":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"height":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]}},"required":["url","alt"],"additionalProperties":false},
  apiToken_list_q: {"type":"object","properties":{"page":{"type":"integer","minimum":1,"maximum":9007199254740991},"perPage":{"type":"integer","minimum":1,"maximum":9007199254740991},"sort":{"type":"string","maxLength":1024,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f]*$"},"order":{"type":"string","enum":["asc","desc"]},"q":{"type":"string","maxLength":1024,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f]*$"}},"additionalProperties":false},
  apiToken_create: {"type":"object","properties":{"id":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"userId":{"anyOf":[{"type":"string","maxLength":1024,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f]*$"},{"type":"null"}]},"name":{"type":"string","maxLength":120,"pattern":"^[^<>\\u0000-\\u001f\\u007f]*$"},"prefix":{"type":"string","maxLength":20,"pattern":"^[^<>\\u0000-\\u001f\\u007f]*$"},"hashedKey":{"type":"string","maxLength":128,"pattern":"^[a-f0-9]+$"},"createdAt":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"lastUsedAt":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"revokedAt":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]}},"required":["name","prefix","hashedKey"],"additionalProperties":false},
  apiToken_update: {"type":"object","properties":{"id":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"userId":{"anyOf":[{"type":"string","maxLength":1024,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f]*$"},{"type":"null"}]},"name":{"type":"string","maxLength":120,"pattern":"^[^<>\\u0000-\\u001f\\u007f]*$"},"prefix":{"type":"string","maxLength":20,"pattern":"^[^<>\\u0000-\\u001f\\u007f]*$"},"hashedKey":{"type":"string","maxLength":128,"pattern":"^[a-f0-9]+$"},"createdAt":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"lastUsedAt":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"revokedAt":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]}},"required":["name","prefix","hashedKey"],"additionalProperties":false},
  billingAccount_list_q: {"type":"object","properties":{"page":{"type":"integer","minimum":1,"maximum":9007199254740991},"perPage":{"type":"integer","minimum":1,"maximum":9007199254740991},"sort":{"type":"string","maxLength":1024,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f]*$"},"order":{"type":"string","enum":["asc","desc"]},"q":{"type":"string","maxLength":1024,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f]*$"}},"additionalProperties":false},
  billingAccount_create: {"type":"object","properties":{"id":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"principal":{"type":"string","maxLength":128,"pattern":"^[^<>\\u0000-\\u001f\\u007f]*$"},"stripeCustomerId":{"anyOf":[{"type":"string","maxLength":1024,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f]*$"},{"type":"null"}]},"subscriptionId":{"anyOf":[{"type":"string","maxLength":1024,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f]*$"},{"type":"null"}]},"lastReportedMicroUsd":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"lastReportedAt":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"createdAt":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]}},"required":["principal"],"additionalProperties":false},
  billingAccount_update: {"type":"object","properties":{"id":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"principal":{"type":"string","maxLength":128,"pattern":"^[^<>\\u0000-\\u001f\\u007f]*$"},"stripeCustomerId":{"anyOf":[{"type":"string","maxLength":1024,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f]*$"},{"type":"null"}]},"subscriptionId":{"anyOf":[{"type":"string","maxLength":1024,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f]*$"},{"type":"null"}]},"lastReportedMicroUsd":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"lastReportedAt":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"createdAt":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]}},"required":["principal"],"additionalProperties":false},
  project_list_q: {"type":"object","properties":{"page":{"type":"integer","minimum":1,"maximum":9007199254740991},"perPage":{"type":"integer","minimum":1,"maximum":9007199254740991},"sort":{"type":"string","maxLength":1024,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f]*$"},"order":{"type":"string","enum":["asc","desc"]},"q":{"type":"string","maxLength":1024,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f]*$"}},"additionalProperties":false},
  project_create: {"type":"object","properties":{"id":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"name":{"type":"string","maxLength":160,"pattern":"^[^<>\\u0000-\\u001f\\u007f]*$"},"ownerId":{"anyOf":[{"type":"string","maxLength":1024,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f]*$"},{"type":"null"}]},"status":{"type":"string","enum":["active","archived"]}},"required":["name"],"additionalProperties":false},
  project_update: {"type":"object","properties":{"id":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"name":{"type":"string","maxLength":160,"pattern":"^[^<>\\u0000-\\u001f\\u007f]*$"},"ownerId":{"anyOf":[{"type":"string","maxLength":1024,"pattern":"^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f]*$"},{"type":"null"}]},"status":{"type":"string","enum":["active","archived"]}},"required":["name"],"additionalProperties":false},
  checkout_order: {"type":"object","additionalProperties":false,"properties":{"cartId":{"type":"integer","minimum":1,"maximum":1000000000000},"items":{"type":"array","maxItems":200,"items":{"type":"object","additionalProperties":false,"properties":{"productId":{"type":"integer","minimum":1,"maximum":1000000000000},"qty":{"type":"integer","minimum":1,"maximum":1000},"priceCents":{"type":"integer","minimum":0,"maximum":1000000000}}}},"discountCode":{"type":"string","maxLength":40,"pattern":"^[A-Z0-9][A-Z0-9_-]*$"}}},
  discount_validate: {"type":"object","additionalProperties":false,"properties":{"code":{"type":"string","maxLength":40,"pattern":"^[A-Z0-9][A-Z0-9_-]*$"},"subtotalCents":{"type":"integer","minimum":0,"maximum":100000000000}},"required":["code"]},
  search_q: {"type":"object","additionalProperties":false,"properties":{"q":{"type":"string","maxLength":200,"pattern":"^[^<>\\u0000-\\u001f\\u007f]*$"}}},
  newsletter_subscribe: {"type":"object","additionalProperties":false,"properties":{"email":{"type":"string","format":"email","maxLength":254}},"required":["email"]},
  avatar_q: {"type":"object","additionalProperties":false,"properties":{"seed":{"type":"string","maxLength":100,"pattern":"^[\\w .@-]{0,100}$"}}},
  token_create: {"type":"object","additionalProperties":false,"properties":{"name":{"type":"string","maxLength":80,"pattern":"^[^<>\\u0000-\\u001f\\u007f]*$"}},"required":["name"]},
  checkout_pay: {"type":"object","additionalProperties":false,"properties":{"items":{"type":"array","maxItems":200,"items":{"type":"object","additionalProperties":false,"properties":{"productId":{"type":"integer","minimum":1,"maximum":1000000000000},"qty":{"type":"integer","minimum":1,"maximum":1000}}}},"discountCode":{"type":"string","maxLength":40,"pattern":"^[A-Z0-9][A-Z0-9_-]*$"}}},
  checkout_confirm: {"type":"object","additionalProperties":false,"properties":{"orderId":{"type":"integer","minimum":1,"maximum":1000000000000},"sessionId":{"type":"string","maxLength":255,"pattern":"^[A-Za-z0-9_]+$"}},"required":["orderId","sessionId"]},
  billing_connect: {"type":"object","additionalProperties":false,"properties":{"email":{"type":"string","format":"email","maxLength":254}}},
  billing_report: {"type":"object","additionalProperties":false},
} as const;

/** Wrap a stored JSON Schema as a Standard Schema, backed by a generic, eval-free validator (Workers-native). */
function std<Output>(schema: unknown): StandardSchemaV1<Output> {
  const v = new Validator(schema as object, "2020-12");
  return {
    "~standard": {
      version: 1,
      vendor: "suluk",
      validate(value: unknown): StandardResult<Output> {
        const r = v.validate(value);
        if (r.valid) return { value: value as Output };
        return { issues: (r.errors as Array<{ error?: string; instanceLocation?: string }>).map((e) => ({ message: e.error ?? "invalid", path: (e.instanceLocation ?? "").split("/").slice(1).filter(Boolean) })) };
      },
    },
  };
}

/** Validate `value` against an input schema; return it (typed) or throw SulukValidationError. */
function parse<Output>(input: StandardSchemaV1<Output>, value: unknown): Output {
  const r = input["~standard"].validate(value);
  if ("issues" in r) throw new SulukValidationError(r.issues);
  return r.value;
}

export type ProblemDetails = { type: string; title: string; status: number; detail?: string; instance?: string; errors?: Record<string, unknown>; error?: string };
export const ProblemDetailsSchema = std<ProblemDetails>({"type":"object","title":"ProblemDetails","description":"RFC-9457 Problem Details (application/problem+json).","properties":{"type":{"type":"string","format":"uri-reference","default":"about:blank"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"instance":{"type":"string","format":"uri-reference"},"errors":{"type":"object","additionalProperties":true},"error":{"type":"string","deprecated":true}},"required":["type","title","status"]});
export type Category = { id: number; name: string; slug: string };
export const CategorySchema = std<Category>({"type":"object","properties":{"id":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"name":{"type":"string"},"slug":{"type":"string"}},"required":["id","name","slug"],"additionalProperties":false});
export type Product = { id: number; name: string; slug: string; description: string | null; priceCents: number; categoryId: number | null; inventory: number; imageUrl: string | null; status: "draft" | "published"; stripePriceId: string | null };
export const ProductSchema = std<Product>({"type":"object","properties":{"id":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"name":{"type":"string"},"slug":{"type":"string"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"priceCents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"categoryId":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"inventory":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"imageUrl":{"anyOf":[{"type":"string"},{"type":"null"}]},"status":{"type":"string","enum":["draft","published"]},"stripePriceId":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","name","slug","description","priceCents","categoryId","inventory","imageUrl","status","stripePriceId"],"additionalProperties":false});
export type Variant = { id: number; productId: number; title: string; priceCents: number; inventory: number };
export const VariantSchema = std<Variant>({"type":"object","properties":{"id":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"productId":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"title":{"type":"string"},"priceCents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"inventory":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["id","productId","title","priceCents","inventory"],"additionalProperties":false});
export type DiscountCode = { id: number; code: string; discountType: "percent" | "fixed"; discountValue: number; isActive: boolean; currentUses: number; maxUses: number | null; expiresAt: number | null };
export const DiscountCodeSchema = std<DiscountCode>({"type":"object","properties":{"id":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"code":{"type":"string"},"discountType":{"type":"string","enum":["percent","fixed"]},"discountValue":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"isActive":{"type":"boolean"},"currentUses":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"maxUses":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"expiresAt":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]}},"required":["id","code","discountType","discountValue","isActive","currentUses","maxUses","expiresAt"],"additionalProperties":false});
export type Cart = { id: number; customerId: string | null; items: string; discountCode: string | null; status: "active" | "converted" | "abandoned" };
export const CartSchema = std<Cart>({"type":"object","properties":{"id":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"customerId":{"anyOf":[{"type":"string"},{"type":"null"}]},"items":{"type":"string"},"discountCode":{"anyOf":[{"type":"string"},{"type":"null"}]},"status":{"type":"string","enum":["active","converted","abandoned"]}},"required":["id","customerId","items","discountCode","status"],"additionalProperties":false});
export type Order = { id: number; customerId: string | null; items: string; totalCents: number; status: "pending" | "paid" | "shipped" | "cancelled"; discountCode: string | null; stripePaymentIntentId: string | null; createdAt: number | null };
export const OrderSchema = std<Order>({"type":"object","properties":{"id":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"customerId":{"anyOf":[{"type":"string"},{"type":"null"}]},"items":{"type":"string"},"totalCents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"status":{"type":"string","enum":["pending","paid","shipped","cancelled"]},"discountCode":{"anyOf":[{"type":"string"},{"type":"null"}]},"stripePaymentIntentId":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]}},"required":["id","customerId","items","totalCents","status","discountCode","stripePaymentIntentId","createdAt"],"additionalProperties":false});
export type Review = { id: number; productId: number; customerId: string | null; rating: number; title: string; body: string | null; status: "pending" | "published"; helpfulCount: number; createdAt: number | null };
export const ReviewSchema = std<Review>({"type":"object","properties":{"id":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"productId":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"customerId":{"anyOf":[{"type":"string"},{"type":"null"}]},"rating":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"title":{"type":"string"},"body":{"anyOf":[{"type":"string"},{"type":"null"}]},"status":{"type":"string","enum":["pending","published"]},"helpfulCount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"createdAt":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]}},"required":["id","productId","customerId","rating","title","body","status","helpfulCount","createdAt"],"additionalProperties":false});
export type WishlistItem = { id: number; customerId: string | null; productId: number; variantId: number | null; addedAt: number | null };
export const WishlistItemSchema = std<WishlistItem>({"type":"object","properties":{"id":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"customerId":{"anyOf":[{"type":"string"},{"type":"null"}]},"productId":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"variantId":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"addedAt":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]}},"required":["id","customerId","productId","variantId","addedAt"],"additionalProperties":false});
export type Post = { id: number; title: string; slug: string; excerpt: string | null; body: string | null; status: "draft" | "published"; publishedAt: number | null; authorId: string | null; coverImageUrl: string | null };
export const PostSchema = std<Post>({"type":"object","properties":{"id":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"title":{"type":"string"},"slug":{"type":"string"},"excerpt":{"anyOf":[{"type":"string"},{"type":"null"}]},"body":{"anyOf":[{"type":"string"},{"type":"null"}]},"status":{"type":"string","enum":["draft","published"]},"publishedAt":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"authorId":{"anyOf":[{"type":"string"},{"type":"null"}]},"coverImageUrl":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","title","slug","excerpt","body","status","publishedAt","authorId","coverImageUrl"],"additionalProperties":false});
export type Faq = { id: number; question: string; answer: string; sortOrder: number; isActive: boolean };
export const FaqSchema = std<Faq>({"type":"object","properties":{"id":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"question":{"type":"string"},"answer":{"type":"string"},"sortOrder":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"isActive":{"type":"boolean"}},"required":["id","question","answer","sortOrder","isActive"],"additionalProperties":false});
export type NewsletterSubscriber = { id: number; email: string; subscribedAt: number | null };
export const NewsletterSubscriberSchema = std<NewsletterSubscriber>({"type":"object","properties":{"id":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"email":{"type":"string"},"subscribedAt":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]}},"required":["id","email","subscribedAt"],"additionalProperties":false});
export type ContactSubmission = { id: number; name: string; email: string; subject: string; message: string; createdAt: number | null };
export const ContactSubmissionSchema = std<ContactSubmission>({"type":"object","properties":{"id":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"name":{"type":"string"},"email":{"type":"string"},"subject":{"type":"string"},"message":{"type":"string"},"createdAt":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]}},"required":["id","name","email","subject","message","createdAt"],"additionalProperties":false});
export type Media = { id: number; url: string; alt: string; width: number | null; height: number | null };
export const MediaSchema = std<Media>({"type":"object","properties":{"id":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"url":{"type":"string"},"alt":{"type":"string"},"width":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"height":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]}},"required":["id","url","alt","width","height"],"additionalProperties":false});
export type ApiToken = { id: number; userId: string | null; name: string; prefix: string; hashedKey: string; createdAt: number | null; lastUsedAt: number | null; revokedAt: number | null };
export const ApiTokenSchema = std<ApiToken>({"type":"object","properties":{"id":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"userId":{"anyOf":[{"type":"string"},{"type":"null"}]},"name":{"type":"string"},"prefix":{"type":"string"},"hashedKey":{"type":"string"},"createdAt":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"lastUsedAt":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"revokedAt":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]}},"required":["id","userId","name","prefix","hashedKey","createdAt","lastUsedAt","revokedAt"],"additionalProperties":false});
export type BillingAccount = { id: number; principal: string; stripeCustomerId: string | null; subscriptionId: string | null; lastReportedMicroUsd: number | null; lastReportedAt: number | null; createdAt: number | null };
export const BillingAccountSchema = std<BillingAccount>({"type":"object","properties":{"id":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"principal":{"type":"string"},"stripeCustomerId":{"anyOf":[{"type":"string"},{"type":"null"}]},"subscriptionId":{"anyOf":[{"type":"string"},{"type":"null"}]},"lastReportedMicroUsd":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"lastReportedAt":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"createdAt":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]}},"required":["id","principal","stripeCustomerId","subscriptionId","lastReportedMicroUsd","lastReportedAt","createdAt"],"additionalProperties":false});
export type Project = { id: number; name: string; ownerId: string | null; status: "active" | "archived" };
export const ProjectSchema = std<Project>({"type":"object","properties":{"id":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"name":{"type":"string"},"ownerId":{"anyOf":[{"type":"string"},{"type":"null"}]},"status":{"type":"string","enum":["active","archived"]}},"required":["id","name","ownerId","status"],"additionalProperties":false});

const category_list_q = std<{ page?: number; perPage?: number; sort?: string; order?: "asc" | "desc"; q?: string }>(schemas.category_list_q);
const category_createInput = std<{ id?: number; name: string; slug: string }>(schemas.category_create);
const category_updateInput = std<{ id?: number; name: string; slug: string }>(schemas.category_update);
const product_list_q = std<{ page?: number; perPage?: number; sort?: string; order?: "asc" | "desc"; q?: string }>(schemas.product_list_q);
const product_createInput = std<{ id?: number; name: string; slug: string; description?: string | null; priceCents?: number; categoryId?: number | null; inventory?: number; imageUrl?: string | null; status?: "draft" | "published"; stripePriceId?: string | null }>(schemas.product_create);
const product_updateInput = std<{ id?: number; name: string; slug: string; description?: string | null; priceCents?: number; categoryId?: number | null; inventory?: number; imageUrl?: string | null; status?: "draft" | "published"; stripePriceId?: string | null }>(schemas.product_update);
const variant_list_q = std<{ page?: number; perPage?: number; sort?: string; order?: "asc" | "desc"; q?: string }>(schemas.variant_list_q);
const variant_createInput = std<{ id?: number; productId: number; title: string; priceCents?: number; inventory?: number }>(schemas.variant_create);
const variant_updateInput = std<{ id?: number; productId: number; title: string; priceCents?: number; inventory?: number }>(schemas.variant_update);
const discountCode_list_q = std<{ page?: number; perPage?: number; sort?: string; order?: "asc" | "desc"; q?: string }>(schemas.discountCode_list_q);
const discountCode_createInput = std<{ id?: number; code: string; discountType?: "percent" | "fixed"; discountValue?: number; isActive?: boolean; currentUses?: number; maxUses?: number | null; expiresAt?: number | null }>(schemas.discountCode_create);
const discountCode_updateInput = std<{ id?: number; code: string; discountType?: "percent" | "fixed"; discountValue?: number; isActive?: boolean; currentUses?: number; maxUses?: number | null; expiresAt?: number | null }>(schemas.discountCode_update);
const cart_list_q = std<{ page?: number; perPage?: number; sort?: string; order?: "asc" | "desc"; q?: string }>(schemas.cart_list_q);
const cart_createInput = std<{ id?: number; customerId?: string | null; items?: string; discountCode?: string | null; status?: "active" | "converted" | "abandoned" }>(schemas.cart_create);
const cart_updateInput = std<{ id?: number; customerId?: string | null; items?: string; discountCode?: string | null; status?: "active" | "converted" | "abandoned" }>(schemas.cart_update);
const order_list_q = std<{ page?: number; perPage?: number; sort?: string; order?: "asc" | "desc"; q?: string }>(schemas.order_list_q);
const order_createInput = std<{ id?: number; customerId?: string | null; items?: string; totalCents?: number; status?: "pending" | "paid" | "shipped" | "cancelled"; discountCode?: string | null; stripePaymentIntentId?: string | null; createdAt?: number | null }>(schemas.order_create);
const order_updateInput = std<{ id?: number; customerId?: string | null; items?: string; totalCents?: number; status?: "pending" | "paid" | "shipped" | "cancelled"; discountCode?: string | null; stripePaymentIntentId?: string | null; createdAt?: number | null }>(schemas.order_update);
const review_list_q = std<{ page?: number; perPage?: number; sort?: string; order?: "asc" | "desc"; q?: string }>(schemas.review_list_q);
const review_createInput = std<{ id?: number; productId: number; customerId?: string | null; rating?: number; title: string; body?: string | null; status?: "pending" | "published"; helpfulCount?: number; createdAt?: number | null }>(schemas.review_create);
const review_updateInput = std<{ id?: number; productId: number; customerId?: string | null; rating?: number; title: string; body?: string | null; status?: "pending" | "published"; helpfulCount?: number; createdAt?: number | null }>(schemas.review_update);
const wishlistItem_list_q = std<{ page?: number; perPage?: number; sort?: string; order?: "asc" | "desc"; q?: string }>(schemas.wishlistItem_list_q);
const wishlistItem_createInput = std<{ id?: number; customerId?: string | null; productId: number; variantId?: number | null; addedAt?: number | null }>(schemas.wishlistItem_create);
const wishlistItem_updateInput = std<{ id?: number; customerId?: string | null; productId: number; variantId?: number | null; addedAt?: number | null }>(schemas.wishlistItem_update);
const post_list_q = std<{ page?: number; perPage?: number; sort?: string; order?: "asc" | "desc"; q?: string }>(schemas.post_list_q);
const post_createInput = std<{ id?: number; title: string; slug: string; excerpt?: string | null; body?: string | null; status?: "draft" | "published"; publishedAt?: number | null; authorId?: string | null; coverImageUrl?: string | null }>(schemas.post_create);
const post_updateInput = std<{ id?: number; title: string; slug: string; excerpt?: string | null; body?: string | null; status?: "draft" | "published"; publishedAt?: number | null; authorId?: string | null; coverImageUrl?: string | null }>(schemas.post_update);
const faq_list_q = std<{ page?: number; perPage?: number; sort?: string; order?: "asc" | "desc"; q?: string }>(schemas.faq_list_q);
const faq_createInput = std<{ id?: number; question: string; answer: string; sortOrder?: number; isActive?: boolean }>(schemas.faq_create);
const faq_updateInput = std<{ id?: number; question: string; answer: string; sortOrder?: number; isActive?: boolean }>(schemas.faq_update);
const newsletterSubscriber_list_q = std<{ page?: number; perPage?: number; sort?: string; order?: "asc" | "desc"; q?: string }>(schemas.newsletterSubscriber_list_q);
const newsletterSubscriber_createInput = std<{ id?: number; email: string; subscribedAt?: number | null }>(schemas.newsletterSubscriber_create);
const newsletterSubscriber_updateInput = std<{ id?: number; email: string; subscribedAt?: number | null }>(schemas.newsletterSubscriber_update);
const contactSubmission_list_q = std<{ page?: number; perPage?: number; sort?: string; order?: "asc" | "desc"; q?: string }>(schemas.contactSubmission_list_q);
const contactSubmission_createInput = std<{ id?: number; name: string; email: string; subject: string; message: string; createdAt?: number | null }>(schemas.contactSubmission_create);
const contactSubmission_updateInput = std<{ id?: number; name: string; email: string; subject: string; message: string; createdAt?: number | null }>(schemas.contactSubmission_update);
const media_list_q = std<{ page?: number; perPage?: number; sort?: string; order?: "asc" | "desc"; q?: string }>(schemas.media_list_q);
const media_createInput = std<{ id?: number; url: string; alt: string; width?: number | null; height?: number | null }>(schemas.media_create);
const media_updateInput = std<{ id?: number; url: string; alt: string; width?: number | null; height?: number | null }>(schemas.media_update);
const apiToken_list_q = std<{ page?: number; perPage?: number; sort?: string; order?: "asc" | "desc"; q?: string }>(schemas.apiToken_list_q);
const apiToken_createInput = std<{ id?: number; userId?: string | null; name: string; prefix: string; hashedKey: string; createdAt?: number | null; lastUsedAt?: number | null; revokedAt?: number | null }>(schemas.apiToken_create);
const apiToken_updateInput = std<{ id?: number; userId?: string | null; name: string; prefix: string; hashedKey: string; createdAt?: number | null; lastUsedAt?: number | null; revokedAt?: number | null }>(schemas.apiToken_update);
const billingAccount_list_q = std<{ page?: number; perPage?: number; sort?: string; order?: "asc" | "desc"; q?: string }>(schemas.billingAccount_list_q);
const billingAccount_createInput = std<{ id?: number; principal: string; stripeCustomerId?: string | null; subscriptionId?: string | null; lastReportedMicroUsd?: number | null; lastReportedAt?: number | null; createdAt?: number | null }>(schemas.billingAccount_create);
const billingAccount_updateInput = std<{ id?: number; principal: string; stripeCustomerId?: string | null; subscriptionId?: string | null; lastReportedMicroUsd?: number | null; lastReportedAt?: number | null; createdAt?: number | null }>(schemas.billingAccount_update);
const project_list_q = std<{ page?: number; perPage?: number; sort?: string; order?: "asc" | "desc"; q?: string }>(schemas.project_list_q);
const project_createInput = std<{ id?: number; name: string; ownerId?: string | null; status?: "active" | "archived" }>(schemas.project_create);
const project_updateInput = std<{ id?: number; name: string; ownerId?: string | null; status?: "active" | "archived" }>(schemas.project_update);
const checkout_orderInput = std<{ cartId?: number; items?: { productId?: number; qty?: number; priceCents?: number }[]; discountCode?: string }>(schemas.checkout_order);
const discount_validateInput = std<{ code: string; subtotalCents?: number }>(schemas.discount_validate);
const search_q = std<{ q?: string }>(schemas.search_q);
const newsletter_subscribeInput = std<{ email: string }>(schemas.newsletter_subscribe);
const avatar_q = std<{ seed?: string }>(schemas.avatar_q);
const token_createInput = std<{ name: string }>(schemas.token_create);
const checkout_payInput = std<{ items?: { productId?: number; qty?: number }[]; discountCode?: string }>(schemas.checkout_pay);
const checkout_confirmInput = std<{ orderId: number; sessionId: string }>(schemas.checkout_confirm);
const billing_connectInput = std<{ email?: string }>(schemas.billing_connect);
const billing_reportInput = std<Record<string, unknown>>(schemas.billing_report);

export interface SulukClientConfig {
  /** API base URL (default: same-origin "https://saasuluk.saastemly.com"). */
  baseURL?: string;
  /** a bearer token, or a (sync/async) getter — injected as `Authorization: Bearer …` on every request. */
  token?: string | (() => string | null | undefined | Promise<string | null | undefined>);
  /** send cookies for session auth (default "include"). */
  credentials?: RequestCredentials;
  /** extra default headers (e.g. a `x-suluk-action` tag for cost attribution). */
  headers?: Record<string, string>;
  /** retries for idempotent requests (ofetch default). */
  retry?: number;
  /** validate inputs against the contract's JSON Schemas before sending (default true). */
  validate?: boolean;
}

/** Create a typed, input-validating client for Saasuluk API (Cloudflare). */
export function createClient(config: SulukClientConfig = {}) {
  const _v = config.validate !== false;
  const api = ofetch.create({
    baseURL: config.baseURL ?? "https://saasuluk.saastemly.com",
    credentials: config.credentials ?? "include",
    headers: config.headers,
    retry: config.retry,
    async onRequest({ options }) {
      const t = typeof config.token === "function" ? await config.token() : config.token;
      if (t) { const h = new Headers(options.headers as HeadersInit | undefined); h.set("Authorization", `Bearer ${t}`); options.headers = h; }
    },
  });
  return {
      /** Search products + blog posts — anyone · ⛁ 14µ$ */
      search: Object.assign(
        (query?: { q?: string }) => api<Record<string, unknown>>(`/search`, { method: "GET", query: _v && query ? parse(search_q, query) : query }),
        { cost: 14, requires: "anyone" },
      ),
      /** Related products — anyone · ⛁ 16µ$ */
      recommendations: Object.assign(
        (productId: string | number) => api<Record<string, unknown>>(`/recommendations/${productId}`, { method: "GET" }),
        { cost: 16, requires: "anyone" },
      ),
      /** Deterministic identicon SVG — anyone · ⛁ 2µ$ */
      avatar: Object.assign(
        (query?: { seed?: string }) => api<string>(`/avatar`, { method: "GET", query: _v && query ? parse(avatar_q, query) : query }),
        { cost: 2, requires: "anyone" },
      ),
      analytics: {
        /** Store summary (orders, revenue, customers) — admin · ⛁ 20µ$ */
        summary: Object.assign(
          () => api<Record<string, unknown>>(`/analytics/summary`, { method: "GET" }),
          { cost: 20, requires: "admin" },
        ),
        /** Revenue per day (last 30d) — admin · ⛁ 20µ$ */
        revenue: Object.assign(
          () => api<Record<string, unknown>>(`/analytics/revenue`, { method: "GET" }),
          { cost: 20, requires: "admin" },
        ),
        /** Best-selling products — admin · ⛁ 24µ$ */
        topProducts: Object.assign(
          () => api<Record<string, unknown>>(`/analytics/top-products`, { method: "GET" }),
          { cost: 24, requires: "admin" },
        )
      },
      apiToken: {
        /** List ApiToken — authenticated · ⛁ 8µ$ */
        list: Object.assign(
          (query?: { page?: number; perPage?: number; sort?: string; order?: "asc" | "desc"; q?: string }) => api<{ id?: number; userId?: string | null; name: string; prefix: string; hashedKey: string; createdAt?: number | null; lastUsedAt?: number | null; revokedAt?: number | null }[]>(`/apiToken`, { method: "GET", query: _v && query ? parse(apiToken_list_q, query) : query }),
          { cost: 8, requires: "authenticated", scope: "owner" },
        ),
        /** Create ApiToken — authenticated · ⛁ 130µ$ */
        create: Object.assign(
          (body: { id?: number; userId?: string | null; name: string; prefix: string; hashedKey: string; createdAt?: number | null; lastUsedAt?: number | null; revokedAt?: number | null }) => api<{ id?: number; userId?: string | null; name: string; prefix: string; hashedKey: string; createdAt?: number | null; lastUsedAt?: number | null; revokedAt?: number | null }>(`/apiToken`, { method: "POST", body: _v ? parse(apiToken_createInput, body) : body }),
          { cost: 130, requires: "authenticated", scope: "owner", input: apiToken_createInput },
        ),
        /** Get ApiToken by id — authenticated · ⛁ 8µ$ */
        get: Object.assign(
          (id: string | number) => api<{ id?: number; userId?: string | null; name: string; prefix: string; hashedKey: string; createdAt?: number | null; lastUsedAt?: number | null; revokedAt?: number | null }>(`/apiToken/${id}`, { method: "GET" }),
          { cost: 8, requires: "authenticated", scope: "owner" },
        ),
        /** Update ApiToken — authenticated · ⛁ 130µ$ */
        update: Object.assign(
          (id: string | number, body: { id?: number; userId?: string | null; name: string; prefix: string; hashedKey: string; createdAt?: number | null; lastUsedAt?: number | null; revokedAt?: number | null }) => api<{ id?: number; userId?: string | null; name: string; prefix: string; hashedKey: string; createdAt?: number | null; lastUsedAt?: number | null; revokedAt?: number | null }>(`/apiToken/${id}`, { method: "PATCH", body: _v ? parse(apiToken_updateInput, body) : body }),
          { cost: 130, requires: "authenticated", scope: "owner", input: apiToken_updateInput },
        ),
        /** Delete ApiToken — authenticated · ⛁ 118µ$ */
        delete_: Object.assign(
          (id: string | number) => api<unknown>(`/apiToken/${id}`, { method: "DELETE" }),
          { cost: 118, requires: "authenticated", scope: "owner" },
        )
      },
      billing: {
        /** Start usage-based billing: a Stripe customer + a metered subscription — authenticated · ⛁ 160µ$ */
        connect: Object.assign(
          (body: { email?: string }) => api<Record<string, unknown>>(`/billing/connect`, { method: "POST", body: _v ? parse(billing_connectInput, body) : body }),
          { cost: 160, requires: "authenticated", input: billing_connectInput },
        ),
        /** Report your accrued @suluk/cost usage to the Stripe Billing Meter — authenticated · ⛁ 140µ$ */
        report: Object.assign(
          (body: Record<string, unknown>) => api<Record<string, unknown>>(`/billing/report`, { method: "POST", body: _v ? parse(billing_reportInput, body) : body }),
          { cost: 140, requires: "authenticated", scope: "owner", input: billing_reportInput },
        )
      },
      billingAccount: {
        /** List BillingAccount — authenticated · ⛁ 8µ$ */
        list: Object.assign(
          (query?: { page?: number; perPage?: number; sort?: string; order?: "asc" | "desc"; q?: string }) => api<{ id?: number; principal: string; stripeCustomerId?: string | null; subscriptionId?: string | null; lastReportedMicroUsd?: number | null; lastReportedAt?: number | null; createdAt?: number | null }[]>(`/billingAccount`, { method: "GET", query: _v && query ? parse(billingAccount_list_q, query) : query }),
          { cost: 8, requires: "authenticated", scope: "owner" },
        ),
        /** Create BillingAccount — admin · ⛁ 130µ$ */
        create: Object.assign(
          (body: { id?: number; principal: string; stripeCustomerId?: string | null; subscriptionId?: string | null; lastReportedMicroUsd?: number | null; lastReportedAt?: number | null; createdAt?: number | null }) => api<{ id?: number; principal: string; stripeCustomerId?: string | null; subscriptionId?: string | null; lastReportedMicroUsd?: number | null; lastReportedAt?: number | null; createdAt?: number | null }>(`/billingAccount`, { method: "POST", body: _v ? parse(billingAccount_createInput, body) : body }),
          { cost: 130, requires: "admin", input: billingAccount_createInput },
        ),
        /** Get BillingAccount by id — authenticated · ⛁ 8µ$ */
        get: Object.assign(
          (id: string | number) => api<{ id?: number; principal: string; stripeCustomerId?: string | null; subscriptionId?: string | null; lastReportedMicroUsd?: number | null; lastReportedAt?: number | null; createdAt?: number | null }>(`/billingAccount/${id}`, { method: "GET" }),
          { cost: 8, requires: "authenticated", scope: "owner" },
        ),
        /** Update BillingAccount — admin · ⛁ 130µ$ */
        update: Object.assign(
          (id: string | number, body: { id?: number; principal: string; stripeCustomerId?: string | null; subscriptionId?: string | null; lastReportedMicroUsd?: number | null; lastReportedAt?: number | null; createdAt?: number | null }) => api<{ id?: number; principal: string; stripeCustomerId?: string | null; subscriptionId?: string | null; lastReportedMicroUsd?: number | null; lastReportedAt?: number | null; createdAt?: number | null }>(`/billingAccount/${id}`, { method: "PATCH", body: _v ? parse(billingAccount_updateInput, body) : body }),
          { cost: 130, requires: "admin", input: billingAccount_updateInput },
        ),
        /** Delete BillingAccount — admin · ⛁ 118µ$ */
        delete_: Object.assign(
          (id: string | number) => api<unknown>(`/billingAccount/${id}`, { method: "DELETE" }),
          { cost: 118, requires: "admin" },
        )
      },
      cart: {
        /** List Cart — authenticated · ⛁ 10µ$ */
        list: Object.assign(
          (query?: { page?: number; perPage?: number; sort?: string; order?: "asc" | "desc"; q?: string }) => api<{ id?: number; customerId?: string | null; items?: string; discountCode?: string | null; status?: "active" | "converted" | "abandoned" }[]>(`/cart`, { method: "GET", query: _v && query ? parse(cart_list_q, query) : query }),
          { cost: 10, requires: "authenticated", scope: "owner" },
        ),
        /** Create Cart — authenticated · ⛁ 135µ$ */
        create: Object.assign(
          (body: { id?: number; customerId?: string | null; items?: string; discountCode?: string | null; status?: "active" | "converted" | "abandoned" }) => api<{ id?: number; customerId?: string | null; items?: string; discountCode?: string | null; status?: "active" | "converted" | "abandoned" }>(`/cart`, { method: "POST", body: _v ? parse(cart_createInput, body) : body }),
          { cost: 135, requires: "authenticated", scope: "owner", input: cart_createInput },
        ),
        /** Get Cart by id — authenticated · ⛁ 10µ$ */
        get: Object.assign(
          (id: string | number) => api<{ id?: number; customerId?: string | null; items?: string; discountCode?: string | null; status?: "active" | "converted" | "abandoned" }>(`/cart/${id}`, { method: "GET" }),
          { cost: 10, requires: "authenticated", scope: "owner" },
        ),
        /** Update Cart — authenticated · ⛁ 135µ$ */
        update: Object.assign(
          (id: string | number, body: { id?: number; customerId?: string | null; items?: string; discountCode?: string | null; status?: "active" | "converted" | "abandoned" }) => api<{ id?: number; customerId?: string | null; items?: string; discountCode?: string | null; status?: "active" | "converted" | "abandoned" }>(`/cart/${id}`, { method: "PATCH", body: _v ? parse(cart_updateInput, body) : body }),
          { cost: 135, requires: "authenticated", scope: "owner", input: cart_updateInput },
        ),
        /** Delete Cart — authenticated · ⛁ 121µ$ */
        delete_: Object.assign(
          (id: string | number) => api<unknown>(`/cart/${id}`, { method: "DELETE" }),
          { cost: 121, requires: "authenticated", scope: "owner" },
        )
      },
      category: {
        /** List Category — anyone · ⛁ 8µ$ */
        list: Object.assign(
          (query?: { page?: number; perPage?: number; sort?: string; order?: "asc" | "desc"; q?: string }) => api<{ id?: number; name: string; slug: string }[]>(`/category`, { method: "GET", query: _v && query ? parse(category_list_q, query) : query }),
          { cost: 8, requires: "anyone" },
        ),
        /** Create Category — admin · ⛁ 130µ$ */
        create: Object.assign(
          (body: { id?: number; name: string; slug: string }) => api<{ id?: number; name: string; slug: string }>(`/category`, { method: "POST", body: _v ? parse(category_createInput, body) : body }),
          { cost: 130, requires: "admin", input: category_createInput },
        ),
        /** Get Category by id — anyone · ⛁ 8µ$ */
        get: Object.assign(
          (id: string | number) => api<{ id?: number; name: string; slug: string }>(`/category/${id}`, { method: "GET" }),
          { cost: 8, requires: "anyone" },
        ),
        /** Update Category — admin · ⛁ 130µ$ */
        update: Object.assign(
          (id: string | number, body: { id?: number; name: string; slug: string }) => api<{ id?: number; name: string; slug: string }>(`/category/${id}`, { method: "PATCH", body: _v ? parse(category_updateInput, body) : body }),
          { cost: 130, requires: "admin", input: category_updateInput },
        ),
        /** Delete Category — admin · ⛁ 118µ$ */
        delete_: Object.assign(
          (id: string | number) => api<unknown>(`/category/${id}`, { method: "DELETE" }),
          { cost: 118, requires: "admin" },
        )
      },
      checkout: {
        /** Create an order from a cart (apply discount, total) — anyone · ⛁ 180µ$ */
        order: Object.assign(
          (body: { cartId?: number; items?: { productId?: number; qty?: number; priceCents?: number }[]; discountCode?: string }) => api<Record<string, unknown>>(`/checkout/order`, { method: "POST", body: _v ? parse(checkout_orderInput, body) : body }),
          { cost: 180, requires: "anyone", input: checkout_orderInput },
        ),
        /** Create a pending order + a Stripe Checkout Session (returns the hosted URL) — anyone · ⛁ 190µ$ */
        pay: Object.assign(
          (body: { items?: { productId?: number; qty?: number }[]; discountCode?: string }) => api<Record<string, unknown>>(`/checkout/pay`, { method: "POST", body: _v ? parse(checkout_payInput, body) : body }),
          { cost: 190, requires: "anyone", input: checkout_payInput },
        ),
        /** Confirm payment by retrieving the Stripe session; mark the order paid — anyone · ⛁ 30µ$ */
        confirm: Object.assign(
          (body: { orderId: number; sessionId: string }) => api<Record<string, unknown>>(`/checkout/confirm`, { method: "POST", body: _v ? parse(checkout_confirmInput, body) : body }),
          { cost: 30, requires: "anyone", input: checkout_confirmInput },
        )
      },
      contactSubmission: {
        /** List ContactSubmission — admin · ⛁ 6µ$ */
        list: Object.assign(
          (query?: { page?: number; perPage?: number; sort?: string; order?: "asc" | "desc"; q?: string }) => api<{ id?: number; name: string; email: string; subject: string; message: string; createdAt?: number | null }[]>(`/contactSubmission`, { method: "GET", query: _v && query ? parse(contactSubmission_list_q, query) : query }),
          { cost: 6, requires: "admin" },
        ),
        /** Create ContactSubmission — anyone · ⛁ 120µ$ */
        create: Object.assign(
          (body: { id?: number; name: string; email: string; subject: string; message: string; createdAt?: number | null }) => api<{ id?: number; name: string; email: string; subject: string; message: string; createdAt?: number | null }>(`/contactSubmission`, { method: "POST", body: _v ? parse(contactSubmission_createInput, body) : body }),
          { cost: 120, requires: "anyone", input: contactSubmission_createInput },
        ),
        /** Get ContactSubmission by id — admin · ⛁ 6µ$ */
        get: Object.assign(
          (id: string | number) => api<{ id?: number; name: string; email: string; subject: string; message: string; createdAt?: number | null }>(`/contactSubmission/${id}`, { method: "GET" }),
          { cost: 6, requires: "admin" },
        ),
        /** Update ContactSubmission — admin · ⛁ 120µ$ */
        update: Object.assign(
          (id: string | number, body: { id?: number; name: string; email: string; subject: string; message: string; createdAt?: number | null }) => api<{ id?: number; name: string; email: string; subject: string; message: string; createdAt?: number | null }>(`/contactSubmission/${id}`, { method: "PATCH", body: _v ? parse(contactSubmission_updateInput, body) : body }),
          { cost: 120, requires: "admin", input: contactSubmission_updateInput },
        ),
        /** Delete ContactSubmission — admin · ⛁ 115µ$ */
        delete_: Object.assign(
          (id: string | number) => api<unknown>(`/contactSubmission/${id}`, { method: "DELETE" }),
          { cost: 115, requires: "admin" },
        )
      },
      discount: {
        /** Validate a discount code — anyone · ⛁ 10µ$ */
        validate: Object.assign(
          (body: { code: string; subtotalCents?: number }) => api<Record<string, unknown>>(`/discount/validate`, { method: "POST", body: _v ? parse(discount_validateInput, body) : body }),
          { cost: 10, requires: "anyone", input: discount_validateInput },
        )
      },
      discountCode: {
        /** List DiscountCode — admin · ⛁ 8µ$ */
        list: Object.assign(
          (query?: { page?: number; perPage?: number; sort?: string; order?: "asc" | "desc"; q?: string }) => api<{ id?: number; code: string; discountType?: "percent" | "fixed"; discountValue?: number; isActive?: boolean; currentUses?: number; maxUses?: number | null; expiresAt?: number | null }[]>(`/discountCode`, { method: "GET", query: _v && query ? parse(discountCode_list_q, query) : query }),
          { cost: 8, requires: "admin" },
        ),
        /** Create DiscountCode — admin · ⛁ 130µ$ */
        create: Object.assign(
          (body: { id?: number; code: string; discountType?: "percent" | "fixed"; discountValue?: number; isActive?: boolean; currentUses?: number; maxUses?: number | null; expiresAt?: number | null }) => api<{ id?: number; code: string; discountType?: "percent" | "fixed"; discountValue?: number; isActive?: boolean; currentUses?: number; maxUses?: number | null; expiresAt?: number | null }>(`/discountCode`, { method: "POST", body: _v ? parse(discountCode_createInput, body) : body }),
          { cost: 130, requires: "admin", input: discountCode_createInput },
        ),
        /** Get DiscountCode by id — admin · ⛁ 8µ$ */
        get: Object.assign(
          (id: string | number) => api<{ id?: number; code: string; discountType?: "percent" | "fixed"; discountValue?: number; isActive?: boolean; currentUses?: number; maxUses?: number | null; expiresAt?: number | null }>(`/discountCode/${id}`, { method: "GET" }),
          { cost: 8, requires: "admin" },
        ),
        /** Update DiscountCode — admin · ⛁ 130µ$ */
        update: Object.assign(
          (id: string | number, body: { id?: number; code: string; discountType?: "percent" | "fixed"; discountValue?: number; isActive?: boolean; currentUses?: number; maxUses?: number | null; expiresAt?: number | null }) => api<{ id?: number; code: string; discountType?: "percent" | "fixed"; discountValue?: number; isActive?: boolean; currentUses?: number; maxUses?: number | null; expiresAt?: number | null }>(`/discountCode/${id}`, { method: "PATCH", body: _v ? parse(discountCode_updateInput, body) : body }),
          { cost: 130, requires: "admin", input: discountCode_updateInput },
        ),
        /** Delete DiscountCode — admin · ⛁ 118µ$ */
        delete_: Object.assign(
          (id: string | number) => api<unknown>(`/discountCode/${id}`, { method: "DELETE" }),
          { cost: 118, requires: "admin" },
        )
      },
      faq: {
        /** List Faq — anyone · ⛁ 6µ$ */
        list: Object.assign(
          (query?: { page?: number; perPage?: number; sort?: string; order?: "asc" | "desc"; q?: string }) => api<{ id?: number; question: string; answer: string; sortOrder?: number; isActive?: boolean }[]>(`/faq`, { method: "GET", query: _v && query ? parse(faq_list_q, query) : query }),
          { cost: 6, requires: "anyone" },
        ),
        /** Create Faq — admin · ⛁ 125µ$ */
        create: Object.assign(
          (body: { id?: number; question: string; answer: string; sortOrder?: number; isActive?: boolean }) => api<{ id?: number; question: string; answer: string; sortOrder?: number; isActive?: boolean }>(`/faq`, { method: "POST", body: _v ? parse(faq_createInput, body) : body }),
          { cost: 125, requires: "admin", input: faq_createInput },
        ),
        /** Get Faq by id — anyone · ⛁ 6µ$ */
        get: Object.assign(
          (id: string | number) => api<{ id?: number; question: string; answer: string; sortOrder?: number; isActive?: boolean }>(`/faq/${id}`, { method: "GET" }),
          { cost: 6, requires: "anyone" },
        ),
        /** Update Faq — admin · ⛁ 125µ$ */
        update: Object.assign(
          (id: string | number, body: { id?: number; question: string; answer: string; sortOrder?: number; isActive?: boolean }) => api<{ id?: number; question: string; answer: string; sortOrder?: number; isActive?: boolean }>(`/faq/${id}`, { method: "PATCH", body: _v ? parse(faq_updateInput, body) : body }),
          { cost: 125, requires: "admin", input: faq_updateInput },
        ),
        /** Delete Faq — admin · ⛁ 115µ$ */
        delete_: Object.assign(
          (id: string | number) => api<unknown>(`/faq/${id}`, { method: "DELETE" }),
          { cost: 115, requires: "admin" },
        )
      },
      media: {
        /** List Media — anyone · ⛁ 6µ$ */
        list: Object.assign(
          (query?: { page?: number; perPage?: number; sort?: string; order?: "asc" | "desc"; q?: string }) => api<{ id?: number; url: string; alt: string; width?: number | null; height?: number | null }[]>(`/media`, { method: "GET", query: _v && query ? parse(media_list_q, query) : query }),
          { cost: 6, requires: "anyone" },
        ),
        /** Create Media — admin · ⛁ 125µ$ */
        create: Object.assign(
          (body: { id?: number; url: string; alt: string; width?: number | null; height?: number | null }) => api<{ id?: number; url: string; alt: string; width?: number | null; height?: number | null }>(`/media`, { method: "POST", body: _v ? parse(media_createInput, body) : body }),
          { cost: 125, requires: "admin", input: media_createInput },
        ),
        /** Get Media by id — anyone · ⛁ 6µ$ */
        get: Object.assign(
          (id: string | number) => api<{ id?: number; url: string; alt: string; width?: number | null; height?: number | null }>(`/media/${id}`, { method: "GET" }),
          { cost: 6, requires: "anyone" },
        ),
        /** Update Media — admin · ⛁ 125µ$ */
        update: Object.assign(
          (id: string | number, body: { id?: number; url: string; alt: string; width?: number | null; height?: number | null }) => api<{ id?: number; url: string; alt: string; width?: number | null; height?: number | null }>(`/media/${id}`, { method: "PATCH", body: _v ? parse(media_updateInput, body) : body }),
          { cost: 125, requires: "admin", input: media_updateInput },
        ),
        /** Delete Media — admin · ⛁ 115µ$ */
        delete_: Object.assign(
          (id: string | number) => api<unknown>(`/media/${id}`, { method: "DELETE" }),
          { cost: 115, requires: "admin" },
        )
      },
      newsletter: {
        /** Subscribe to the newsletter (idempotent) — anyone · ⛁ 120µ$ */
        subscribe: Object.assign(
          (body: { email: string }) => api<Record<string, unknown>>(`/newsletter/subscribe`, { method: "POST", body: _v ? parse(newsletter_subscribeInput, body) : body }),
          { cost: 120, requires: "anyone", input: newsletter_subscribeInput },
        )
      },
      newsletterSubscriber: {
        /** List NewsletterSubscriber — admin · ⛁ 6µ$ */
        list: Object.assign(
          (query?: { page?: number; perPage?: number; sort?: string; order?: "asc" | "desc"; q?: string }) => api<{ id?: number; email: string; subscribedAt?: number | null }[]>(`/newsletterSubscriber`, { method: "GET", query: _v && query ? parse(newsletterSubscriber_list_q, query) : query }),
          { cost: 6, requires: "admin" },
        ),
        /** Create NewsletterSubscriber — anyone · ⛁ 120µ$ */
        create: Object.assign(
          (body: { id?: number; email: string; subscribedAt?: number | null }) => api<{ id?: number; email: string; subscribedAt?: number | null }>(`/newsletterSubscriber`, { method: "POST", body: _v ? parse(newsletterSubscriber_createInput, body) : body }),
          { cost: 120, requires: "anyone", input: newsletterSubscriber_createInput },
        ),
        /** Get NewsletterSubscriber by id — admin · ⛁ 6µ$ */
        get: Object.assign(
          (id: string | number) => api<{ id?: number; email: string; subscribedAt?: number | null }>(`/newsletterSubscriber/${id}`, { method: "GET" }),
          { cost: 6, requires: "admin" },
        ),
        /** Update NewsletterSubscriber — admin · ⛁ 120µ$ */
        update: Object.assign(
          (id: string | number, body: { id?: number; email: string; subscribedAt?: number | null }) => api<{ id?: number; email: string; subscribedAt?: number | null }>(`/newsletterSubscriber/${id}`, { method: "PATCH", body: _v ? parse(newsletterSubscriber_updateInput, body) : body }),
          { cost: 120, requires: "admin", input: newsletterSubscriber_updateInput },
        ),
        /** Delete NewsletterSubscriber — admin · ⛁ 115µ$ */
        delete_: Object.assign(
          (id: string | number) => api<unknown>(`/newsletterSubscriber/${id}`, { method: "DELETE" }),
          { cost: 115, requires: "admin" },
        )
      },
      order: {
        /** List Order — authenticated · ⛁ 12µ$ */
        list: Object.assign(
          (query?: { page?: number; perPage?: number; sort?: string; order?: "asc" | "desc"; q?: string }) => api<{ id?: number; customerId?: string | null; items?: string; totalCents?: number; status?: "pending" | "paid" | "shipped" | "cancelled"; discountCode?: string | null; stripePaymentIntentId?: string | null; createdAt?: number | null }[]>(`/order`, { method: "GET", query: _v && query ? parse(order_list_q, query) : query }),
          { cost: 12, requires: "authenticated", scope: "owner" },
        ),
        /** Create Order — authenticated · ⛁ 160µ$ */
        create: Object.assign(
          (body: { id?: number; customerId?: string | null; items?: string; totalCents?: number; status?: "pending" | "paid" | "shipped" | "cancelled"; discountCode?: string | null; stripePaymentIntentId?: string | null; createdAt?: number | null }) => api<{ id?: number; customerId?: string | null; items?: string; totalCents?: number; status?: "pending" | "paid" | "shipped" | "cancelled"; discountCode?: string | null; stripePaymentIntentId?: string | null; createdAt?: number | null }>(`/order`, { method: "POST", body: _v ? parse(order_createInput, body) : body }),
          { cost: 160, requires: "authenticated", scope: "owner", input: order_createInput },
        ),
        /** Get Order by id — authenticated · ⛁ 12µ$ */
        get: Object.assign(
          (id: string | number) => api<{ id?: number; customerId?: string | null; items?: string; totalCents?: number; status?: "pending" | "paid" | "shipped" | "cancelled"; discountCode?: string | null; stripePaymentIntentId?: string | null; createdAt?: number | null }>(`/order/${id}`, { method: "GET" }),
          { cost: 12, requires: "authenticated", scope: "owner" },
        ),
        /** Update Order — admin · ⛁ 160µ$ */
        update: Object.assign(
          (id: string | number, body: { id?: number; customerId?: string | null; items?: string; totalCents?: number; status?: "pending" | "paid" | "shipped" | "cancelled"; discountCode?: string | null; stripePaymentIntentId?: string | null; createdAt?: number | null }) => api<{ id?: number; customerId?: string | null; items?: string; totalCents?: number; status?: "pending" | "paid" | "shipped" | "cancelled"; discountCode?: string | null; stripePaymentIntentId?: string | null; createdAt?: number | null }>(`/order/${id}`, { method: "PATCH", body: _v ? parse(order_updateInput, body) : body }),
          { cost: 160, requires: "admin", input: order_updateInput },
        ),
        /** Delete Order — admin · ⛁ 136µ$ */
        delete_: Object.assign(
          (id: string | number) => api<unknown>(`/order/${id}`, { method: "DELETE" }),
          { cost: 136, requires: "admin" },
        )
      },
      post: {
        /** List Post — anyone · ⛁ 8µ$ */
        list: Object.assign(
          (query?: { page?: number; perPage?: number; sort?: string; order?: "asc" | "desc"; q?: string }) => api<{ id?: number; title: string; slug: string; excerpt?: string | null; body?: string | null; status?: "draft" | "published"; publishedAt?: number | null; authorId?: string | null; coverImageUrl?: string | null }[]>(`/post`, { method: "GET", query: _v && query ? parse(post_list_q, query) : query }),
          { cost: 8, requires: "anyone" },
        ),
        /** Create Post — admin · ⛁ 145µ$ */
        create: Object.assign(
          (body: { id?: number; title: string; slug: string; excerpt?: string | null; body?: string | null; status?: "draft" | "published"; publishedAt?: number | null; authorId?: string | null; coverImageUrl?: string | null }) => api<{ id?: number; title: string; slug: string; excerpt?: string | null; body?: string | null; status?: "draft" | "published"; publishedAt?: number | null; authorId?: string | null; coverImageUrl?: string | null }>(`/post`, { method: "POST", body: _v ? parse(post_createInput, body) : body }),
          { cost: 145, requires: "admin", input: post_createInput },
        ),
        /** Get Post by id — anyone · ⛁ 8µ$ */
        get: Object.assign(
          (id: string | number) => api<{ id?: number; title: string; slug: string; excerpt?: string | null; body?: string | null; status?: "draft" | "published"; publishedAt?: number | null; authorId?: string | null; coverImageUrl?: string | null }>(`/post/${id}`, { method: "GET" }),
          { cost: 8, requires: "anyone" },
        ),
        /** Update Post — admin · ⛁ 145µ$ */
        update: Object.assign(
          (id: string | number, body: { id?: number; title: string; slug: string; excerpt?: string | null; body?: string | null; status?: "draft" | "published"; publishedAt?: number | null; authorId?: string | null; coverImageUrl?: string | null }) => api<{ id?: number; title: string; slug: string; excerpt?: string | null; body?: string | null; status?: "draft" | "published"; publishedAt?: number | null; authorId?: string | null; coverImageUrl?: string | null }>(`/post/${id}`, { method: "PATCH", body: _v ? parse(post_updateInput, body) : body }),
          { cost: 145, requires: "admin", input: post_updateInput },
        ),
        /** Delete Post — admin · ⛁ 127µ$ */
        delete_: Object.assign(
          (id: string | number) => api<unknown>(`/post/${id}`, { method: "DELETE" }),
          { cost: 127, requires: "admin" },
        )
      },
      product: {
        /** List Product — anyone · ⛁ 10µ$ */
        list: Object.assign(
          (query?: { page?: number; perPage?: number; sort?: string; order?: "asc" | "desc"; q?: string }) => api<{ id?: number; name: string; slug: string; description?: string | null; priceCents?: number; categoryId?: number | null; inventory?: number; imageUrl?: string | null; status?: "draft" | "published"; stripePriceId?: string | null }[]>(`/product`, { method: "GET", query: _v && query ? parse(product_list_q, query) : query }),
          { cost: 10, requires: "anyone" },
        ),
        /** Create Product — admin · ⛁ 145µ$ */
        create: Object.assign(
          (body: { id?: number; name: string; slug: string; description?: string | null; priceCents?: number; categoryId?: number | null; inventory?: number; imageUrl?: string | null; status?: "draft" | "published"; stripePriceId?: string | null }) => api<{ id?: number; name: string; slug: string; description?: string | null; priceCents?: number; categoryId?: number | null; inventory?: number; imageUrl?: string | null; status?: "draft" | "published"; stripePriceId?: string | null }>(`/product`, { method: "POST", body: _v ? parse(product_createInput, body) : body }),
          { cost: 145, requires: "admin", input: product_createInput },
        ),
        /** Get Product by id — anyone · ⛁ 10µ$ */
        get: Object.assign(
          (id: string | number) => api<{ id?: number; name: string; slug: string; description?: string | null; priceCents?: number; categoryId?: number | null; inventory?: number; imageUrl?: string | null; status?: "draft" | "published"; stripePriceId?: string | null }>(`/product/${id}`, { method: "GET" }),
          { cost: 10, requires: "anyone" },
        ),
        /** Update Product — admin · ⛁ 145µ$ */
        update: Object.assign(
          (id: string | number, body: { id?: number; name: string; slug: string; description?: string | null; priceCents?: number; categoryId?: number | null; inventory?: number; imageUrl?: string | null; status?: "draft" | "published"; stripePriceId?: string | null }) => api<{ id?: number; name: string; slug: string; description?: string | null; priceCents?: number; categoryId?: number | null; inventory?: number; imageUrl?: string | null; status?: "draft" | "published"; stripePriceId?: string | null }>(`/product/${id}`, { method: "PATCH", body: _v ? parse(product_updateInput, body) : body }),
          { cost: 145, requires: "admin", input: product_updateInput },
        ),
        /** Delete Product — admin · ⛁ 127µ$ */
        delete_: Object.assign(
          (id: string | number) => api<unknown>(`/product/${id}`, { method: "DELETE" }),
          { cost: 127, requires: "admin" },
        )
      },
      project: {
        /** List Project — authenticated · ⛁ 12µ$ */
        list: Object.assign(
          (query?: { page?: number; perPage?: number; sort?: string; order?: "asc" | "desc"; q?: string }) => api<{ id?: number; name: string; ownerId?: string | null; status?: "active" | "archived" }[]>(`/project`, { method: "GET", query: _v && query ? parse(project_list_q, query) : query }),
          { cost: 12, requires: "authenticated", scope: "owner" },
        ),
        /** Create Project — authenticated · ⛁ 140µ$ */
        create: Object.assign(
          (body: { id?: number; name: string; ownerId?: string | null; status?: "active" | "archived" }) => api<{ id?: number; name: string; ownerId?: string | null; status?: "active" | "archived" }>(`/project`, { method: "POST", body: _v ? parse(project_createInput, body) : body }),
          { cost: 140, requires: "authenticated", scope: "owner", input: project_createInput },
        ),
        /** Get Project by id — authenticated · ⛁ 12µ$ */
        get: Object.assign(
          (id: string | number) => api<{ id?: number; name: string; ownerId?: string | null; status?: "active" | "archived" }>(`/project/${id}`, { method: "GET" }),
          { cost: 12, requires: "authenticated", scope: "owner" },
        ),
        /** Update Project — authenticated · ⛁ 140µ$ */
        update: Object.assign(
          (id: string | number, body: { id?: number; name: string; ownerId?: string | null; status?: "active" | "archived" }) => api<{ id?: number; name: string; ownerId?: string | null; status?: "active" | "archived" }>(`/project/${id}`, { method: "PATCH", body: _v ? parse(project_updateInput, body) : body }),
          { cost: 140, requires: "authenticated", scope: "owner", input: project_updateInput },
        ),
        /** Delete Project — authenticated · ⛁ 124µ$ */
        delete_: Object.assign(
          (id: string | number) => api<unknown>(`/project/${id}`, { method: "DELETE" }),
          { cost: 124, requires: "authenticated", scope: "owner" },
        )
      },
      review: {
        /** List Review — anyone · ⛁ 8µ$ */
        list: Object.assign(
          (query?: { page?: number; perPage?: number; sort?: string; order?: "asc" | "desc"; q?: string }) => api<{ id?: number; productId: number; customerId?: string | null; rating?: number; title: string; body?: string | null; status?: "pending" | "published"; helpfulCount?: number; createdAt?: number | null }[]>(`/review`, { method: "GET", query: _v && query ? parse(review_list_q, query) : query }),
          { cost: 8, requires: "anyone" },
        ),
        /** Create Review — authenticated · ⛁ 140µ$ */
        create: Object.assign(
          (body: { id?: number; productId: number; customerId?: string | null; rating?: number; title: string; body?: string | null; status?: "pending" | "published"; helpfulCount?: number; createdAt?: number | null }) => api<{ id?: number; productId: number; customerId?: string | null; rating?: number; title: string; body?: string | null; status?: "pending" | "published"; helpfulCount?: number; createdAt?: number | null }>(`/review`, { method: "POST", body: _v ? parse(review_createInput, body) : body }),
          { cost: 140, requires: "authenticated", scope: "owner", input: review_createInput },
        ),
        /** Get Review by id — anyone · ⛁ 8µ$ */
        get: Object.assign(
          (id: string | number) => api<{ id?: number; productId: number; customerId?: string | null; rating?: number; title: string; body?: string | null; status?: "pending" | "published"; helpfulCount?: number; createdAt?: number | null }>(`/review/${id}`, { method: "GET" }),
          { cost: 8, requires: "anyone" },
        ),
        /** Update Review — authenticated · ⛁ 140µ$ */
        update: Object.assign(
          (id: string | number, body: { id?: number; productId: number; customerId?: string | null; rating?: number; title: string; body?: string | null; status?: "pending" | "published"; helpfulCount?: number; createdAt?: number | null }) => api<{ id?: number; productId: number; customerId?: string | null; rating?: number; title: string; body?: string | null; status?: "pending" | "published"; helpfulCount?: number; createdAt?: number | null }>(`/review/${id}`, { method: "PATCH", body: _v ? parse(review_updateInput, body) : body }),
          { cost: 140, requires: "authenticated", scope: "owner", input: review_updateInput },
        ),
        /** Delete Review — authenticated · ⛁ 124µ$ */
        delete_: Object.assign(
          (id: string | number) => api<unknown>(`/review/${id}`, { method: "DELETE" }),
          { cost: 124, requires: "authenticated", scope: "owner" },
        ),
        /** Mark a review helpful (+1) — authenticated · ⛁ 120µ$ */
        helpful: Object.assign(
          (id: string | number) => api<Record<string, unknown>>(`/review/${id}/helpful`, { method: "POST" }),
          { cost: 120, requires: "authenticated" },
        )
      },
      token: {
        /** Create an API token (returns the secret ONCE) — authenticated · ⛁ 130µ$ */
        create: Object.assign(
          (body: { name: string }) => api<Record<string, unknown>>(`/tokens/create`, { method: "POST", body: _v ? parse(token_createInput, body) : body }),
          { cost: 130, requires: "authenticated", input: token_createInput },
        )
      },
      tokens: {
        /** Revoke an API token — authenticated · ⛁ 120µ$ */
        revoke: Object.assign(
          (id: string | number) => api<Record<string, unknown>>(`/tokens/${id}/revoke`, { method: "POST" }),
          { cost: 120, requires: "authenticated", scope: "owner" },
        )
      },
      variant: {
        /** List Variant — anyone · ⛁ 8µ$ */
        list: Object.assign(
          (query?: { page?: number; perPage?: number; sort?: string; order?: "asc" | "desc"; q?: string }) => api<{ id?: number; productId: number; title: string; priceCents?: number; inventory?: number }[]>(`/variant`, { method: "GET", query: _v && query ? parse(variant_list_q, query) : query }),
          { cost: 8, requires: "anyone" },
        ),
        /** Create Variant — admin · ⛁ 130µ$ */
        create: Object.assign(
          (body: { id?: number; productId: number; title: string; priceCents?: number; inventory?: number }) => api<{ id?: number; productId: number; title: string; priceCents?: number; inventory?: number }>(`/variant`, { method: "POST", body: _v ? parse(variant_createInput, body) : body }),
          { cost: 130, requires: "admin", input: variant_createInput },
        ),
        /** Get Variant by id — anyone · ⛁ 8µ$ */
        get: Object.assign(
          (id: string | number) => api<{ id?: number; productId: number; title: string; priceCents?: number; inventory?: number }>(`/variant/${id}`, { method: "GET" }),
          { cost: 8, requires: "anyone" },
        ),
        /** Update Variant — admin · ⛁ 130µ$ */
        update: Object.assign(
          (id: string | number, body: { id?: number; productId: number; title: string; priceCents?: number; inventory?: number }) => api<{ id?: number; productId: number; title: string; priceCents?: number; inventory?: number }>(`/variant/${id}`, { method: "PATCH", body: _v ? parse(variant_updateInput, body) : body }),
          { cost: 130, requires: "admin", input: variant_updateInput },
        ),
        /** Delete Variant — admin · ⛁ 118µ$ */
        delete_: Object.assign(
          (id: string | number) => api<unknown>(`/variant/${id}`, { method: "DELETE" }),
          { cost: 118, requires: "admin" },
        )
      },
      wishlistItem: {
        /** List WishlistItem — authenticated · ⛁ 8µ$ */
        list: Object.assign(
          (query?: { page?: number; perPage?: number; sort?: string; order?: "asc" | "desc"; q?: string }) => api<{ id?: number; customerId?: string | null; productId: number; variantId?: number | null; addedAt?: number | null }[]>(`/wishlistItem`, { method: "GET", query: _v && query ? parse(wishlistItem_list_q, query) : query }),
          { cost: 8, requires: "authenticated", scope: "owner" },
        ),
        /** Create WishlistItem — authenticated · ⛁ 125µ$ */
        create: Object.assign(
          (body: { id?: number; customerId?: string | null; productId: number; variantId?: number | null; addedAt?: number | null }) => api<{ id?: number; customerId?: string | null; productId: number; variantId?: number | null; addedAt?: number | null }>(`/wishlistItem`, { method: "POST", body: _v ? parse(wishlistItem_createInput, body) : body }),
          { cost: 125, requires: "authenticated", scope: "owner", input: wishlistItem_createInput },
        ),
        /** Get WishlistItem by id — authenticated · ⛁ 8µ$ */
        get: Object.assign(
          (id: string | number) => api<{ id?: number; customerId?: string | null; productId: number; variantId?: number | null; addedAt?: number | null }>(`/wishlistItem/${id}`, { method: "GET" }),
          { cost: 8, requires: "authenticated", scope: "owner" },
        ),
        /** Update WishlistItem — authenticated · ⛁ 125µ$ */
        update: Object.assign(
          (id: string | number, body: { id?: number; customerId?: string | null; productId: number; variantId?: number | null; addedAt?: number | null }) => api<{ id?: number; customerId?: string | null; productId: number; variantId?: number | null; addedAt?: number | null }>(`/wishlistItem/${id}`, { method: "PATCH", body: _v ? parse(wishlistItem_updateInput, body) : body }),
          { cost: 125, requires: "authenticated", scope: "owner", input: wishlistItem_updateInput },
        ),
        /** Delete WishlistItem — authenticated · ⛁ 115µ$ */
        delete_: Object.assign(
          (id: string | number) => api<unknown>(`/wishlistItem/${id}`, { method: "DELETE" }),
          { cost: 115, requires: "authenticated", scope: "owner" },
        )
      },
    /** the raw ofetch instance — escape hatch for anything the typed methods don't cover. */
    $fetch: api,
    /** the contract's input JSON Schemas, as data (for codegen / forms / introspection). */
    $schemas: schemas,
    /** introspectable per-operation facet manifest (for agents/tooling): { "<method.path>": { cost, requires } }. */
    $manifest: {"category.list":{"cost":8,"requires":"anyone"},"category.create":{"cost":130,"requires":"admin"},"category.get":{"cost":8,"requires":"anyone"},"category.update":{"cost":130,"requires":"admin"},"category.delete":{"cost":118,"requires":"admin"},"product.list":{"cost":10,"requires":"anyone"},"product.create":{"cost":145,"requires":"admin"},"product.get":{"cost":10,"requires":"anyone"},"product.update":{"cost":145,"requires":"admin"},"product.delete":{"cost":127,"requires":"admin"},"variant.list":{"cost":8,"requires":"anyone"},"variant.create":{"cost":130,"requires":"admin"},"variant.get":{"cost":8,"requires":"anyone"},"variant.update":{"cost":130,"requires":"admin"},"variant.delete":{"cost":118,"requires":"admin"},"discountCode.list":{"cost":8,"requires":"admin"},"discountCode.create":{"cost":130,"requires":"admin"},"discountCode.get":{"cost":8,"requires":"admin"},"discountCode.update":{"cost":130,"requires":"admin"},"discountCode.delete":{"cost":118,"requires":"admin"},"cart.list":{"cost":10,"requires":"authenticated","scope":"owner"},"cart.create":{"cost":135,"requires":"authenticated","scope":"owner"},"cart.get":{"cost":10,"requires":"authenticated","scope":"owner"},"cart.update":{"cost":135,"requires":"authenticated","scope":"owner"},"cart.delete":{"cost":121,"requires":"authenticated","scope":"owner"},"order.list":{"cost":12,"requires":"authenticated","scope":"owner"},"order.create":{"cost":160,"requires":"authenticated","scope":"owner"},"order.get":{"cost":12,"requires":"authenticated","scope":"owner"},"order.update":{"cost":160,"requires":"admin"},"order.delete":{"cost":136,"requires":"admin"},"review.list":{"cost":8,"requires":"anyone"},"review.create":{"cost":140,"requires":"authenticated","scope":"owner"},"review.get":{"cost":8,"requires":"anyone"},"review.update":{"cost":140,"requires":"authenticated","scope":"owner"},"review.delete":{"cost":124,"requires":"authenticated","scope":"owner"},"wishlistItem.list":{"cost":8,"requires":"authenticated","scope":"owner"},"wishlistItem.create":{"cost":125,"requires":"authenticated","scope":"owner"},"wishlistItem.get":{"cost":8,"requires":"authenticated","scope":"owner"},"wishlistItem.update":{"cost":125,"requires":"authenticated","scope":"owner"},"wishlistItem.delete":{"cost":115,"requires":"authenticated","scope":"owner"},"post.list":{"cost":8,"requires":"anyone"},"post.create":{"cost":145,"requires":"admin"},"post.get":{"cost":8,"requires":"anyone"},"post.update":{"cost":145,"requires":"admin"},"post.delete":{"cost":127,"requires":"admin"},"faq.list":{"cost":6,"requires":"anyone"},"faq.create":{"cost":125,"requires":"admin"},"faq.get":{"cost":6,"requires":"anyone"},"faq.update":{"cost":125,"requires":"admin"},"faq.delete":{"cost":115,"requires":"admin"},"newsletterSubscriber.list":{"cost":6,"requires":"admin"},"newsletterSubscriber.create":{"cost":120,"requires":"anyone"},"newsletterSubscriber.get":{"cost":6,"requires":"admin"},"newsletterSubscriber.update":{"cost":120,"requires":"admin"},"newsletterSubscriber.delete":{"cost":115,"requires":"admin"},"contactSubmission.list":{"cost":6,"requires":"admin"},"contactSubmission.create":{"cost":120,"requires":"anyone"},"contactSubmission.get":{"cost":6,"requires":"admin"},"contactSubmission.update":{"cost":120,"requires":"admin"},"contactSubmission.delete":{"cost":115,"requires":"admin"},"media.list":{"cost":6,"requires":"anyone"},"media.create":{"cost":125,"requires":"admin"},"media.get":{"cost":6,"requires":"anyone"},"media.update":{"cost":125,"requires":"admin"},"media.delete":{"cost":115,"requires":"admin"},"apiToken.list":{"cost":8,"requires":"authenticated","scope":"owner"},"apiToken.create":{"cost":130,"requires":"authenticated","scope":"owner"},"apiToken.get":{"cost":8,"requires":"authenticated","scope":"owner"},"apiToken.update":{"cost":130,"requires":"authenticated","scope":"owner"},"apiToken.delete":{"cost":118,"requires":"authenticated","scope":"owner"},"billingAccount.list":{"cost":8,"requires":"authenticated","scope":"owner"},"billingAccount.create":{"cost":130,"requires":"admin"},"billingAccount.get":{"cost":8,"requires":"authenticated","scope":"owner"},"billingAccount.update":{"cost":130,"requires":"admin"},"billingAccount.delete":{"cost":118,"requires":"admin"},"project.list":{"cost":12,"requires":"authenticated","scope":"owner"},"project.create":{"cost":140,"requires":"authenticated","scope":"owner"},"project.get":{"cost":12,"requires":"authenticated","scope":"owner"},"project.update":{"cost":140,"requires":"authenticated","scope":"owner"},"project.delete":{"cost":124,"requires":"authenticated","scope":"owner"},"checkout.order":{"cost":180,"requires":"anyone"},"discount.validate":{"cost":10,"requires":"anyone"},"search":{"cost":14,"requires":"anyone"},"review.helpful":{"cost":120,"requires":"authenticated"},"analytics.summary":{"cost":20,"requires":"admin"},"analytics.revenue":{"cost":20,"requires":"admin"},"analytics.topProducts":{"cost":24,"requires":"admin"},"recommendations":{"cost":16,"requires":"anyone"},"newsletter.subscribe":{"cost":120,"requires":"anyone"},"avatar":{"cost":2,"requires":"anyone"},"token.create":{"cost":130,"requires":"authenticated"},"tokens.revoke":{"cost":120,"requires":"authenticated","scope":"owner"},"checkout.pay":{"cost":190,"requires":"anyone"},"checkout.confirm":{"cost":30,"requires":"anyone"},"billing.connect":{"cost":160,"requires":"authenticated"},"billing.report":{"cost":140,"requires":"authenticated","scope":"owner"}} as const,
    /** total declared cost of all priced operations (µ$): 7744. */
    $meta: { operations: 96, totalDeclaredMicroUsd: 7744, version: "4.0.0-candidate" },
  };
}

export type SulukClient = ReturnType<typeof createClient>;
