import { PROJECT_EXE_STATUS_CODE } from '@/utils/enum/project';
import { DEMAND_STATUS, TASK_PROCESS_STATUS, TASK_CALCULATE_STATUS } from '@/utils/enum/task';
import { FLOW_APPROVE_STATUS_ENUM } from '@/utils/enum/flow';

// 项目执行状态
export const projectStatus = (status: string) => {
  switch (status) {
    case PROJECT_EXE_STATUS_CODE.NOT_STARTED: // 未开始
      return 'info';
    case PROJECT_EXE_STATUS_CODE.IN_PROGRESS: // 进行中
      return 'primary';
    case PROJECT_EXE_STATUS_CODE.COMPLETED: // 已完成
      return 'success';
    case PROJECT_EXE_STATUS_CODE.CLOSED: // 已关闭
      return 'error';
    case PROJECT_EXE_STATUS_CODE.PAUSED: // 已暂停
      return 'warning';
    case PROJECT_EXE_STATUS_CODE.POSTPONED: // 已延期
      return 'error';
    default:
      return 'info';
  }
};

export const demandStatus = (status: any) => {
  switch (status) {
    case TASK_PROCESS_STATUS.COMPLETED:
      return 'success';
    case TASK_PROCESS_STATUS.IN_PROGRESS:
      return 'primary';
    case TASK_PROCESS_STATUS.NO_STARTED:
      return 'info';
    case TASK_PROCESS_STATUS.PAUSED:
      return 'warning';
    case DEMAND_STATUS.NO_SEND:
      return 'info';
    default:
      return 'error';
  }
};

/**
 * 任务达成状态 合格不合格
 * @param status
 * @returns
 */
export const getTaskAchieveStyleClass = (status: any) => {
  const statusStr = String(status);
  switch (statusStr) {
    case TASK_CALCULATE_STATUS.QUALIFIED:
      return 'success';
    case TASK_CALCULATE_STATUS.UNQUALIFIED:
      return 'error';
    case TASK_CALCULATE_STATUS.NO_CALCULATE:
      return 'info';
    default:
      return 'info';
  }
};

/**
 * 任务执行状态 执行中、未开始、暂停、已完成等
 * @param status
 * @returns
 */
export const getTaskExeStyleClass = (status: string) => {
  switch (status) {
    case TASK_PROCESS_STATUS.COMPLETED:
      return 'success';
    case TASK_PROCESS_STATUS.IN_PROGRESS:
      return 'primary';
    case TASK_PROCESS_STATUS.NO_STARTED:
      return 'info';
    case TASK_PROCESS_STATUS.PAUSED:
      return 'warning';
    case TASK_PROCESS_STATUS.REJECTED:
      return 'error';
    case TASK_PROCESS_STATUS.CLOSED:
      return 'info';
    default:
      return 'info';
  }
};

/**
 * 审批状态
 * @param status
 * @returns
 */
export const getApproveStyleClass = (status: number) => {
  const numberStatus = Number(status);
  switch (numberStatus) {
    case FLOW_APPROVE_STATUS_ENUM.APPROVED:
      return 'success';
    case FLOW_APPROVE_STATUS_ENUM.APPROVING:
      return 'warning';
    case FLOW_APPROVE_STATUS_ENUM.NOT_APPROVED:
      return 'info';
    case FLOW_APPROVE_STATUS_ENUM.NOT_APPROVED_REJECT:
      return 'error';
    default:
      return 'info';
  }
};

export const statusMapFun = (type: any) => {
  switch (type) {
    case TASK_PROCESS_STATUS.COMPLETED:
      return 'success';
    case TASK_PROCESS_STATUS.IN_PROGRESS:
      return 'primary';
    case TASK_PROCESS_STATUS.NO_STARTED:
      return 'info';
    case TASK_PROCESS_STATUS.PAUSED:
      return 'warning';
    default:
      return 'error';
  }
};

export const statusMapFun2 = (type: any) => {
  switch (type) {
    case TASK_CALCULATE_STATUS.QUALIFIED:
      return 'success';
    case TASK_CALCULATE_STATUS.UNQUALIFIED:
      return 'error';
    case TASK_CALCULATE_STATUS.NO_CALCULATE:
      return 'info';
    default:
      return 'info';
  }
};

export const statusMapFun3 = (type: any) => {
  switch (type) {
    case FLOW_APPROVE_STATUS_ENUM.NOT_APPROVED:
      return 'primary';
    case FLOW_APPROVE_STATUS_ENUM.APPROVING:
      return 'warning';
    case FLOW_APPROVE_STATUS_ENUM.APPROVED:
      return 'success';
    default:
      return 'error';
  }
};

export const statusMapFun4 = (type: any) => {
  switch (type) {
    case FLOW_APPROVE_STATUS_ENUM.NOT_APPROVED:
      return 'primary';
    case FLOW_APPROVE_STATUS_ENUM.APPROVING:
      return 'warning';
    case FLOW_APPROVE_STATUS_ENUM.APPROVED:
      return 'success';
    default:
      return 'error';
  }
};

export const statusMapFun5 = (status: string) => {
  switch (status) {
    case '0':
      return 'info';
    case '1':
      return 'error';
    case '2':
      return 'success';
    default:
      return 'info';
  }
};

export const statusMapFun6 = (status: string) => {
  switch (status) {
    case '1':
      return 'info';
    case '2':
      return 'primary';
    case '3':
      return 'error';
    case '4':
      return 'success';
    case '5':
      return 'warning';
    case '6':
      return 'info';
    case '7':
      return 'error';
    default:
      return 'info';
  }
};
