/*
 * Copyright (c) 2023-2025 Datalayer, Inc.
 * Distributed under the terms of the Modified BSD License.
 */
import { asUser } from './User.js';
import { asRuntimeSnapshot } from './RuntimeSnapshot.js';
export const asPage = (s) => {
    return {
        id: s.uid,
        type: 'page',
        variant: s.variant_s,
        name: s.name_t,
        description: s.description_t,
        theme: s.theme_s,
        nbformat: s.nbformat_s ? JSON.parse(s.nbformat_s) : undefined,
        screenCapture: s.screen_capture_cdn_url_s || s.screen_capture_s,
        tags: s.tags_ss ?? [],
        creator: s.creator ? asUser(s.creator) : undefined,
        creatorId: s.creator_uid,
        kernelSnapshot: s.kernel_snapshot
            ? asRuntimeSnapshot(s.kernel_snapshot)
            : undefined,
        kernelSnapshotId: s.kernel_snapshot_uid,
    };
};
