export type { Initiative, Phase, Task, Agent, Message, Page, Project, Account, ChangeSet, ChangeSetEntry } from '../../../apps/server/db/schema.js';
export type { PendingQuestions, QuestionItem } from '../../../apps/server/agent/types.js';

export type ExecutionMode = 'yolo' | 'review_per_phase';

export type InitiativeActivityState =
  | 'idle'             // Active but no phases and no agents
  | 'discussing'       // Discuss agent actively scoping the initiative
  | 'planning'         // All phases pending (no work started)
  | 'detailing'        // Detail/plan agent actively decomposing phases into tasks
  | 'refining'         // Refine agent actively working on content
  | 'ready'            // Phases approved, waiting to execute
  | 'executing'        // At least one phase in_progress
  | 'pending_review'   // At least one phase pending_review
  | 'blocked'          // At least one phase blocked (none in_progress/pending_review)
  | 'complete'         // All phases completed
  | 'archived';        // Initiative archived

export interface InitiativeActivity {
  state: InitiativeActivityState;
  activePhase?: { id: string; name: string };
  phasesTotal: number;
  phasesCompleted: number;
}
export type PhaseStatus = 'pending' | 'approved' | 'in_progress' | 'completed' | 'blocked' | 'pending_review';

/**
 * Shape of events received from tRPC subscription streams.
 * Used by the frontend in onData callbacks.
 */
export interface SubscriptionEvent {
  id: string;
  type: string;
  payload: unknown;
  timestamp: string;
}
