
import 'dart:ui';

import 'package:farmer_client/models/entities/OrderInfoModel.dart';

int getProcessStatus(OrderInfoModel orderInfo) {
  // 订单完成
  if (orderInfo.isEvaluated == 1) {
    return 6;
  }

  // 待支付
  if (orderInfo.workStatus == 3 && orderInfo.charges! > 0 && orderInfo.payStatus != 1) {
    return 4;
  }

  // 待评价
  if (orderInfo.workStatus == 3 && orderInfo.isEvaluated == 0) {
    return 5;
  }

  // 工作中
  if (orderInfo.workStatus! > 0 && orderInfo.workStatus! < 3 && orderInfo.dispatchStatus == 1) {
    return 3;
  }

  // 待接单
  if (orderInfo.workStatus == 0 && orderInfo.dispatchStatus == 1) {
    return 2;
  }

  // 待分配
  if (orderInfo.status == 1 && orderInfo.dispatchStatus == 0) {
    return 1;
  }

  return -1;
}

class ProcessSign {
  String label;
  Color color;
  ProcessSign({ required this.label, required this.color });
}

ProcessSign getProcessSign(int processStatus) {
  switch (processStatus) {
    case 1:
      return ProcessSign(label: '待分配', color: const Color(0xFFFF703B));
    case 2:
      return ProcessSign(label: '待作业', color: const Color(0xFFFF703B));
    case 3:
      return ProcessSign(label: '进行中', color: const Color(0xFF44F68B));
    case 4:
      return ProcessSign(label: '待付款', color: const Color(0xFF51D4FF));
    case 5:
      return ProcessSign(label: '待评价', color: const Color(0xFF51D4FF));
    case 6:
      return ProcessSign(label: '已完成', color: const Color(0xFFFF703B));
    default:
      return ProcessSign(label: '未知', color: const Color(0xFFFF0000));
  }
}
