// Defines order for well-known item facets
// NOTE: contentstatus does not follow the kebab-case convention because AGO decided
// to use "contentstatus" (no hyphen, no camelcase) as the field name in the Portal API.
export const WELL_KNOWN_ITEM_FACET_TYPES = [
    "within",
    "organization",
    "hub-content",
    "type",
    "categories",
    "modified",
    "created",
    "location",
    "tags",
    "access",
    "contentstatus",
];
// Defines order for well-known group facets
export const WELL_KNOWN_GROUP_FACET_TYPES = [
    "group-within",
    // TODO: Switch "group-organization" to "organization" once translations are in place, see https://devtopia.esri.com/dc/hub/issues/14701
    "group-organization",
    "membership",
    "modified",
    // TODO: Switch "group-created" to "created" once translations are in place, see https://devtopia.esri.com/dc/hub/issues/14701
    "group-created",
    "group-type",
    "group-access",
];
// Defines order for well-known event facets
export const WELL_KNOWN_EVENT_FACET_TYPES = [
    "event-from",
    "event-access",
    "event-date",
];
// Defines order for well-known post facets
export const WELL_KNOWN_POST_FACET_TYPES = [
    "location",
    "modified",
    "post-groups",
    "post-status",
];
/**
 * A list of facet types that we can build IFacets for.
 * The default facet definitions are item based, for
 * entities that have different facet definations for
 * the same facet types, we prefix those facet types with
 * the entity type to differentiate them, e.g. "group-type".
 *
 * NOTE: When adding a new facet for an entity type, first
 * check if the facet exists in the FacetTypes and if the
 * facet definition is the same as the default one. If so,
 * simply add the facet key to the static array of well
 * known facets for that entity type (above). Otherwise,
 * add the new facet type to the relevant static array
 * and a new function to create the facet.
 *
 * WARNING: Do not import this combined list of facet types unless absolutely necessary.
 * Whenever possible, use the individual arrays of well-known facet types for each entity type
 * (e.g. WELL_KNOWN_ITEM_FACET_TYPES) to prevent facet ordering conflicts between entity types.
 */
export const WELL_KNOWN_FACET_TYPES = [
    ...new Set([
        ...WELL_KNOWN_ITEM_FACET_TYPES,
        ...WELL_KNOWN_GROUP_FACET_TYPES,
        ...WELL_KNOWN_EVENT_FACET_TYPES,
        ...WELL_KNOWN_POST_FACET_TYPES,
    ]),
];
/**
 * Given a well-known facet key, returns an array of entity types
 * that the facet is valid for
 *
 * @param facetKey the facet key to get the valid target entities for
 * @returns an array of entity types that the facet is valid for
 */
export function getFacetTargetEntities(facetKey) {
    const entities = [];
    if (WELL_KNOWN_ITEM_FACET_TYPES.includes(facetKey)) {
        entities.push("item");
    }
    if (WELL_KNOWN_GROUP_FACET_TYPES.includes(facetKey)) {
        entities.push("group");
    }
    if (WELL_KNOWN_EVENT_FACET_TYPES.includes(facetKey)) {
        entities.push("event");
    }
    if (WELL_KNOWN_POST_FACET_TYPES.includes(facetKey)) {
        entities.push("post");
    }
    return entities;
}
//# sourceMappingURL=wellKnownFacets.js.map