/** 企业微信审批单 */
export interface WecomApprovalVo {
  spNo: string;
  spName: string;
  spStatus: number;
  spStatusText: string;
  templateId: string;
  templateName?: string; // 审批类型名称
  applyTime: number;
  applyerUserid: string;
  applyerParty: string;
  summaryInfo: string;
  amount: number;
  syncTime: string;
}

/** 审批详情（原始JSON字符串解析后） */
export interface WecomApprovalDetail {
  sp_no: string;
  sp_name: string;
  sp_status: number;
  template_id: string;
  apply_time: number;
  applyer: { userid: string; party: string };
  apply_data: {
    contents: Array<{
      control: string;
      id: string;
      title: Array<{ text: string; lang: string }>;
      value: Record<string, unknown>;
    }>;
  };
  nodes: Array<{
    sp_status: number;
    apv_rel: number;
    sub_node: Array<{
      sp_status: number;
      approver: { userid: string };
      speech: string;
      sp_time: number;
    }>;
  }>;
  comments: Array<{
    commentUserInfo: { userid: string };
    commentContent: string;
    commentTime: number;
  }>;
}

/** 统计数据 */
export interface ApprovalStats {
  pending: number;
  approved: number;
  rejected: number;
  revoked: number;
  total: number;
  mine?: number;
}

/** 审批模板 */
export interface WecomTemplate {
  templateId: string;
  templateName: string;
  syncTime: string;
}

/** 提交审批参数 */
export interface SubmitApprovalBo {
  creatorUserid: string;
  templateId: string;
  useTemplateApprover?: number;
  approver?: Array<{ attr: number; userid: string[] }>;
  notifyer?: string[];
  notifyType?: number;
  contents: Array<{
    control: string;
    id: string;
    title: Array<{ text: string; lang: string }>;
    value: Record<string, unknown>;
  }>;
  summary?: string;
}

/** 分页查询参数 */
export interface ApprovalListParams {
  pageNum: number;
  pageSize: number;
  type?: string;
  status?: string | number;
  keyword?: string;
}
