import { Querier } from '@platform-modules/db';
import { C as CatalogSchema, V as Variant, a as VariantPrice, P as Product, b as CatalogFilter, c as Page, d as ProductStatus, e as ProductInput } from './schema-CyGq5c3t.js';
export { M as MediaRef, f as Money, g as PriceMode, h as ProductKind, i as catalogSchema, j as category, k as collection, p as product, l as productCategory, m as productCollection, v as variant, n as variantPrice } from './schema-CyGq5c3t.js';
import 'drizzle-orm/pg-core';

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;

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>;

declare function resolvePrice(variant: Variant, currency: string): VariantPrice;

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>>;

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>;

export { CatalogFilter, CatalogMigrateError, CatalogSchema, type ImmutableField, ImmutableFieldError, NoPriceForCurrencyError, Page, Product, ProductInput, ProductStatus, ProductValidationError, type ReadOpts, Variant, VariantPrice, getProductById, getProductBySlug, isCatalogMigrateError, isImmutableFieldError, isNoPriceForCurrencyError, isProductValidationError, listProducts, pushSchema, resolvePrice, setProductStatus, setVariantPrices, upsertProduct };
