class MockData {
  MockData._();

  static Map<String, dynamic> get success =>
      {'code': 0, 'message': 'ok', 'data': null};

  static Map<String, dynamic> get homeSummary => {
        'code': 0,
        'message': 'ok',
        'data': {
          'expensePending': 3,
          'overtimePending': 1,
          'vehiclePending': 2,
          'logCount': 12,
          'announcementCount': 5,
          'announcementUnread': 2,
          'expenseApplyPending': 1,
          'totalCount': 28,
        },
      };

  // ==================== 报销 ====================

  static List<Map<String, dynamic>> get expenseList => [
        _expense('EXP001', 'BX-20240501-001', '张三', '销售部', '差旅费', 2380.0,
            'pending', 'U100', ['U100', 'U200'], '上海出差拜访客户', '2024-05-01T14:30:00'),
        _expense('EXP002', 'BX-20240428-002', '张三', '销售部', '办公用品', 156.0,
            'approved', '', ['U100', 'U200'], '购买办公文具', '2024-04-28T09:15:00'),
        _expense('EXP003', 'BX-20240420-003', '李四', '技术部', '招待费', 890.0,
            'rejected', '', ['U100'], '客户接待用餐', '2024-04-20T16:45:00'),
      ];

  static Map<String, dynamic> expenseDetail(String id) => {
        'code': 0,
        'message': 'ok',
        'data': {
          'id': id,
          'reportNo': 'BX-20240501-001',
          'applicantId': 'U001',
          'applicantName': '张三',
          'deptId': 'D001',
          'deptName': '销售部',
          'expenseType': '差旅费',
          'totalAmount': 2380.00,
          'invoiceCount': 3,
          'costCenterId': 'CC001',
          'projectId': 'P001',
          'projectName': '华东市场拓展',
          'budgetSubjectId': 'BS001',
          'loanWriteoffAmount': 0.0,
          'paymentMethod': '银行转账',
          'accountId': 'A001',
          'accountName': '张三-招商银行',
          'remark': '上海出差拜访客户',
          'status': 'pending',
          'currentApproverId': 'U100',
          'approvalChain': ['U100', 'U200'],
          'createTime': '2024-05-01T14:30:00',
          'updateTime': '2024-05-01T14:30:00',
          'details': [
            {
              'id': 'ED001', 'expenseId': id, 'expenseDate': '2024-05-01',
              'expenseType': '交通费', 'expenseDesc': '上海→北京机票',
              'amount': 1200.0, 'taxAmount': 108.0, 'totalAmount': 1308.0,
              'invoiceNo': 'INV20240501001', 'invoiceCode': '3100234567',
              'invoiceType': '增值税专用发票', 'isDeductible': true, 'taxRate': 0.09,
              'remark': '', 'attachments': [], 'sortOrder': 1,
            },
            {
              'id': 'ED002', 'expenseId': id, 'expenseDate': '2024-05-01',
              'expenseType': '住宿费', 'expenseDesc': '酒店住宿3晚',
              'amount': 800.0, 'taxAmount': 48.0, 'totalAmount': 848.0,
              'invoiceNo': 'INV20240502001', 'invoiceCode': '3100234568',
              'invoiceType': '增值税普通发票', 'isDeductible': false, 'taxRate': 0.06,
              'remark': '', 'attachments': [], 'sortOrder': 2,
            },
            {
              'id': 'ED003', 'expenseId': id, 'expenseDate': '2024-05-02',
              'expenseType': '交通费', 'expenseDesc': '市内出租车',
              'amount': 224.0, 'taxAmount': 0.0, 'totalAmount': 224.0,
              'invoiceNo': '', 'invoiceCode': '', 'invoiceType': '无发票',
              'isDeductible': false, 'taxRate': 0.0, 'remark': '',
              'attachments': [], 'sortOrder': 3,
            },
          ],
          'approvalRecords': [
            {
              'id': 'AR001', 'bizId': id, 'bizType': 'expense',
              'approverId': 'U100', 'approverName': '王经理', 'approvalLevel': 1,
              'action': 'approve', 'opinion': '', 'approvalTime': '2024-05-02T10:00:00',
            },
          ],
          'invoiceImages': [], 'paymentStatus': 'unpaid', 'voucherNo': '',
        },
      };

  // ==================== 报销申请 ====================

  static List<Map<String, dynamic>> get expenseApplicationList => [
        _expenseApplication('EA001', 'BXSQ-20240501-001', '张三', '销售部',
            '差旅费', 3500.0, '上海出差拜访客户', '', 'pending', 'U100',
            ['U100', 'U200'], '2024-05-01T14:30:00'),
        _expenseApplication('EA002', 'BXSQ-20240428-002', '李四', '技术部',
            '办公用品', 1560.0, '采购开发板及配件', '急用', 'approved', '',
            ['U100', 'U200'], '2024-04-28T09:15:00'),
      ];

  static Map<String, dynamic> expenseApplicationDetail(String id) => {
        'code': 0,
        'message': 'ok',
        'data': expenseApplicationList.firstWhere((e) => e['id'] == id,
            orElse: () => expenseApplicationList.first),
      };

  // ==================== 加班 ====================

  static List<Map<String, dynamic>> get overtimeList => [
        _overtime('OT001', 'JB-20240501-001', '张三', '销售部', '2024-05-03',
            '2024-05-03T18:00:00', '2024-05-03T22:00:00', 4.0,
            '工作日加班', '加班费', '处理华东客户紧急需求', 'pending', 'U100'),
        _overtime('OT002', 'JB-20240428-002', '王五', '技术部', '2024-04-28',
            '2024-04-28T09:00:00', '2024-04-28T18:00:00', 8.0,
            '休息日加班', '调休', '系统上线支持', 'approved', ''),
      ];

  static Map<String, dynamic> overtimeDetail(String id) => {
        'code': 0,
        'message': 'ok',
        'data': overtimeList.firstWhere((e) => e['id'] == id,
            orElse: () => overtimeList.first),
      };

  // ==================== 用车 ====================

  static List<Map<String, dynamic>> get vehicleList => [
        _vehicle('VH001', 'YC-20240505-001', '张三', '销售部', '商务车', '客户接待',
            '2024-05-05T09:00:00', '2024-05-05T17:00:00', '公司总部', '浦东机场',
            3, '赵司机', 80.0, '接送重要客户', 'pending', 'U100'),
        _vehicle('VH002', 'YC-20240503-002', '李四', '技术部', '轿车', '商务出行',
            '2024-05-03T13:00:00', '2024-05-03T18:00:00', '公司总部', '张江科技园',
            2, '自驾', 30.0, '拜访合作公司', 'approved', ''),
      ];

  static Map<String, dynamic> vehicleDetail(String id) => {
        'code': 0,
        'message': 'ok',
        'data': vehicleList.firstWhere((e) => e['id'] == id,
            orElse: () => vehicleList.first),
      };

  // ==================== 外出日志 ====================

  static List<Map<String, dynamic>> get outingLogList => [
        {
          'id': 'OL001', 'visitNo': 'VST-20240501-0001',
          'salespersonId': 'U001', 'salespersonName': '张三',
          'deptId': 'D001', 'deptName': '销售部',
          'customerId': 'C001', 'customerName': '华东科技有限公司',
          'contactId': 'CT001', 'contactName': '陈总',
          'contactPhone': '13800138001', 'contactPosition': '采购总监',
          'visitDate': '2024-05-01',
          'visitStartTime': '2024-05-01T09:00:00',
          'visitEndTime': '2024-05-01T11:30:00',
          'visitType': '商务沟通', 'visitPurpose': '洽谈Q3采购合同',
          'visitLocation': '上海市浦东新区张江路168号',
          'visitAddressDetail': '华东科技大厦15层',
          'longitude': 121.58, 'latitude': 31.20,
          'signInPhoto': '', 'signOutPhoto': '', 'visitPhotos': [],
          'participants': '李四',
          'visitSummary': '与陈总进行了2个半小时的会议，讨论了Q3采购合同的具体条款。对方对价格方案基本满意。',
          'visitResult': '待跟进', 'customerFeedback': '价格需再优惠5%',
          'competitorInfo': '竞品A报价比我们低3%',
          'nextVisitTime': '2024-05-15T10:00:00',
          'nextVisitContent': '提交最终报价方案',
          'checkInStatus': '正常', 'distanceDeviation': 0,
          'materials': '产品手册、报价单', 'status': '已完成',
          'attachments': [],
          'createTime': '2024-05-01T14:00:00', 'updateTime': '2024-05-01T14:00:00',
        },
        {
          'id': 'OL002', 'visitNo': 'VST-20240428-0002',
          'salespersonId': 'U001', 'salespersonName': '张三',
          'deptId': 'D001', 'deptName': '销售部',
          'customerId': 'C002', 'customerName': '上海智能制造有限公司',
          'contactId': '', 'contactName': '刘经理',
          'contactPhone': '13900139002', 'contactPosition': '技术负责人',
          'visitDate': '2024-04-28',
          'visitStartTime': '2024-04-28T14:00:00',
          'visitEndTime': '2024-04-28T16:00:00',
          'visitType': '产品演示', 'visitPurpose': '演示MES系统新功能',
          'visitLocation': '上海市嘉定区安亭镇', 'visitAddressDetail': '',
          'longitude': 121.16, 'latitude': 31.29,
          'signInPhoto': '', 'signOutPhoto': '', 'visitPhotos': [],
          'participants': '',
          'visitSummary': '成功演示MES v3.2版本的新功能，客户对质量追溯模块很感兴趣。',
          'visitResult': '需再次拜访',
          'customerFeedback': '希望加入与ERP系统的对接功能',
          'competitorInfo': '',
          'nextVisitTime': '2024-05-10T14:00:00',
          'nextVisitContent': '针对ERP对接进行技术方案讲解',
          'checkInStatus': '定位偏差', 'distanceDeviation': 150,
          'materials': '演示环境笔记本', 'status': '已完成',
          'attachments': [],
          'createTime': '2024-04-28T17:00:00', 'updateTime': '2024-04-28T17:00:00',
        },
      ];

  static Map<String, dynamic> outingLogDetail(String id) => {
        'code': 0,
        'message': 'ok',
        'data': outingLogList.firstWhere((e) => e['id'] == id,
            orElse: () => outingLogList.first),
      };

  // ==================== 公告 ====================

  static List<Map<String, dynamic>> get announcementList => [
        {
          'id': 'AN001', 'title': '关于2024年国庆节放假安排的通知',
          'content': '各部门：\n根据国家节假日安排，2024年国庆节放假时间为10月1日至10月7日，共7天。\n\n请各部门提前做好工作安排。\n\n特此通知。',
          'contentType': 'text', 'type': '通知公告',
          'publisherId': 'U999', 'publisherName': '行政部',
          'publishTime': '2024-09-25T10:00:00',
          'isTop': true, 'privateLevel': 0,
          'targetDepts': [], 'targetUsers': [],
          'requireConfirm': true, 'expiryDate': '2024-10-08T00:00:00',
          'attachments': [], 'readCount': 86, 'unreadCount': 14,
          'createTime': '2024-09-25T10:00:00',
        },
        {
          'id': 'AN002', 'title': '关于启用新版报销流程的通知',
          'content': '全体员工：\n自2024年5月1日起，所有费用报销需通过OA系统提交电子报销单。\n\n新版流程：\n1. 填写电子报销单\n2. 上传发票\n3. 部门审批\n4. 财务打款',
          'contentType': 'text', 'type': '制度文件',
          'publisherId': 'U998', 'publisherName': '财务部',
          'publishTime': '2024-04-28T14:00:00',
          'isTop': false, 'privateLevel': 0,
          'targetDepts': [], 'targetUsers': [],
          'requireConfirm': false, 'expiryDate': '2024-12-31T00:00:00',
          'attachments': [], 'readCount': 72, 'unreadCount': 28,
          'createTime': '2024-04-28T14:00:00',
        },
        {
          'id': 'AN003', 'title': 'Q2公司团建活动报名通知',
          'content': '各位同事：\n定于5月18日（周六）举行Q2团建活动，地点为崇明岛生态园。\n\n报名截止日期：5月12日。\n\n欢迎踊跃参加！',
          'contentType': 'text', 'type': '活动通知',
          'publisherId': 'U997', 'publisherName': '人力资源部',
          'publishTime': '2024-04-20T09:00:00',
          'isTop': false, 'privateLevel': 0,
          'targetDepts': [], 'targetUsers': [],
          'requireConfirm': false, 'expiryDate': '2024-05-19T00:00:00',
          'attachments': [], 'readCount': 95, 'unreadCount': 5,
          'createTime': '2024-04-20T09:00:00',
        },
      ];

  static Map<String, dynamic> announcementDetail(String id) => {
        'code': 0,
        'message': 'ok',
        'data': announcementList.firstWhere((e) => e['id'] == id,
            orElse: () => announcementList.first),
      };

  // ==================== helpers ====================

  static Map<String, dynamic> _expense(
      String id, String no, String name, String dept, String type,
      double amt, String status, String approver, List<String> chain,
      String remark, String time) {
    return {
      'id': id, 'reportNo': no, 'applicantId': 'U001',
      'applicantName': name, 'deptId': 'D001', 'deptName': dept,
      'expenseType': type, 'totalAmount': amt, 'invoiceCount': 1,
      'costCenterId': 'CC001', 'projectId': '', 'projectName': '',
      'budgetSubjectId': 'BS001', 'loanWriteoffAmount': 0.0,
      'paymentMethod': '', 'accountId': '', 'accountName': '',
      'remark': remark, 'status': status,
      'currentApproverId': approver, 'approvalChain': chain,
      'createTime': time, 'updateTime': time,
      'details': [], 'approvalRecords': [],
      'invoiceImages': [], 'paymentStatus': 'unpaid', 'voucherNo': '',
    };
  }

  static Map<String, dynamic> _overtime(
      String id, String no, String name, String dept, String date,
      String start, String end, double hours, String type,
      String comp, String reason, String status, String approver) {
    return {
      'id': id, 'applicationNo': no, 'applicantId': 'U001',
      'applicantName': name, 'deptId': 'D001', 'deptName': dept,
      'position': '', 'otDate': date, 'startTime': start, 'endTime': end,
      'otHours': hours, 'otType': type, 'compensationType': comp,
      'reason': reason, 'remark': '', 'status': status,
      'currentApproverId': approver, 'approvalChain': [approver],
      'createTime': start, 'updateTime': start, 'approvalRecords': [],
      'actualOtHours': 0.0, 'clockInTime': null, 'clockOutTime': null,
      'mealDeductHours': 0.5,
    };
  }

  static Map<String, dynamic> _vehicle(
      String id, String no, String name, String dept, String vtype,
      String purpose, String start, String end, String origin,
      String dest, int psg, String driver, double mileage,
      String reason, String status, String approver) {
    return {
      'id': id, 'applicationNo': no, 'applicantId': 'U001',
      'applicantName': name, 'deptId': 'D001', 'deptName': dept,
      'vehicleType': vtype, 'purpose': purpose,
      'startTime': start, 'endTime': end,
      'origin': origin, 'destination': dest,
      'passengerCount': psg, 'driver': driver, 'licensePlate': '',
      'estimatedMileage': mileage, 'estimatedCost': mileage * 3.0,
      'reason': reason, 'status': status, 'currentApproverId': approver,
      'approvalChain': [approver],
      'createTime': start, 'updateTime': start, 'approvalRecords': [],
      'actualMileage': 0.0, 'actualCost': 0.0, 'startOdometer': 0.0,
      'endOdometer': 0.0, 'returnTime': null, 'passengers': <String>[],
    };
  }

  static Map<String, dynamic> _expenseApplication(
      String id, String no, String name, String dept, String type,
      double amt, String purpose, String remark, String status,
      String approver, List<String> chain, String time) {
    return {
      'id': id, 'applicationNo': no, 'applicantId': 'U001',
      'applicantName': name, 'deptId': 'D001', 'deptName': dept,
      'expenseType': type, 'estimatedAmount': amt,
      'purpose': purpose, 'remark': remark, 'status': status,
      'currentApproverId': approver, 'approvalChain': chain,
      'createTime': time, 'updateTime': time,
      'estimatedStartDate': null, 'estimatedEndDate': null,
      'urgency': 'normal', 'projectId': '', 'projectName': '',
      'budgetSubjectId': '',
      'details': [], 'approvalRecords': [],
    };
  }

  // ==================== 报表 ====================

  static Map<String, dynamic> expenseReportDetail(String id) => {
        'code': 0,
        'message': 'ok',
        'data': {
          'id': id,
          'reportNo': 'EXP-REPORT-001',
          'applicantName': '张三',
          'deptName': '销售部',
          'expenseType': '差旅费',
          'totalAmount': 2380.0,
          'invoiceCount': 3,
          'paymentStatus': 'unpaid',
          'voucherNo': '',
          'invoiceImages': [],
          'status': 'pending',
          'createTime': '2024-05-01T14:30:00',
          'updateTime': '2024-05-01T14:30:00',
          'details': [],
          'approvalRecords': [],
        },
      };

  static Map<String, dynamic> expenseApplyReportDetail(String id) => {
        'code': 0,
        'message': 'ok',
        'data': {
          'id': id,
          'applicationNo': 'BXSQ-20240501-001',
          'applicantName': '张三',
          'deptName': '销售部',
          'expenseType': '差旅费',
          'estimatedAmount': 3500.0,
          'estimatedStartDate': null,
          'estimatedEndDate': null,
          'urgency': 'normal',
          'projectId': '',
          'projectName': '',
          'budgetSubjectId': '',
          'status': 'pending',
          'createTime': '2024-05-01T14:30:00',
          'updateTime': '2024-05-01T14:30:00',
          'details': [],
          'approvalRecords': [],
        },
      };

  static Map<String, dynamic> overtimeReportDetail(String id) => {
        'code': 0,
        'message': 'ok',
        'data': {
          'id': id,
          'applicationNo': 'JB-20240501-001',
          'applicantName': '张三',
          'deptName': '销售部',
          'otDate': '2024-05-03',
          'startTime': '2024-05-03T18:00:00',
          'endTime': '2024-05-03T22:00:00',
          'otHours': 4.0,
          'actualOtHours': 0.0,
          'clockInTime': null,
          'clockOutTime': null,
          'mealDeductHours': 0.5,
          'otType': '工作日加班',
          'compensationType': '加班费',
          'status': 'pending',
          'createTime': '2024-05-01T14:30:00',
          'updateTime': '2024-05-01T14:30:00',
          'approvalRecords': [],
        },
      };

  static Map<String, dynamic> vehicleReportDetail(String id) => {
        'code': 0,
        'message': 'ok',
        'data': {
          'id': id,
          'applicationNo': 'YC-20240505-001',
          'applicantName': '张三',
          'deptName': '销售部',
          'vehicleType': '商务车',
          'purpose': '客户接待',
          'startTime': '2024-05-05T09:00:00',
          'endTime': '2024-05-05T17:00:00',
          'origin': '公司总部',
          'destination': '浦东机场',
          'estimatedMileage': 80.0,
          'estimatedCost': 240.0,
          'actualMileage': 0.0,
          'actualCost': 0.0,
          'startOdometer': 0.0,
          'endOdometer': 0.0,
          'returnTime': null,
          'passengers': [],
          'status': 'pending',
          'createTime': '2024-05-05T09:00:00',
          'updateTime': '2024-05-05T09:00:00',
          'approvalRecords': [],
        },
      };
}
