/**
 * 客资管理模块 - 类型定义
 */

/** 客资状态枚举 */
export const LeadStatusOptions = [
  { label: '待跟进', value: 0, color: 'warning' },
  { label: '跟进中', value: 1, color: 'primary' },
  { label: '已成交', value: 2, color: 'success' },
  { label: '无效', value: 3, color: 'info' }
];

/** 客资来源类型 */
export const LeadSourceOptions = [
  { label: '表单', value: 'form' },
  { label: '网站', value: 'website' },
  { label: '小程序', value: 'miniapp' },
  { label: '推荐人', value: 'referral' },
  { label: '管理员录入', value: 'admin' }
];

/** 跟进方式 */
export const FollowTypeOptions = [
  { label: '电话', value: 1 },
  { label: '微信', value: 2 },
  { label: '上门', value: 3 },
  { label: '短信', value: 4 },
  { label: '其他', value: 5 }
];

/** 派单类型 */
export const DispatchTypeOptions = [
  { label: '新分配', value: 1 },
  { label: '重新分配', value: 2 },
  { label: '抢单', value: 3 }
];

/** 客资实体 */
export interface CustomerLead {
  leadId?: number;
  name?: string;
  phone?: string;
  company?: string;
  delivery?: string;
  need?: string;
  source?: string;
  sourceType?: string;
  ip?: string;
  status?: number;
  statusText?: string;
  remarks?: string;
  assignedUserId?: number;
  assignedUserName?: string;
  assignedRealName?: string;
  assignedUserPhone?: string;
  referrerUserId?: number;
  referrerName?: string;
  referrerPhone?: string;
  referralFee?: number;
  referralFeePaid?: number;
  referralFeePaidText?: string;
  referrerShare?: number;
  dispatchTime?: string;
  dispatchAdminId?: number;
  dispatchAdminName?: string;
  followCount?: number;
  lastFollowTime?: string;
  appointmentTime?: string;
  dealAmount?: number;
  dealTime?: string;
  createTime?: string;
  updateTime?: string;
}

/** 客资查询参数 */
export interface CustomerLeadParam {
  leadId?: number;
  name?: string;
  phone?: string;
  company?: string;
  need?: string;
  assignedUserId?: number;
  dispatchRemarks?: string;
  status?: number;
  remarks?: string;
  appointmentTime?: string;
  dealAmount?: number;
  sourceType?: string;
  startDate?: string;
  endDate?: string;
  statusList?: string;
  salesmanId?: number;
  referrerId?: number;
  keyword?: string;
  pageNum?: number;
  pageSize?: number;
}

/** 派单请求参数 */
export interface LeadDispatchParam {
  leadId?: number;
  toUserId?: number;
  remarks?: string;
  dispatchType?: number;
  leadIds?: number[];
  batchMode?: boolean;
}

/** 跟进记录参数 */
export interface LeadFollowParam {
  leadId?: number;
  followType?: number;
  followContent?: string;
  nextFollowTime?: string;
  nextFollowPlan?: string;
  attachmentUrls?: string;
  updateStatus?: boolean;
  newStatus?: number;
}

/** 派单记录 */
export interface LeadDispatch {
  dispatchId?: number;
  leadId?: number;
  fromUserId?: number;
  toUserId?: number;
  toUserName?: string;
  adminId?: number;
  adminName?: string;
  dispatchRemarks?: string;
  dispatchType?: number;
  dispatchTypeText?: string;
  leadCustomerName?: string;
  leadCustomerPhone?: string;
  createTime?: string;
}

/** 跟进记录 */
export interface LeadFollowLog {
  followId?: number;
  leadId?: number;
  userId?: number;
  userName?: string;
  followType?: number;
  followTypeText?: string;
  followContent?: string;
  nextFollowTime?: string;
  nextFollowPlan?: string;
  attachmentUrls?: string;
  customerName?: string;
  customerPhone?: string;
  createTime?: string;
}

/** 统计数据 */
export interface LeadStatistics {
  totalLeads?: number;
  newLeads?: number;
  assignedLeads?: number;
  followedLeads?: number;
  dealedLeads?: number;
  dealAmount?: number;
  referralCount?: number;
  referralFee?: number;
}

/** 业务员统计 */
export interface SalesmanStats {
  total?: number;
  pending?: number;
  following?: number;
  dealed?: number;
  invalid?: number;
}
