import { _ as ProductKind, a as product, b as VariantPrice, c as variant, d as MediaRef, f as Money, g as ProductInput, h as Product, i as collection, l as variantPrice, m as PriceMode, n as catalogSchema, o as productCategory, p as Page, r as category, s as productCollection, t as CatalogSchema, u as CatalogFilter, v as ProductStatus, y as Variant } from "./schema-DgnFCZmi.js";
import { Querier } from "@platform-modules/db";
//#region src/errors.d.ts
declare class ProductValidationError extends Error {
  readonly field: string;
  readonly detail?: string | undefined;
  readonly name = "ProductValidationError";
  readonly code: "PRODUCT_VALIDATION";
  constructor(field: string, detail?: string | undefined);
}
declare class NoPriceForCurrencyError extends Error {
  readonly currency: string;
  readonly name = "NoPriceForCurrencyError";
  readonly code: "NO_PRICE_FOR_CURRENCY";
  constructor(currency: string);
}
/**
 * Fields frozen at create time on a catalog product. Typed union (not bare `string`)
 * so the DTS names exactly which fields are immutable. Family-canonical: every commerce
 * sibling declares its own `ImmutableField` union for its create-time-frozen FKs.
 */
type ImmutableField = 'kind' | 'vendorId';
/**
 * Family-canonical discriminated immutable-field error (commerce-conventions C5).
 * REPLACES the bespoke per-field `KindImmutableError`. Every commerce sibling reuses
 * this exact shape + the single `isImmutableFieldError` guard for its own immutable FKs.
 */
declare class ImmutableFieldError extends Error {
  readonly field: ImmutableField;
  readonly name = "ImmutableFieldError";
  readonly code: "IMMUTABLE_FIELD";
  constructor(field: ImmutableField);
}
declare function isProductValidationError(e: unknown): e is ProductValidationError;
declare function isNoPriceForCurrencyError(e: unknown): e is NoPriceForCurrencyError;
declare function isImmutableFieldError(e: unknown): e is ImmutableFieldError;
//#endregion
//#region src/migrate.d.ts
declare class CatalogMigrateError extends Error {
  readonly detail: string;
  readonly name = "CatalogMigrateError";
  readonly code: "CATALOG_MIGRATE";
  constructor(detail: string);
}
declare function isCatalogMigrateError(e: unknown): e is CatalogMigrateError;
declare function pushSchema(db: Querier<CatalogSchema>): Promise<void>;
//#endregion
//#region src/prices.d.ts
declare function resolvePrice(variant: Variant, currency: string): VariantPrice;
//#endregion
//#region src/reads.d.ts
type ReadOpts = {
  audience: 'public' | 'admin';
  vendorId?: string;
  now?: Date;
};
declare function getProductBySlug(db: Querier<CatalogSchema>, slug: string, opts: ReadOpts): Promise<Product | null>;
declare function getProductById(db: Querier<CatalogSchema>, id: string, opts: ReadOpts): Promise<Product | null>;
declare function listProducts(db: Querier<CatalogSchema>, filter: CatalogFilter): Promise<Page<Product>>;
//#endregion
//#region src/writes.d.ts
declare function upsertProduct(db: Querier<CatalogSchema>, input: ProductInput): Promise<Product>;
declare function setVariantPrices(db: Querier<CatalogSchema>, variantId: string, prices: VariantPrice[]): Promise<void>;
declare function setProductStatus(db: Querier<CatalogSchema>, id: string, status: ProductStatus): Promise<void>;
//#endregion
export { type CatalogFilter, CatalogMigrateError, type CatalogSchema, type ImmutableField, ImmutableFieldError, type MediaRef, type Money, NoPriceForCurrencyError, type Page, type PriceMode, type Product, type ProductInput, type ProductKind, type ProductStatus, ProductValidationError, type ReadOpts, type Variant, type VariantPrice, catalogSchema, category, collection, getProductById, getProductBySlug, isCatalogMigrateError, isImmutableFieldError, isNoPriceForCurrencyError, isProductValidationError, listProducts, product, productCategory, productCollection, pushSchema, resolvePrice, setProductStatus, setVariantPrices, upsertProduct, variant, variantPrice };