import { SmrtObject } from '@happyvertical/smrt-core'; import { PipelineStageOptions } from '../types.js'; /** * PipelineStage is a configurable step within a pipeline. Stages carry the * default win `probability` an opportunity adopts on entry and the terminal * flags (`isWon`/`isLost`) that close an opportunity when it moves in * (see `OpportunityCollection.moveToStage()`). * * Natural key `(pipeline_id, key)` (`conflictColumns`) — re-seeding a stage * key within a pipeline upserts. Stages are plain rows: rename, re-weight, * insert, or reorder (via `sortOrder`) with normal collection operations — * no Lead/Opportunity model change is ever needed. * * @example * ```typescript * const stages = await PipelineStageCollection.create({ db }); * await stages.create({ * pipelineId: pipeline.id, * key: 'legal_review', * name: 'Legal Review', * sortOrder: 45, // between seeded proposal (40) and negotiation (50) * probability: 0.7, * }); * ``` */ export declare class PipelineStage extends SmrtObject { /** * Tenant ID for multi-tenant isolation. * Nullable to support both tenant-scoped and global stages. */ tenantId: string | null; /** Owning pipeline. Required. */ pipelineId: string; /** * Stable machine key, unique within the pipeline (natural key with * `pipelineId`). Required — e.g. `'proposal'`, `'closed_won'`. */ key: string; /** Human-readable stage name shown on board columns. */ name: string; /** Ordering within the pipeline (ascending). Seeded in steps of 10. */ sortOrder: number; /** * Default win probability (`0`–`1`, DECIMAL) adopted by an opportunity * entering this stage unless the move overrides it. */ probability: number; /** Terminal flag: moving an opportunity here closes it as `won`. */ isWon: boolean; /** Terminal flag: moving an opportunity here closes it as `lost`. */ isLost: boolean; /** * Free-form JSON object stored as a string. Use * {@link getMetadata}/{@link setMetadata} instead of parsing manually. */ metadata: string; constructor(options?: PipelineStageOptions); /** Whether entering this stage closes the opportunity (won or lost). */ isTerminal(): boolean; /** Parse the metadata JSON string; returns `{}` on malformed content. */ getMetadata(): Record; /** Serialize and store the metadata object. */ setMetadata(metadata: Record): void; } export default PipelineStage; //# sourceMappingURL=PipelineStage.d.ts.map