/**
 * Curated entity-type catalog for Studiograph.
 *
 * The full canonical schema set lives in `validation.ts` (ENTITY_SCHEMAS).
 * This file exposes two cross-cutting concerns:
 *
 * 1. `DEFAULT_BASIC_ENTITY_TYPES` — the small default set every fresh
 *    workspace surfaces in the New Entry modal's "basic" tier. The tier
 *    grows for each user as entries of other curated types appear in
 *    folders that user can access (see the picker in
 *    web/src/lib/components/entity/NewEntryTypePicker.svelte). There is no
 *    persistent per-workspace "active set" — visibility is derived from
 *    graph presence + folder permissions.
 *
 * 2. `CURATED_ENTITY_TYPE_DESCRIPTIONS` — short one-line descriptions for
 *    every canonical type. Used by the agent system prompt, tool reference,
 *    and the picker's detail pane.
 *
 * This module is pure data — no runtime dependencies on Node APIs or Zod —
 * so it is safe to import from the web bundle via the
 * `@core/entity-types-catalog` alias.
 */
/**
 * Default "basic" tier for a fresh workspace. Just the three capture
 * primitives — the answer to "what do you want to create right now?".
 * Project / person / organization are organizational types that surface
 * automatically via the presence-based rule the moment someone creates
 * their first one. The picker augments this default with any curated
 * types already present in folders the user can access.
 */
export const DEFAULT_BASIC_ENTITY_TYPES = [
    'note',
    'event',
    'task',
];
const DEFAULT_BASIC_SET = new Set(DEFAULT_BASIC_ENTITY_TYPES);
export function isDefaultBasicEntityType(type) {
    return DEFAULT_BASIC_SET.has(type);
}
/**
 * Notable fields for each canonical type — the ones worth surfacing in the
 * New Entry picker's detail pane as "what this type captures" chips. Not a
 * complete field list; that lives in the Zod schemas. Base fields
 * (entity_type, entity_id, created_at, etc.) are never listed here.
 *
 * Labels are Title Case to match the user-facing property panel.
 */
export const CURATED_ENTITY_TYPE_FIELDS = {
    // CRM
    person: ['Name', 'Role', 'Category', 'Status', 'Email', 'Location', 'Organization'],
    organization: ['Name', 'Category', 'Status', 'Industry', 'Website'],
    position: ['Name', 'Department', 'Category', 'Status'],
    deal: ['Name', 'Client', 'Contact', 'Stage', 'Deal value', 'Start date', 'Close date'],
    // PM
    project: ['Name', 'Category', 'Project type', 'Client', 'Services', 'Status', 'Start date', 'End date'],
    event: ['Name', 'Type', 'Attendees', 'Location', 'Start date', 'End date'],
    task: ['Name', 'Status', 'Priority', 'Assignee', 'Phase', 'Start date', 'Due date'],
    deliverable: ['Name', 'Project', 'Status', 'Phase', 'Start date', 'Due date'],
    // KM — authored
    document: ['Name', 'Category', 'Status'],
    deck: ['Name', 'Audience', 'Status'],
    artifact: ['Name', 'Kind', 'Status', 'Viewport width', 'Viewport height', 'Viewport mode'],
    publication: ['Name', 'Platform', 'Status', 'URL'],
    'case-study': ['Name', 'Client', 'Services', 'Date range', 'Status'],
    service: ['Name', 'Service id', 'Sprint', 'Depends on', 'Enables', 'Deliverables', 'Status'],
    skill: ['Name', 'Description', 'Applies to'],
    // Capture
    note: ['Name'],
    reference: ['Name', 'Source', 'Link'],
    dataset: ['Name'],
    material: ['Name', 'Category'],
    // System
    comment: ['Body', 'Anchor', 'Resolved'],
};
export function getCuratedEntityTypeFields(type) {
    return CURATED_ENTITY_TYPE_FIELDS[type] ?? [];
}
/**
 * One-line descriptions for every canonical entity type. Terse on purpose —
 * full schema detail lives in validation.ts and is available on demand via
 * the `get_entity_schema` tool.
 */
export const CURATED_ENTITY_TYPE_DESCRIPTIONS = {
    // CRM
    person: 'An individual — team member, client, or contact',
    organization: 'A company, client, vendor, or partner',
    position: 'A role or job description',
    deal: 'A pre-project sales opportunity',
    // PM
    project: 'A client engagement or internal initiative',
    event: 'A meeting, call, workshop, or other gathering',
    task: 'An action item or to-do',
    deliverable: 'A scoped output promised to a client',
    // KM — authored
    document: 'A proposal, contract, brief, memo, or report',
    deck: 'A presentation or slide deck',
    artifact: 'A canvas built with HTML, CSS, and JS (create/edit with the create_artifact tool, not create_entity)',
    publication: 'Content published externally',
    'case-study': 'A portfolio narrative',
    service: 'An offering or methodology your team provides',
    skill: 'Reusable agent instructions',
    // Capture
    note: 'A freeform note or thought',
    reference: 'An external resource or piece of inspiration',
    dataset: 'Structured tabular data',
    material: 'A binary asset (image, design file, video, archive) wrapped as an entry',
    // System
    comment: 'A threaded comment anchored to an entry — questions, decisions, objections, approvals',
};
/**
 * The canonical list of curated entity types, in catalog order. Derived
 * from CURATED_ENTITY_TYPE_DESCRIPTIONS so descriptions and the type list
 * stay in sync without this module taking a Zod dependency.
 */
export const CURATED_ENTITY_TYPES = Object.freeze(Object.keys(CURATED_ENTITY_TYPE_DESCRIPTIONS));
const CURATED_ENTITY_TYPES_SET = new Set(CURATED_ENTITY_TYPES);
export function isCuratedEntityType(type) {
    return CURATED_ENTITY_TYPES_SET.has(type);
}
export function getCuratedEntityTypeDescription(type) {
    return CURATED_ENTITY_TYPE_DESCRIPTIONS[type];
}
/**
 * Compute the "basic" tier of entity types for a given user:
 * defaults ∪ curated types already present in folders the user can access.
 * `presentTypes` comes from the permission-filtered /api/repos response —
 * so this helper respects folder access for free. Non-curated types in
 * `presentTypes` (e.g. workspace custom types) pass through unchanged.
 */
export function computeBasicEntityTypes(presentTypes) {
    const set = new Set(DEFAULT_BASIC_ENTITY_TYPES);
    // Include every present type so workspace custom types also surface in
    // the basic tier once they have at least one entry. Whitespace-only
    // values are treated as absent — they can sneak in from stale API
    // responses or test fixtures and would pollute the picker otherwise.
    for (const t of presentTypes) {
        if (t && t.trim().length > 0)
            set.add(t);
    }
    return Array.from(set);
}
//# sourceMappingURL=entity-types-catalog.js.map