import type { Db } from './db.js';
import { stores } from './schema.js';
export type Store = typeof stores.$inferSelect;
export declare function resolveStore(db: Db, code: string | undefined): Promise<Store>;
export declare function listStores(db: Db): Promise<{
    storeId: number;
    code: string;
    name: string;
    websiteId: number;
    websiteCode: string | null;
    groupId: number;
    locale: string | null;
    baseCurrency: string | null;
    displayCurrency: string | null;
    timezone: string | null;
    baseUrl: string | null;
    mediaUrl: string | null;
    isActive: boolean;
    syncedAt: Date;
}[]>;
export interface ProductSearch {
    q?: string;
    categoryId?: number;
    typeId?: string;
    status?: 'enabled' | 'disabled';
    inStock?: boolean;
    limit: number;
    offset: number;
}
export interface ProductSummary {
    sku: string;
    name: string;
    typeId: string;
    status: string;
    visibility: string;
    price: number | null;
    specialPrice: number | null;
    effectivePrice: number | null;
    totalQty: number | null;
    inStock: boolean | null;
}
export declare function searchProducts(db: Db, store: Store, s: ProductSearch): Promise<{
    total: number;
    items: ProductSummary[];
}>;
export declare function getProductRow(db: Db, sku: string): Promise<{
    productId: number;
    sku: string;
    typeId: string;
    attributeSetId: number;
    websiteIds: number[];
    price: number | null;
    specialPrice: number | null;
    specialFrom: string | null;
    specialTo: string | null;
    tierPrices: import("./schema.js").TierPrice[];
    weight: number | null;
    magentoCreatedAt: Date | null;
    magentoUpdatedAt: Date;
    deletedAt: Date | null;
    syncedAt: Date;
}>;
export declare function getProduct(db: Db, store: Store, sku: string): Promise<{
    sku: string;
    productId: number;
    store: string;
    deleted: boolean;
    typeId: string;
    attributeSetId: number;
    name: string | null;
    status: string | null | undefined;
    visibility: string | null | undefined;
    urlKey: string | null;
    description: string | null;
    shortDescription: string | null;
    metaTitle: string | null;
    metaDescription: string | null;
    websiteIds: number[];
    weight: number | null;
    pricing: {
        tierPrices: import("./schema.js").TierPrice[];
        currency: string | null;
        effectivePrice: number | null;
        specialActive: boolean;
        price: number | null;
        specialPrice: number | null;
        specialFrom: string | null;
        specialTo: string | null;
    };
    inventory: {
        sku: string;
        totalQty: number | null;
        inStock: boolean | null;
        sources: {
            sourceCode: string;
            quantity: number;
            inStock: boolean;
            syncedAt: Date;
        }[];
        salable: {
            stockId: number;
            salableQty: number | null;
            isSalable: boolean | null;
            checkedAt: Date;
        }[];
    };
    categories: {
        categoryId: number;
        name: string | null;
        isActive: boolean | null;
        path: string;
    }[];
    images: {
        url: string | null;
        productId: number;
        file: string;
        label: string | null;
        position: number;
        roles: string[];
        disabled: boolean;
        mediaType: string;
    }[];
    variants: string[];
    bundleOrGroupedChildren: {
        sku: string;
        kind: "configurable" | "bundle" | "grouped";
    }[];
    parents: {
        sku: string;
        kind: "configurable" | "bundle" | "grouped";
    }[];
    links: {
        productId: number;
        linkType: string;
        linkedSku: string;
        position: number;
    }[];
    attributes: {
        code: string;
        label: string;
        value: unknown;
    }[];
    magentoUpdatedAt: Date;
    syncedAt: Date;
}>;
export declare function getPricing(db: Db, store: Store, sku: string): Promise<{
    tierPrices: import("./schema.js").TierPrice[];
    syncedAt: Date;
    effectivePrice: number | null;
    specialActive: boolean;
    price: number | null;
    specialPrice: number | null;
    specialFrom: string | null;
    specialTo: string | null;
    sku: string;
    store: string;
    currency: string | null;
}>;
export declare function getInventory(db: Db, sku: string): Promise<{
    sku: string;
    totalQty: number | null;
    inStock: boolean | null;
    sources: {
        sourceCode: string;
        quantity: number;
        inStock: boolean;
        syncedAt: Date;
    }[];
    salable: {
        stockId: number;
        salableQty: number | null;
        isSalable: boolean | null;
        checkedAt: Date;
    }[];
}>;
export declare function listCategories(db: Db, store: Store, parentId?: number): Promise<{
    categoryId: number;
    parentId: number;
    level: number;
    path: string;
    position: number;
    name: string | null;
    isActive: boolean | null;
    includeInMenu: boolean | null;
    productCount: number;
}[]>;
export declare function getCategory(db: Db, store: Store, categoryId: number): Promise<{
    breadcrumb: string[];
    children: {
        categoryId: number;
        parentId: number;
        level: number;
        path: string;
        position: number;
        name: string | null;
        isActive: boolean | null;
        includeInMenu: boolean | null;
        productCount: number;
    }[];
    categoryId: number;
    parentId: number;
    level: number;
    path: string;
    position: number;
    name: string | null;
    isActive: boolean | null;
    includeInMenu: boolean | null;
    productCount: number;
}>;
export declare function getAttribute(db: Db, code: string): Promise<{
    attributeCode: string;
    attributeId: number;
    label: string | null;
    frontendInput: string;
    isRequired: boolean;
    isUserDefined: boolean;
    scope: string | null;
    options: import("./schema.js").AttributeOption[];
    syncedAt: Date;
}>;
export declare function categoryExists(db: Db, categoryId: number): Promise<boolean>;
/** Facts needed to explain why a product might not be visible (see catalog-api visibility service). */
export declare function visibilityFacts(db: Db, store: Store, sku: string): Promise<{
    product: {
        sku: string;
        productId: number;
        store: string;
        deleted: boolean;
        typeId: string;
        attributeSetId: number;
        name: string | null;
        status: string | null | undefined;
        visibility: string | null | undefined;
        urlKey: string | null;
        description: string | null;
        shortDescription: string | null;
        metaTitle: string | null;
        metaDescription: string | null;
        websiteIds: number[];
        weight: number | null;
        pricing: {
            tierPrices: import("./schema.js").TierPrice[];
            currency: string | null;
            effectivePrice: number | null;
            specialActive: boolean;
            price: number | null;
            specialPrice: number | null;
            specialFrom: string | null;
            specialTo: string | null;
        };
        inventory: {
            sku: string;
            totalQty: number | null;
            inStock: boolean | null;
            sources: {
                sourceCode: string;
                quantity: number;
                inStock: boolean;
                syncedAt: Date;
            }[];
            salable: {
                stockId: number;
                salableQty: number | null;
                isSalable: boolean | null;
                checkedAt: Date;
            }[];
        };
        categories: {
            categoryId: number;
            name: string | null;
            isActive: boolean | null;
            path: string;
        }[];
        images: {
            url: string | null;
            productId: number;
            file: string;
            label: string | null;
            position: number;
            roles: string[];
            disabled: boolean;
            mediaType: string;
        }[];
        variants: string[];
        bundleOrGroupedChildren: {
            sku: string;
            kind: "configurable" | "bundle" | "grouped";
        }[];
        parents: {
            sku: string;
            kind: "configurable" | "bundle" | "grouped";
        }[];
        links: {
            productId: number;
            linkType: string;
            linkedSku: string;
            position: number;
        }[];
        attributes: {
            code: string;
            label: string;
            value: unknown;
        }[];
        magentoUpdatedAt: Date;
        syncedAt: Date;
    };
    store: {
        name: string;
        storeId: number;
        code: string;
        websiteId: number;
        websiteCode: string | null;
        groupId: number;
        locale: string | null;
        baseCurrency: string | null;
        displayCurrency: string | null;
        timezone: string | null;
        baseUrl: string | null;
        mediaUrl: string | null;
        isActive: boolean;
        syncedAt: Date;
    };
    hasStoreOverride: boolean;
    variantStates: {
        sku: string;
        status: number;
        in_stock: boolean | null;
    }[];
}>;
export declare function syncStatus(db: Db): Promise<{
    streams: {
        stream: string;
        cursor: string | null;
        lastSuccessAt: Date | null;
    }[];
    lastRunPerJob: {
        job: string;
        status: string;
        started_at: Date;
        finished_at: Date | null;
        stats: Record<string, number>;
        error: string | null;
    }[];
    lastFailure: {
        id: number;
        job: string;
        startedAt: Date;
        finishedAt: Date | null;
        status: "running" | "succeeded" | "failed";
        stats: Record<string, number>;
        error: string | null;
    } | null;
}>;
export declare function ping(db: Db): Promise<void>;
//# sourceMappingURL=reads.d.ts.map