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',
            'unpaid'),
        _expense('EXP002', 'BX-20240428-002', '张三', '销售部', 156.0,
            'approved', 'paid'),
        _expense('EXP003', 'BX-20240420-003', '李四', '技术部', 890.0,
            'rejected', 'unpaid'),
      ];

  static Map<String, dynamic> expenseDetail(String id) => {
        'code': 0,
        'message': 'ok',
        'data': {
          'id': id,
          'expenseNo': 'BX-20240501-001',
          'applicantId': 'U001',
          'applicantName': '张三',
          'deptId': 'D001',
          'deptName': '销售部',
          'totalAmount': 2380.00,
          'purpose': '上海出差拜访客户',
          'status': 'pending',
          'paymentStatus': 'unpaid',
          'voucherNo': '',
          'bankTransferNo': '',
          'costCenterId': 'CC001',
          'projectId': 'P001',
          'budgetSubjectId': 'BS001',
          'bankName': '招商银行',
          'accountName': '张三',
          'bankAccount': '6222021234567890',
          'isInvoiceVerified': false,
          'isTaxIdMatched': false,
          'isCategoryCompliant': false,
          'approvalInstanceId': '',
          'expenseDate': '2024-05-01',
          'createTime': '2024-05-01T14:30:00',
          'updateTime': '2024-05-01T14:30:00',
          'details': [
            {
              'id': 'ED001',
              'expenseId': id,
              'expenseDate': '2024-05-01',
              'expenseType': 'travel',
              'purpose': '上海→北京机票',
              'amount': 1200.0,
              'taxAmount': 108.0,
              'totalAmount': 1308.0,
              'currencyCode': 'CNY',
              'exchangeRate': 1.0,
              'baseAmount': 1308.0,
              'invoiceNo': 'INV20240501001',
              'invoiceCode': '3100234567',
              'invoiceType': 'special',
              'taxRate': 0.09,
              'sortOrder': 1,
            },
            {
              'id': 'ED002',
              'expenseId': id,
              'expenseDate': '2024-05-01',
              'expenseType': 'accommodation',
              'purpose': '酒店住宿3晚',
              'amount': 800.0,
              'taxAmount': 48.0,
              'totalAmount': 848.0,
              'currencyCode': 'CNY',
              'exchangeRate': 1.0,
              'baseAmount': 848.0,
              'invoiceNo': 'INV20240502001',
              'invoiceCode': '3100234568',
              'invoiceType': 'general',
              'taxRate': 0.06,
              'sortOrder': 2,
            },
            {
              'id': 'ED003',
              'expenseId': id,
              'expenseDate': '2024-05-02',
              'expenseType': 'transport',
              'purpose': '市内出租车',
              'amount': 224.0,
              'taxAmount': 0.0,
              'totalAmount': 224.0,
              'currencyCode': 'CNY',
              'exchangeRate': 1.0,
              'baseAmount': 224.0,
              'invoiceNo': '',
              'invoiceCode': '',
              'invoiceType': 'none',
              'taxRate': 0.0,
              'sortOrder': 3,
            },
          ],
        },
      };

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

  static List<Map<String, dynamic>> get expenseApplicationList => [
        _expenseApplication('EA001', 'BXSQ-20240501-001', '张三', '销售部',
            'travel', 3500.0, '上海出差拜访客户', 'pending', 'normal'),
        _expenseApplication('EA002', 'BXSQ-20240428-002', '李四', '技术部',
            'office', 1560.0, '采购开发板及配件', 'approved', 'urgent'),
        _expenseApplication('EA003', 'BXSQ-20240425-003', '王五', '市场部',
            'entertainment', 5000.0, '客户答谢晚宴', 'rejected', 'normal'),
      ];

  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-03T18:00:00', '2024-05-03T22:00:00', 4.0, 'workday',
            'overtime_pay', null, '处理华东客户紧急需求', 'pending'),
        _overtime('OT002', 'JB-20240428-002', '王五', '技术部',
            '2024-04-28T09:00:00', '2024-04-28T18:00:00', 8.0, 'weekend',
            'comp_leave', null, '系统上线支持', 'approved'),
        _overtime('OT003', 'JB-20240505-003', '李四', '产品部',
            '2024-05-05T20:00:00', '2024-05-05T23:00:00', 3.0, 'holiday',
            'mixed', 0.50, '紧急产品需求处理', 'pending'),
      ];

  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', '张三', '销售部', 'VH-CAR-001',
            'reception', '2024-05-05T09:00:00', '2024-05-05T17:00:00',
            '公司总部', 31.2304, 121.4737, '浦东机场', 31.2484, 121.5021, 3,
            '接送重要客户', 'pending'),
        _vehicle('VH002', 'YC-20240503-002', '李四', '技术部', 'VH-CAR-002',
            'business', '2024-05-03T13:00:00', '2024-05-03T18:00:00',
            '公司总部', 31.2304, 121.4737, '张江科技园', 31.1999, 121.5979, 2,
            '拜访合作公司', 'approved'),
        _vehicle('VH003', 'YC-20240510-003', '王五', '行政部', 'VH-CAR-003',
            'official', '2024-05-10T08:00:00', '2024-05-10T12:00:00',
            '公司总部', 31.2304, 121.4737, '税务局', 31.2287, 121.4670, 1,
            '办理税务事宜', 'returned'),
      ];

  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-001',
          'salespersonId': 'U001',
          'salespersonName': '张三',
          'deptId': 'D001',
          'deptName': '销售部',
          'customerId': 'C001',
          'customerName': '华东科技有限公司',
          'contactId': 'CT001',
          'checkInLongitude': 121.58,
          'checkInLatitude': 31.20,
          'checkInAddress': '上海市浦东新区张江路168号华东科技大厦15层',
          'visitSummary': '与陈总进行了2个半小时的会议，讨论了Q3采购合同的具体条款。对方对价格方案基本满意。',
          'nextPlan': '提交最终报价方案，预计5月15日再次拜访',
          'status': 'completed',
          'lastViewedTime': null,
          'createTime': '2024-05-01T14:00:00',
          'updateTime': '2024-05-01T14:00:00',
        },
        {
          'id': 'OL002',
          'visitNo': 'VST-20240428-002',
          'salespersonId': 'U001',
          'salespersonName': '张三',
          'deptId': 'D001',
          'deptName': '销售部',
          'customerId': 'C002',
          'customerName': '上海智能制造有限公司',
          'contactId': 'CT002',
          'checkInLongitude': 121.16,
          'checkInLatitude': 31.29,
          'checkInAddress': '上海市嘉定区安亭镇',
          'visitSummary': '成功演示MES v3.2版本的新功能，客户对质量追溯模块很感兴趣。',
          'nextPlan': '针对ERP对接进行技术方案讲解',
          'status': 'completed',
          'lastViewedTime': null,
          'createTime': '2024-04-28T17:00:00',
          'updateTime': '2024-04-28T17:00:00',
        },
        {
          'id': 'OL003',
          'visitNo': 'VST-20240505-003',
          'salespersonId': 'U002',
          'salespersonName': '李四',
          'deptId': 'D002',
          'deptName': '技术部',
          'customerId': 'C003',
          'customerName': '云创数据技术有限公司',
          'contactId': 'CT003',
          'checkInLongitude': 113.33,
          'checkInLatitude': 23.13,
          'checkInAddress': '广州市天河区软件路15号',
          'visitSummary': '确认API对接方案，明确数据字段映射关系，预计下周开始联调。',
          'nextPlan': '开始联调测试，跟进合同签约',
          'status': 'completed',
          'lastViewedTime': null,
          'createTime': '2024-05-05T16:00:00',
          'updateTime': '2024-05-05T16: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特此通知。',
          'type': 'notice',
          'status': 'published',
          'publisherId': 'U999',
          'publisherName': '行政部',
          'publishTime': '2024-09-25T10:00:00',
          'isTop': true,
          'privateLevel': 0,
          'expiryDate': '2024-10-08T00:00:00',
          'createTime': '2024-09-25T10:00:00',
          'updateTime': '2024-09-25T10:00:00',
        },
        {
          'id': 'AN002',
          'title': '关于启用新版报销流程的通知',
          'content':
              '全体员工：\n自2024年5月1日起，所有费用报销需通过OA系统提交电子报销单。\n\n新版流程：\n1. 填写电子报销单\n2. 上传发票\n3. 部门审批\n4. 财务打款',
          'type': 'policy',
          'status': 'published',
          'publisherId': 'U998',
          'publisherName': '财务部',
          'publishTime': '2024-04-28T14:00:00',
          'isTop': false,
          'privateLevel': 0,
          'expiryDate': '2024-12-31T00:00:00',
          'createTime': '2024-04-28T14:00:00',
          'updateTime': '2024-04-28T14:00:00',
        },
        {
          'id': 'AN003',
          'title': 'Q2公司团建活动报名通知',
          'content':
              '各位同事：\n定于5月18日（周六）举行Q2团建活动，地点为崇明岛生态园。\n\n报名截止日期：5月12日。\n\n欢迎踊跃参加！',
          'type': 'activity',
          'status': 'published',
          'publisherId': 'U997',
          'publisherName': '人力资源部',
          'publishTime': '2024-04-20T09:00:00',
          'isTop': false,
          'privateLevel': 0,
          'expiryDate': '2024-05-19T00:00:00',
          'createTime': '2024-04-20T09:00:00',
          'updateTime': '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, double amt,
      String status, String paymentStatus) {
    return {
      'id': id,
      'expenseNo': no,
      'applicantId': 'U001',
      'applicantName': name,
      'deptId': 'D001',
      'deptName': dept,
      'totalAmount': amt,
      'purpose': '费用报销说明',
      'status': status,
      'paymentStatus': paymentStatus,
      'voucherNo': '',
      'bankTransferNo': '',
      'costCenterId': 'CC001',
      'projectId': '',
      'budgetSubjectId': 'BS001',
      'bankName': '招商银行',
      'accountName': name,
      'bankAccount': '6222021234567890',
      'isInvoiceVerified': false,
      'isTaxIdMatched': false,
      'isCategoryCompliant': false,
      'approvalInstanceId': '',
      'expenseDate': null,
      'createTime': '2024-05-01T14:30:00',
      'updateTime': '2024-05-01T14:30:00',
      'details': [],
    };
  }

  static Map<String, dynamic> _overtime(
      String id, String no, String name, String dept,
      String start, String end, double hours, String type,
      String comp, double? compRatio, String reason, String status) {
    return {
      'id': id,
      'applicationNo': no,
      'applicantId': 'U001',
      'applicantName': name,
      'deptId': 'D001',
      'deptName': dept,
      'otType': type,
      'compensationType': comp,
      'compLeaveRatio': compRatio,
      'startTime': start,
      'endTime': end,
      'netOtHours': hours,
      'reason': reason,
      'status': status,
      'approvalInstanceId': '',
      'createTime': start,
      'updateTime': start,
    };
  }

  static Map<String, dynamic> _vehicle(
      String id, String no, String name, String dept, String vehicleId,
      String purpose, String start, String end,
      String origin, double originLat, double originLng,
      String dest, double destLat, double destLng,
      int psg, String reason, String status) {
    return {
      'id': id,
      'applicationNo': no,
      'applicantId': 'U001',
      'applicantName': name,
      'deptId': 'D001',
      'deptName': dept,
      'vehicleId': vehicleId,
      'purpose': purpose,
      'reason': reason,
      'origin': origin,
      'originLongitude': originLng,
      'originLatitude': originLat,
      'destination': dest,
      'destLongitude': destLng,
      'destLatitude': destLat,
      'passengerCount': psg,
      'startTime': start,
      'endTime': end,
      'actualReturnTime': null,
      'startOdometer': 0.0,
      'endOdometer': 0.0,
      'actualCost': 0.0,
      'costRemark': '',
      'status': status,
      'approvalInstanceId': '',
      'createTime': start,
      'updateTime': start,
    };
  }

  static Map<String, dynamic> _expenseApplication(
      String id, String no, String name, String dept, String types,
      double amt, String purpose, String status, String urgency) {
    return {
      'id': id,
      'expenseApplyNo': no,
      'applyId': 'BXSQ',
      'applicantId': 'U001',
      'applicantName': name,
      'deptId': 'D001',
      'deptName': dept,
      'expenseTypes': types,
      'estimatedAmount': amt,
      'purpose': purpose,
      'status': status,
      'usageStatus': 'unused',
      'expenseApplyDate': null,
      'urgency': urgency,
      'estimatedStartDate': null,
      'estimatedEndDate': null,
      'projectId': '',
      'budgetSubjectId': '',
      'isTaxIncluded': false,
      'validUntil': null,
      'referenceNo': '',
      'approvalInstanceId': '',
      'isOvernight': false,
      'transportType': '',
      'entertainTarget': '',
      'entertainLevel': '',
      'guestCount': 0,
      'companionCount': 0,
      'venue': '',
      'meetingDate': null,
      'createTime': '2024-05-01T14:30:00',
      'updateTime': '2024-05-01T14:30:00',
      'details': [],
    };
  }

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

  static Map<String, dynamic> expenseReportDetail(String id) => {
        'code': 0,
        'message': 'ok',
        'data': {
          'id': id,
          'expenseNo': 'EXP-REPORT-001',
          'applicantName': '张三',
          'deptName': '销售部',
          'totalAmount': 2380.0,
          'paymentStatus': 'unpaid',
          'voucherNo': '',
          'status': 'pending',
          'createTime': '2024-05-01T14:30:00',
          'updateTime': '2024-05-01T14:30:00',
        },
      };

  static Map<String, dynamic> expenseApplyReportDetail(String id) => {
        'code': 0,
        'message': 'ok',
        'data': {
          'id': id,
          'expenseApplyNo': 'BXSQ-20240501-001',
          'applicantName': '张三',
          'deptName': '销售部',
          'expenseTypes': 'travel',
          'estimatedAmount': 3500.0,
          'estimatedStartDate': null,
          'estimatedEndDate': null,
          'urgency': 'normal',
          'status': 'pending',
          'createTime': '2024-05-01T14:30:00',
          'updateTime': '2024-05-01T14:30:00',
        },
      };

  static Map<String, dynamic> overtimeReportDetail(String id) => {
        'code': 0,
        'message': 'ok',
        'data': {
          'id': id,
          'applicationNo': 'JB-20240501-001',
          'applicantName': '张三',
          'deptName': '销售部',
          'startTime': '2024-05-03T18:00:00',
          'endTime': '2024-05-03T22:00:00',
          'netOtHours': 4.0,
          'otType': 'workday',
          'compensationType': 'overtime_pay',
          'status': 'pending',
          'createTime': '2024-05-01T14:30:00',
          'updateTime': '2024-05-01T14:30:00',
        },
      };

  static Map<String, dynamic> vehicleReportDetail(String id) => {
        'code': 0,
        'message': 'ok',
        'data': {
          'id': id,
          'applicationNo': 'YC-20240505-001',
          'applicantName': '张三',
          'deptName': '销售部',
          'purpose': 'reception',
          'startTime': '2024-05-05T09:00:00',
          'endTime': '2024-05-05T17:00:00',
          'origin': '公司总部',
          'destination': '浦东机场',
          'actualCost': 0.0,
          'status': 'pending',
          'createTime': '2024-05-05T09:00:00',
          'updateTime': '2024-05-05T09:00:00',
        },
      };

  static List<Map<String, dynamic>> get currencies => [
    {'curId': 'CNY', 'name': '人民币', 'excRto': 1.0, 'nameEng': 'RMB'},
    {'curId': 'USD', 'name': '美元', 'excRto': 7.25, 'nameEng': 'USD'},
    {'curId': 'EUR', 'name': '欧元', 'excRto': 7.98, 'nameEng': 'EUR'},
    {'curId': 'JPY', 'name': '日元', 'excRto': 0.048, 'nameEng': 'JPY'},
    {'curId': 'HKD', 'name': '港币', 'excRto': 0.93, 'nameEng': 'HKD'},
  ];

  static Map<String, dynamic> get approvalTimeline => {
    'bilId': 'BX',
    'bilNo': 'BX202606001',
    'bilItm': 0,
    'isFinalMan': false,
    'steps': [],
    'tdSteps': {
      'current': 1,
      'items': [
        {'title': '已提交', 'description': '张三', 'time': '2026-06-29 14:30', 'status': 'finish'},
        {'title': '审核同意', 'description': '李四', 'time': '2026-06-29 15:00', 'status': 'finish'},
        {'title': '财务审批', 'description': '审批人', 'time': null, 'status': 'default'},
      ],
    },
  };

  // ==================== 参考数据（费用申请新增页下拉） ====================

  static List<Map<String, dynamic>> get costTypes => [
    {'typeNo': 'transport', 'typeName': '交通费', 'accNo': '5501', 'accName': '差旅费'},
    {'typeNo': 'hotel', 'typeName': '住宿费', 'accNo': '5501', 'accName': '差旅费'},
    {'typeNo': 'office_supplies', 'typeName': '办公用品', 'accNo': '5502', 'accName': '办公费'},
    {'typeNo': 'meals', 'typeName': '餐饮费', 'accNo': '5503', 'accName': '招待费'},
    {'typeNo': 'materials', 'typeName': '材料费', 'accNo': '5504', 'accName': '材料费'},
    {'typeNo': 'service', 'typeName': '服务费', 'accNo': '5505', 'accName': '服务费'},
    {'typeNo': 'other', 'typeName': '其他', 'accNo': '5599', 'accName': '其他费用'},
  ];

  static List<Map<String, dynamic>> get projectCodes => [
    {'objNo': '100', 'name': '华东市场拓展', 'objClass': 'SALES', 'objClassName': '销售类'},
    {'objNo': '101', 'name': 'ERP系统升级', 'objClass': 'IT', 'objClassName': 'IT类'},
    {'objNo': '102', 'name': '新产品研发', 'objClass': 'RD', 'objClassName': '研发类'},
    {'objNo': '103', 'name': '华南渠道建设', 'objClass': 'SALES', 'objClassName': '销售类'},
  ];

  static List<Map<String, dynamic>> get departments => [
    {'dep': 'D001', 'name': '技术部', 'engName': 'IT Dept', 'up': '', 'stopDd': null},
    {'dep': 'D002', 'name': '销售部', 'engName': 'Sales Dept', 'up': '', 'stopDd': null},
    {'dep': 'D003', 'name': '市场部', 'engName': 'Marketing Dept', 'up': '', 'stopDd': null},
    {'dep': 'D004', 'name': '财务部', 'engName': 'Finance Dept', 'up': '', 'stopDd': null},
    {'dep': 'D005', 'name': '人事部', 'engName': 'HR Dept', 'up': '', 'stopDd': null},
  ];

  static List<Map<String, dynamic>> get customers => [
    {'cusNo': 'CV001', 'name': '深圳市腾讯计算机系统有限公司', 'snm': '腾讯', 'tel1': '', 'fax': '', 'adr1': '', 'cusAre': '', 'sal': ''},
    {'cusNo': 'CV002', 'name': '阿里巴巴（中国）有限公司', 'snm': '阿里', 'tel1': '', 'fax': '', 'adr1': '', 'cusAre': '', 'sal': ''},
    {'cusNo': 'CV003', 'name': '华为技术有限公司', 'snm': '华为', 'tel1': '', 'fax': '', 'adr1': '', 'cusAre': '', 'sal': ''},
    {'cusNo': 'CV004', 'name': '字节跳动有限公司', 'snm': '字节', 'tel1': '', 'fax': '', 'adr1': '', 'cusAre': '', 'sal': ''},
    {'cusNo': 'CV005', 'name': '京东集团股份有限公司', 'snm': '京东', 'tel1': '', 'fax': '', 'adr1': '', 'cusAre': '', 'sal': ''},
  ];

  // ==================== 审批列表 ====================

  static List<Map<String, dynamic>> get approvalList => [
    {'bilId': 'AE', 'bilNo': 'AE202606001', 'bilDate': '2026-06-20', 'applicant': '张三', 'dept': '技术部', 'amount': 5000.0, 'remark': '差旅费申请', 'status': 'pending'},
    {'bilId': 'AE', 'bilNo': 'AE202605002', 'bilDate': '2026-05-15', 'applicant': '李四', 'dept': '销售部', 'amount': 3000.0, 'remark': '招待费', 'status': 'approved'},
    {'bilId': 'BX', 'bilNo': 'BX202606001', 'bilDate': '2026-06-25', 'applicant': '张三', 'dept': '技术部', 'amount': 2380.0, 'remark': '上海出差', 'status': 'pending'},
    {'bilId': 'BX', 'bilNo': 'BX202605001', 'bilDate': '2026-05-20', 'applicant': '李四', 'dept': '销售部', 'amount': 156.0, 'remark': '办公用品', 'status': 'approved'},
  ];
}
