import type { PaginationParams } from '../../../providers/database/pagination/schemas.js';
import type { EntityReadModelSchema, EntityRelationReadModelSchema } from '../schemas/read-model-schemas.js';
import type { CatalogFiltersParams } from './repositories/local/catalog-entities-local-read-repository.js';
import type { BffCatalogEntity, BffCatalogEntityList, BffCatalogRelatedEntityList } from '@redocly/theme/core/types';
import type { DatabaseEntityRelation } from '../../../providers/database/databases/catalog-sqlite/schemas/entities-relations-table.js';
import type { ServiceInstanceOptions } from '../../../providers/database/types.js';
import type { TransactionsManager } from '../../../providers/database/transactions-manager.js';
import type { CreateEntityParams } from './repositories/local/catalog-entities-local-write-repository.js';
import type { Filter } from '../../../providers/database/pagination/types.js';
import type { HashManagerUpdateService } from '../utils/hash-manager.js';
import { type EntityDtoSchema, type EntityRelationDtoSchema } from '../schemas/dto-schemas.js';
import { CatalogEntitiesLocalRepository } from './repositories/local/catalog-entities-local-repository.js';
import { CatalogEntitiesRemoteRepository } from './repositories/remote/catalog-entities-remote-repository.js';
import { type ListResponseResult } from '../../../web-server/utils/prepare-list-response.js';
type BulkSyncResult<T> = Array<{
    status: 'ok';
    resource: T | null;
} | {
    key: string;
    status: 'error';
    error: string;
}>;
export declare class CatalogEntitiesService implements HashManagerUpdateService {
    #private;
    constructor(localRepository: CatalogEntitiesLocalRepository, remoteRepository?: CatalogEntitiesRemoteRepository);
    static getInstance(options: ServiceInstanceOptions): Promise<CatalogEntitiesService>;
    transaction<T>(...args: Parameters<TransactionsManager['transaction']>): Promise<T>;
    getEntities(paginationParams: PaginationParams): Promise<ListResponseResult<EntityReadModelSchema>>;
    getEntityByKey(key: string): Promise<EntityReadModelSchema | null>;
    getCatalogFilters(params: CatalogFiltersParams): Promise<Record<string, import("./repositories/local/catalog-entities-local-read-repository.js").FilterOption[]>>;
    createEntity(entity: EntityDtoSchema): Promise<EntityReadModelSchema | null>;
    createEntities(entities: EntityDtoSchema[]): Promise<BulkSyncResult<EntityReadModelSchema>>;
    getEntitySources(): Record<string, string>;
    /**
     * Use only internally, everything that is created via API should be created in the remote database.
     * @param entity - The entity to create.
     */
    createEntityInLocalDatabase(createEntityParams: CreateEntityParams): Promise<void>;
    /**
     * Use only internally, everything that is created via API should be created in the remote database.
     * @param entities - The entities to create.
     */
    createEntitiesInLocalDatabase(createEntitiesParams: CreateEntityParams[]): Promise<void>;
    /**
     * Use only internally, everything that is created via API should be created in the remote database.
     * @param relation - The entity to create.
     */
    createEntityRelationInLocalDatabase(relation: EntityRelationDtoSchema): Promise<void>;
    /**
     * Use only internally, everything that is created via API should be created in the remote database.
     * @param relations - The entity to create.
     */
    createEntityRelationsInLocalDatabase(relations: EntityRelationDtoSchema[]): Promise<void>;
    updateEntityByKey(key: string, incomingEntity: Record<string, {
        metadata: Record<string, unknown>;
    }>): Promise<EntityReadModelSchema | null | undefined>;
    deleteEntityByKey(key: string): Promise<string | null | undefined>;
    /**
     * Use only internally, everything that is created via API should be created in the remote database.
     * @param filter - The conditions used to select which entities to delete.
     */
    deleteEntitiesInLocalDatabase(filter: Filter): Promise<void>;
    getEntityRelationById(id: string): Promise<EntityRelationReadModelSchema | null>;
    getEntitiesRelations(paginationParams?: PaginationParams): Promise<ListResponseResult<{
        createdAt?: string | null | undefined;
        updatedAt?: string | null | undefined;
        type: string;
        id: string;
        organizationId: string;
        projectId: string;
        sourceKey: string;
        targetKey: string;
        sourceId: string;
        targetId: string;
    }>>;
    createEntityRelation(relation: EntityRelationDtoSchema): Promise<{
        id: string;
        createdAt: string;
        organizationId: string;
        projectId: string;
        sourceKey: string;
        targetKey: string;
        sourceId: string | null;
        targetId: string | null;
        updatedAt: string;
        sourceFile: string | null;
        fileHash: string | null;
        schemaVersion: number;
        sourceToTargetRelation: string;
        targetToSourceRelation: string;
    } | null | undefined>;
    createEntitiesRelations(entities: EntityRelationDtoSchema[]): Promise<BulkSyncResult<DatabaseEntityRelation>>;
    updateEntityRelation(id: string, relation: EntityRelationDtoSchema): Promise<{
        id: string;
        createdAt: string;
        organizationId: string;
        projectId: string;
        sourceKey: string;
        targetKey: string;
        sourceId: string | null;
        targetId: string | null;
        updatedAt: string;
        sourceFile: string | null;
        fileHash: string | null;
        schemaVersion: number;
        sourceToTargetRelation: string;
        targetToSourceRelation: string;
    } | null | undefined>;
    deleteEntityRelation(id: string): Promise<string | null>;
    /**
     * Use only internally, everything that is created via API should be created in the remote database.
     * @param filter - The conditions used to select which entity relations to delete.
     */
    deleteEntityRelationsInLocalDatabase(filter: Filter): Promise<void>;
    getEntitiesWithRelations(paginationParams?: PaginationParams): Promise<BffCatalogEntityList>;
    getEntityWithRelationsByKey(entityKey: string): Promise<BffCatalogEntity | null>;
    getRelatedEntities(entityKey: string, paginationParams?: PaginationParams): Promise<BffCatalogRelatedEntityList>;
    /**
     * Use only internally, everything that is removed via API should be removed in the remote database.
     * @param sourceFilePath - The source file path to delete.
     */
    deleteEntitiesAndRelationsByFilePathInLocalDatabase(sourceFilePath: string): Promise<void>;
    deleteEntitiesAndRelationsByHashInLocalDatabase(hash: string): Promise<void>;
    clearOutdatedRecords(outdatedHash: string): Promise<void>;
}
export {};
//# sourceMappingURL=catalog-entities-service.d.ts.map