export type ProjectStatus = "Planning" | "Active" | "Finished" | "Archived";
export type ProjectPermission = "Owner" | "Editor" | "Viewer";
export type ProjectMemberType = "User" | "Role";
export type ProjectDependencyType = "BlockedBy";
export type TaskStatus = "Todo" | "Waiting" | "InProgress" | "Review" | "Done";
export type TaskExecutionState = "Done" | "Waiting" | "Unassigned" | "AgentNotStarted" | "Starting" | "Working" | "Questions" | "WaitingForApproval" | "WaitingForInput" | "WaitingForUser" | "WaitingForDependency" | "WaitingForCapacity" | "WaitingForBudget" | "WaitingForToolApproval" | "AgentError";
export type TaskAttentionReason = "none" | "blocked" | "approval" | "input" | "failed" | "budget";
export type TaskAssigneeType = "user" | "Agent" | "Role";
export type TaskPriority = "Low" | "Medium" | "High" | "Critical";
export type TaskType = "Task" | "Plan" | "DecisionPoint";
export type DecisionMode = "MultiSelect" | "SingleSelect";
export type GraphOrientation = "vertical" | "horizontal";
export type DefaultAgentMode = "supervised" | "autonomous";
export type Project = {
    projectId: string;
    parentProjectId?: string | null;
    title: string;
    description?: string;
    status: ProjectStatus;
    costLimit?: number | null;
    costUsed: number;
    defaultAgentMode?: DefaultAgentMode | string | null;
    createdBy: string;
    executionUserId?: string | null;
    executionUserDisplayName?: string | null;
    createdAt: string;
    updatedAt: string;
    /** Sitecore item ID of the Project Template the project was created from (null for legacy/manual projects). */
    sourceProjectTemplateId?: string | null;
    /** Resolved display name of {@link sourceProjectTemplateId}; null when the template was deleted/disabled. */
    sourceProjectTemplateName?: string | null;
};
export type ProjectTaskCounts = {
    total: number;
    todo: number;
    waiting: number;
    inProgress: number;
    review: number;
    done: number;
};
export type ProjectAttentionSummary = {
    total: number;
    blocked: number;
    approval: number;
    input: number;
    failed: number;
    budget: number;
    /** Waiting for a free agent slot (project concurrency) */
    capacity?: number;
};
export type ProjectOverviewSummary = {
    taskCounts: ProjectTaskCounts;
    attention: ProjectAttentionSummary;
    directSubprojectCount: number;
};
export type ProjectWithPermission = {
    project: Project;
    permission: ProjectPermission;
    overview?: ProjectOverviewSummary | null;
};
export type ProjectTemplate = {
    id: string;
    name: string;
    description?: string | null;
    disabled?: boolean;
    hideFromCreateDialog?: boolean;
    /** When true, new projects from this template open in taskboard wizard mode */
    openInWizardMode?: boolean;
    /** True when stored under /sitecore/system/Parhelia/System/Project Templates */
    isSystem?: boolean;
    defaultCostLimit?: number | null;
    graphLayout?: ProjectTemplateGraphLayout | null;
    taskTemplates: TaskTemplateSummary[];
};
export type ProjectTemplateAgentSession = {
    projectTemplateId: string;
    agentId: string;
    profileId?: string | null;
    profileName?: string | null;
    created: boolean;
};
export type TaskTemplateSummary = {
    id: string;
    title: string;
    description?: string | null;
    disabled?: boolean;
    taskType?: Exclude<TaskType, "Plan"> | string | null;
    decisionMode?: DecisionMode | string | null;
    agentProfileId?: string | null;
    assigneeType?: TaskAssigneeType | null;
    assigneeId?: string | null;
    priority?: string | null;
    sortOrder: number;
    parentTaskId?: string | null;
    dependencyIds: string[];
};
export type ProjectMember = {
    memberId: string;
    projectId: string;
    memberType: ProjectMemberType;
    memberIdentifier: string;
    permission: ProjectPermission;
    addedBy: string;
    addedAt: string;
};
export type ProjectDependency = {
    projectDependencyId: string;
    projectId: string;
    dependsOnProjectId: string;
    dependencyType: ProjectDependencyType;
    createdBy: string;
    createdAt: string;
};
export type ProjectPropertyValueType = "string" | "itemCollectionRef";
export type ProjectProperty = {
    propertyId: string;
    projectId: string;
    propertyKey: string;
    valueType: ProjectPropertyValueType;
    stringValue?: string | null;
    itemCollectionId?: string | null;
    createdBy: string;
    createdAt: string;
    updatedAt: string;
};
export type TaskAssignableUser = {
    userName: string;
    displayName: string;
    email?: string | null;
};
export type TaskAssigneeSelection = {
    assigneeType: TaskAssigneeType;
    assigneeId: string;
    displayName: string;
    description?: string | null;
};
export type TaskItem = {
    taskId: string;
    taskKey?: string | null;
    projectId: string;
    parentTaskId?: string | null;
    taskType?: TaskType | string | null;
    sourceTaskTemplateId?: string | null;
    decisionData?: string | null;
    title: string;
    description?: string | null;
    status: TaskStatus;
    assigneeType?: TaskAssigneeType | null;
    assigneeId?: string | null;
    assigneeDisplayName?: string | null;
    priority?: TaskPriority | null;
    dueDate?: string | null;
    sortOrder: number;
    executionState: TaskExecutionState;
    executionAttentionReason?: TaskAttentionReason | null;
    executionVersion?: number;
    executionUpdatedAt?: string;
    executionError?: string | null;
    executionBlockedByProjectIds?: string[];
    waitingOnDialogId?: string | null;
    waitingOnToolCallId?: string | null;
    executionStartedAt?: string | null;
    executionCompletedAt?: string | null;
    resultData?: string | null;
    assignedAgentId?: string | null;
    createdBy: string;
    createdAt: string;
    updatedAt: string;
};
export type TaskExecutionRecord = {
    projectId: string;
    taskId: string;
    taskStatus: TaskStatus;
    executionState: TaskExecutionState;
    attentionReason: TaskAttentionReason;
    agentId?: string | null;
    blockedByTaskIds: string[];
    blockedByProjectIds?: string[];
    waitingOnDialogId?: string | null;
    waitingOnToolCallId?: string | null;
    resultData?: string | null;
    errorMessage?: string | null;
    updatedAt: string;
    version: number;
};
export type TaskboardPersistentLogEntry = {
    logId: string;
    agentId?: string | null;
    projectId?: string | null;
    taskId?: string | null;
    runId?: string | null;
    sessionId?: string | null;
    userId?: string | null;
    parentAgentId?: string | null;
    messageId?: string | null;
    toolCallId?: string | null;
    eventType: string;
    stage?: string | null;
    status?: string | null;
    source?: string | null;
    seq?: number | null;
    summary?: string | null;
    payloadPreview?: string | null;
    resultPreview?: string | null;
    metadataJson?: string | null;
    durationMs?: number | null;
    success?: boolean | null;
    error?: string | null;
    createdAt: string;
};
export type TaskboardPersistentLogsResponse = {
    projectId: string;
    taskId?: string | null;
    logs: TaskboardPersistentLogEntry[];
};
export type PersistentLogsAdminFilters = {
    agentId?: string | null;
    projectId?: string | null;
    taskId?: string | null;
    runId?: string | null;
    eventType?: string | null;
    stage?: string | null;
    status?: string | null;
    source?: string | null;
    searchTerm?: string | null;
    success?: boolean | null;
    limit?: number;
};
export type PersistentLogsAdminResponse = {
    loggingEnabled: boolean;
    limit: number;
    logs: TaskboardPersistentLogEntry[];
};
export type TaskComment = {
    commentId: string;
    taskId: string;
    text: string;
    author: string;
    authorDisplayName?: string | null;
    createdAt: string;
};
export type TaskDependencyType = "BlockedBy" | "RelatedTo";
export type TaskDependency = {
    dependencyId: string;
    taskId: string;
    dependsOnTaskId: string;
    dependencyType: TaskDependencyType;
};
export type TaskGraphLayoutNode = {
    taskId: string;
    x: number;
    y: number;
};
export type TaskGraphLayoutViewport = {
    x: number;
    y: number;
    zoom: number;
};
export type GraphLayoutSnapshot = {
    nodes: TaskGraphLayoutNode[];
    viewport?: TaskGraphLayoutViewport | null;
    orientation?: GraphOrientation | null;
    updatedAt?: string | null;
};
export type TaskGraphLayout = GraphLayoutSnapshot & {
    projectId: string;
};
export type ProjectTemplateGraphLayout = GraphLayoutSnapshot & {
    projectTemplateId: string;
};
export type TaskAttachment = {
    attachmentId: string;
    taskId: string;
    fileName: string;
    fileType?: string | null;
    storedPath: string;
    fileSize: number;
    uploadedBy: string;
    uploadedAt: string;
};
export type WizardRecommendedActionType = "open_task" | "focus_agent" | "copy_reply" | "send_prompt_to_agent";
export type WizardRecommendedAction = {
    actionId: string;
    type: WizardRecommendedActionType;
    label: string;
    taskId?: string | null;
    agentId?: string | null;
    promptText?: string | null;
    style?: "primary" | "secondary" | string;
    priority?: number;
};
export type WizardGuidancePayload = {
    primaryInstruction: string;
    targetTaskId?: string | null;
    targetAgentId?: string | null;
    suggestedUserReply?: string | null;
    whyThisMatters?: string | null;
    confidence?: number | null;
    alternatives?: string[];
    recommendedActions?: WizardRecommendedAction[];
};
export type WizardGuidanceResponse = {
    status: "success" | "unavailable" | string;
    generatedAt: string;
    guidance?: WizardGuidancePayload | null;
    error?: string | null;
};
export type CreateProjectRequest = {
    title: string;
    parentProjectId?: string | null;
    description?: string;
    taskPrefix?: string;
    costLimit?: number | null;
    projectTemplateId?: string;
    defaultAgentMode?: DefaultAgentMode | string | null;
    initialProperties?: UpsertProjectPropertiesRequest["properties"];
};
export type DeleteProjectRequest = {
    projectId: string;
};
export type RestartProjectRequest = {
    projectId: string;
};
export type UpdateProjectRequest = {
    projectId: string;
    title: string;
    description?: string;
    costLimit?: number | null;
    status?: ProjectStatus;
    defaultAgentMode?: DefaultAgentMode | string | null;
    executionUserId?: string | null;
    executionUserDisplayName?: string | null;
};
export type AddMemberRequest = {
    projectId: string;
    memberType: ProjectMemberType;
    memberIdentifier: string;
    permission: ProjectPermission;
};
export type RemoveMemberRequest = {
    memberId: string;
};
export type UpsertProjectPropertiesRequest = {
    projectId: string;
    properties: Array<{
        propertyKey: string;
        valueType: ProjectPropertyValueType;
        stringValue?: string | null;
        itemCollectionId?: string | null;
    }>;
};
export type DeleteProjectPropertyRequest = {
    projectId: string;
    propertyKey: string;
};
export type CreateTaskRequest = {
    projectId: string;
    taskType?: TaskType | string | null;
    parentTaskId?: string | null;
    title: string;
    description?: string;
    status?: TaskStatus;
    assigneeType?: TaskAssigneeType | null;
    assigneeId?: string | null;
    priority?: TaskPriority | null;
    dueDate?: string | null;
    sortOrder?: number | null;
};
export type UpdateTaskRequest = {
    taskId: string;
    taskType?: TaskType | string | null;
    title?: string;
    description?: string;
    status?: TaskStatus;
    assigneeType?: TaskAssigneeType | null;
    assigneeId?: string | null;
    priority?: TaskPriority | null;
    dueDate?: string | null;
    sortOrder?: number | null;
    executionState?: TaskExecutionState;
    resultData?: string | null;
    parentTaskId?: string | null;
    assignedAgentId?: string | null;
};
export type ApplyDecisionRequest = {
    decisionTaskId: string;
    selectedTemplateIds: string[];
};
export type TaskExecutionStateRequest = {
    projectId: string;
};
export type DeleteTaskRequest = {
    taskId: string;
};
export type AddTaskCommentRequest = {
    taskId: string;
    text: string;
};
export type DeleteTaskCommentRequest = {
    commentId: string;
};
export type AddTaskDependencyRequest = {
    taskId: string;
    dependsOnTaskId: string;
    dependencyType?: TaskDependencyType;
};
export type RemoveTaskDependencyRequest = {
    dependencyId?: string;
    taskId?: string;
    dependsOnTaskId?: string;
    dependencyType?: TaskDependencyType;
};
export type AddProjectDependencyRequest = {
    projectId: string;
    dependsOnProjectId: string;
    dependencyType?: ProjectDependencyType;
};
export type RemoveProjectDependencyRequest = {
    projectDependencyId?: string;
    projectId?: string;
    dependsOnProjectId?: string;
    dependencyType?: ProjectDependencyType;
};
export type UploadTaskAttachmentRequest = {
    taskId: string;
    fileName: string;
    fileType?: string;
    storedPath: string;
    fileSize?: number;
};
export type DeleteTaskAttachmentRequest = {
    attachmentId: string;
};
export type SaveTaskGraphLayoutRequest = {
    projectId: string;
    nodes: TaskGraphLayoutNode[];
    viewport?: TaskGraphLayoutViewport | null;
    orientation?: GraphOrientation | null;
};
export type UpsertProjectTemplateRequest = {
    projectTemplateId?: string | null;
    name: string;
    description?: string | null;
    disabled: boolean;
    hideFromCreateDialog: boolean;
    openInWizardMode: boolean;
    defaultCostLimit?: number | null;
    graphLayout?: ProjectTemplateGraphLayout | null;
    taskTemplates: TaskTemplateSummary[];
};
export type DeleteProjectTemplateRequest = {
    projectTemplateId: string;
};
