"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getItemIdentifier = getItemIdentifier;
const slugConverters_1 = require("./_internal/slugConverters");
const slugs_1 = require("./_internal/slugs");
/**
 * Consistent means to get an item's identifier - either the slug or the id
 * @param item
 * @returns
 */
function getItemIdentifier(item, 
// for backwards compatibility, we do not include the id in the slug by default
// once all of the routes have been updated to expect slugs w/ ids, we should always include the id
includeIdInSlug = false) {
    const { id, properties } = item;
    const slug = properties === null || properties === void 0 ? void 0 : properties.slug;
    return slug
        ? (0, slugConverters_1.keywordSlugToUriSlug)(includeIdInSlug ? (0, slugs_1.appendIdToSlug)(slug, id) : slug)
        : id;
}
//# sourceMappingURL=getItemIdentifier.js.map