/*!
 * Copyright (c) 2026 Vertex Software LLC. All rights reserved.
 */
import { Pager } from "@vertexvis/scene-view-protos/core/protos/paging_pb";
import { ListPmiAnnotationsRequest, } from "@vertexvis/scene-view-protos/sceneview/protos/scene_view_api_pb";
import { createMetadata, requestUnary } from "../grpc";
import { toUuid2l } from "../mappers/uuid";
import { mapListPmiAnnotationsResponseOrThrow } from "./mapper";
export class PmiController {
    constructor(client, jwtProvider, deviceIdProvider) {
        this.client = client;
        this.jwtProvider = jwtProvider;
        this.deviceIdProvider = deviceIdProvider;
    }
    async listAnnotations({ modelViewId, cursor, size = 50, } = {}) {
        const res = await requestUnary(async (handler) => {
            const deviceId = this.deviceIdProvider();
            const meta = await createMetadata(this.jwtProvider, deviceId);
            const req = new ListPmiAnnotationsRequest();
            if (modelViewId != null) {
                const modelViewId2l = toUuid2l(modelViewId);
                req.setModelViewId(modelViewId2l);
            }
            const page = new Pager();
            page.setLimit(size);
            if (cursor != null) {
                page.setCursor(cursor);
            }
            req.setPage(page);
            this.client.listPmiAnnotations(req, meta, handler);
        });
        return mapListPmiAnnotationsResponseOrThrow(res.toObject());
    }
}
//# sourceMappingURL=controller.js.map
