export interface UserInfo {
    id: string;
    name: string;
    avatar?: string;
    department?: string;
    position?: string;
}
export interface Attachment {
    id: string;
    name: string;
    url: string;
    size: number;
    mimeType: string;
}
export interface StartApprovalResponse {
    instanceId: string;
    workflowId: string;
    workflowRunId: string;
    status: InstanceStatus;
    currentNodeId?: string;
    startTime: string;
}
export interface ApprovalActionResponse {
    success: boolean;
    taskId: string;
    action: string;
    nextNodeId?: string;
    isProcessCompleted: boolean;
    instance?: {
        id: string;
        status: InstanceStatus;
        currentNodeId?: string;
        currentNodeName?: string;
        endTime?: string;
        endReason?: string;
    };
    shouldRefreshList?: boolean;
}
export interface WithdrawResponse {
    success: boolean;
    instanceId: string;
    status: 'WITHDRAWN';
    endReason: 'WITHDRAWN';
}
export interface ApprovalTaskItem {
    taskId: string;
    instanceId: string;
    businessType: string;
    businessId: string;
    businessKey: string;
    title: string;
    status: TaskStatus;
    priority: number;
    initiator: UserInfo;
    nodeName: string;
    nodeType: string;
    approvalMode?: ApprovalMode;
    createTime: string;
    dueDate?: string;
    isOverdue: boolean;
    remainingHours?: number;
    isDelegated: boolean;
    delegatedFrom?: UserInfo;
    delegatedAt?: string;
    delegationReason?: string;
    lastReminderTime?: string;
    reminderCount?: number;
    formKey?: string;
    formDefinitionId?: string;
    formVersionId?: string;
    businessTypeMeta?: {
        displayName: string;
        icon: string;
        color: string;
    };
    businessSummary?: {
        title: string;
        description?: string;
        amount?: number;
        customFields?: Record<string, any>;
    };
}
export interface PaginatedTasksResponse {
    items: ApprovalTaskItem[];
    total: number;
    page: number;
    limit: number;
    totalPages: number;
    hasNext: boolean;
    hasPrev: boolean;
}
export interface TaskDetailResponse {
    id: string;
    name: string;
    description?: string;
    type: TaskType;
    status: TaskStatus;
    assignee?: UserInfo;
    candidateUsers: UserInfo[];
    candidateGroups: string[];
    owner?: UserInfo;
    isDelegated: boolean;
    delegatedFrom?: UserInfo;
    delegatedAt?: string;
    delegationReason?: string;
    delegationType?: DelegationType;
    createTime: string;
    claimTime?: string;
    dueDate?: string;
    endTime?: string;
    lastReminderTime?: string;
    isOverdue: boolean;
    remainingHours?: number;
    reminderCount?: number;
    version: number;
    editableFields?: string[];
    requiredFields?: string[];
    allowedActions: ApprovalAction[];
    returnTargets?: ReturnableNode[];
    instance: ProcessInstanceDetail;
    nodeInstance: NodeInstanceInfo;
    actionLogs: ActionLogItem[];
}
export interface ProcessInstanceDetail {
    id: string;
    businessType: string;
    businessId: string;
    businessKey?: string;
    title?: string;
    status: InstanceStatus;
    initiator: UserInfo;
    startTime: string;
}
export interface NodeInstanceInfo {
    id: string;
    nodeId: string;
    nodeName: string;
    nodeType: NodeType;
}
export type TaskType = 'APPROVAL' | 'COUNTERSIGN' | 'OR_SIGN' | 'CC' | 'SEQUENTIAL';
export interface AvailableAction {
    action: ApprovalAction;
    label: string;
    enabled: boolean;
    reason?: string;
}
export interface ReturnableNode {
    nodeId: string;
    nodeName: string;
    nodeType: string;
    executedAt?: string;
}
export interface ProcessDetailResponse {
    id: string;
    businessType: string;
    businessId: string;
    businessKey?: string;
    title?: string;
    processDefinition: {
        id: string;
        key: string;
        name: string;
        category: string;
    };
    processVersion: {
        id: string;
        version: number;
        name: string;
    };
    workflowId: string;
    workflowRunId: string;
    initiator: UserInfo;
    status: InstanceStatus;
    currentNodeId?: string;
    currentNodeName?: string;
    variables: Record<string, any>;
    totalNodeExecutions: number;
    startTime: string;
    endTime?: string;
    endReason?: string;
    endComment?: string;
    priority: number;
    dueDate?: string;
    nodeInstances: NodeInstanceDetail[];
    pendingTasks: ApprovalTaskItem[];
}
export interface NodeInstanceDetail {
    id: string;
    nodeId: string;
    nodeName: string;
    nodeType: NodeType;
    status: NodeStatus;
    assignees: UserInfo[];
    approvalMode?: ApprovalMode;
    executionCount: number;
    result?: string;
    startTime: string;
    endTime?: string;
    tasks: ApprovalTaskItem[];
}
export interface ProcessStatusResponse {
    id: string;
    status: InstanceStatus;
    currentNodeId?: string;
    currentNodeName?: string;
    currentAssignees: UserInfo[];
    startTime: string;
    endTime?: string;
    endReason?: string;
    progress: number;
}
export interface ApprovalHistoryItem {
    id: string;
    nodeId: string;
    nodeName: string;
    nodeType: string;
    action: ApprovalAction;
    operator: UserInfo;
    comment?: string;
    attachments?: Attachment[];
    formDataChanges?: Record<string, any>;
    actionTime: string;
    duration?: number;
    targetUser?: UserInfo;
    targetNodeId?: string;
    addSignUsers?: UserInfo[];
    autoApproved?: boolean;
    autoApproveReason?: string;
}
export interface ApprovalHistoryResponse {
    items: HistoryItem[];
    status?: InstanceStatus;
    endReason?: string;
}
export interface HistoryItem {
    nodeId: string;
    nodeName: string;
    nodeType: NodeType;
    status: NodeStatus;
    startTime: string;
    endTime?: string;
    tasks: TaskHistoryItem[];
}
export interface TaskHistoryItem {
    id: string;
    assignee?: UserInfo;
    status: TaskStatus;
    autoApproved: boolean;
    autoApproveReason?: string;
    actions: ActionLogItem[];
}
export interface ActionLogItem {
    id: string;
    action: ApprovalAction;
    operator: UserInfo;
    comment?: string;
    actionTime: string;
    formDataChanges?: Record<string, {
        old: any;
        new: any;
    }>;
}
export interface TimelineItem {
    nodeId: string;
    nodeName: string;
    nodeType: string;
    status: NodeStatus;
    startTime?: string;
    endTime?: string;
    assignees?: UserInfo[];
    result?: string;
}
export interface DiagramNode {
    id: string;
    type: NodeType;
    name: string;
    status: NodeStatus;
    x: number;
    y: number;
    width: number;
    height: number;
    assignees?: UserInfo[];
    startTime?: string;
    endTime?: string;
    isCurrent: boolean;
}
export interface DiagramEdge {
    id: string;
    source: string;
    target: string;
    label?: string;
    isActive: boolean;
}
export interface DiagramResponse {
    instanceId: string;
    nodes: DiagramNode[];
    edges: DiagramEdge[];
    currentNodeId?: string;
}
export interface RemindResponse {
    success: boolean;
    taskId: string;
    reminderCount: number;
    lastReminderTime: string;
    message: string;
}
export interface BatchRemindResponse {
    total: number;
    success: number;
    failed: number;
    results: RemindResult[];
}
export interface RemindResult {
    taskId: string;
    success: boolean;
    message?: string;
}
export interface ProcessDefinitionItem {
    id: string;
    key: string;
    name: string;
    category: string;
    description?: string;
    latestVersion: number;
    status: ProcessStatus;
    organizationId?: string;
    createdAt: string;
    updatedAt: string;
}
export interface ProcessVersionItem {
    id: string;
    version: number;
    name: string;
    status: VersionStatus;
    isDefault: boolean;
    deployedAt?: string;
    deployedBy?: UserInfo;
    changeLog?: string;
    createdAt: string;
}
export interface ProcessVersionDetailResponse extends ProcessVersionItem {
    processModel: Record<string, any>;
    settings: Record<string, any>;
}
export interface AdminActionResponse {
    success: boolean;
    instanceId: string;
    taskId?: string;
    action: AdminAction;
    status?: 'TERMINATED' | 'RUNNING';
    endReason?: 'ADMIN_TERMINATED';
    message: string;
    auditLogId: string;
}
export interface AuditLogItem {
    id: string;
    action: AdminAction;
    riskLevel: RiskLevel;
    operator: UserInfo;
    instanceId: string;
    taskId?: string;
    businessType: string;
    businessId: string;
    businessKey?: string;
    processTitle?: string;
    reason: string;
    adminReason?: string;
    comment?: string;
    attachments?: Attachment[];
    originalAssignee?: UserInfo;
    newAssignee?: UserInfo;
    requestId: string;
    ipAddress: string;
    userAgent: string;
    actionTime: string;
}
export interface PaginatedAuditLogsResponse {
    items: AuditLogItem[];
    total: number;
    page: number;
    limit: number;
    totalPages: number;
    hasNext: boolean;
    hasPrev: boolean;
}
export interface TaskStatsResponse {
    pendingCount: number;
    urgentCount: number;
    overdueCount: number;
    initiatedCount: number;
    processedToday: number;
    processedThisWeek: number;
    ccUnreadCount: number;
}
export interface AdminAnalyticsResponse {
    summary: {
        totalSubmissions: number;
        approvalRate: number;
        rejectRate: number;
        avgDurationMs: number;
        runningCount: number;
    };
    trends: Array<{
        date: string;
        submissions: number;
        approvals: number;
        rejections: number;
    }>;
    distribution: Array<{
        formKey: string;
        formName: string;
        count: number;
    }>;
}
export interface AdminInstanceItem {
    instanceId?: string;
    businessInstanceId: string;
    businessType: string;
    formKey?: string;
    formName?: string;
    submitter: UserInfo;
    status: string;
    currentNode?: string;
    submittedAt: string;
    durationMs?: number;
    approvalRequired: boolean;
}
export interface AdminInstancesResponse {
    items: AdminInstanceItem[];
    total: number;
    page: number;
    limit: number;
    totalPages: number;
    hasNext: boolean;
    hasPrev: boolean;
}
export interface AdminExportResponse {
    taskId: string;
}
export interface AdminExportItem {
    id: string;
    status: string;
    format: string;
    fileName?: string;
    fileSize?: number;
    contentType?: string;
    downloadUrl?: string;
    createdAt: string;
    completedAt?: string;
    expiresAt?: string;
}
export interface AdminExportStatusResponse extends AdminExportItem {
}
export interface AdminSettingsResponse {
    exportRetentionDays: number;
}
export type InstanceStatus = 'RUNNING' | 'SUSPENDED' | 'APPROVED' | 'REJECTED' | 'WITHDRAWN' | 'TERMINATED' | 'FAILED';
export type TaskStatus = 'CREATED' | 'PENDING' | 'CLAIMED' | 'ASSIGNED' | 'IN_PROGRESS' | 'COMPLETED' | 'CANCELLED' | 'SUSPENDED' | 'WITHDRAWN';
export type NodeStatus = 'PENDING' | 'ACTIVE' | 'COMPLETED' | 'CANCELLED' | 'FAILED' | 'SKIPPED';
export type NodeType = 'START' | 'END' | 'USER_TASK' | 'SERVICE_TASK' | 'GATEWAY' | 'EXCLUSIVE_GATEWAY' | 'PARALLEL_GATEWAY' | 'INCLUSIVE_GATEWAY';
export type ApprovalMode = 'COUNTERSIGN' | 'OR_SIGN' | 'SEQUENTIAL';
export type ApprovalAction = 'SUBMIT' | 'APPROVE' | 'REJECT' | 'RETURN' | 'FORWARD' | 'WITHDRAW' | 'APPROVER_WITHDRAW' | 'ADD_SIGN' | 'CLAIM' | 'UNCLAIM' | 'DELEGATE' | 'AUTO_APPROVE' | 'AUTO_REJECT' | 'ESCALATE' | 'REMIND' | 'EXECUTE' | 'COMMENT';
export type AdminAction = 'ADMIN_APPROVE' | 'ADMIN_REJECT' | 'ADMIN_TERMINATE' | 'ADMIN_REASSIGN' | 'ADMIN_RESUME';
export type RiskLevel = 'LOW' | 'MEDIUM' | 'HIGH';
export type DelegationType = 'MANUAL' | 'AUTO_ON_LEAVE' | 'AUTO_TIME_RANGE' | 'AUTO_TIMEOUT';
export type ProcessStatus = 'ACTIVE' | 'SUSPENDED' | 'ARCHIVED';
export type VersionStatus = 'DRAFT' | 'DEPLOYED' | 'SUPERSEDED' | 'ARCHIVED';
