export const hazardLevels = ['重大', 'A', 'B', 'C'];

export const hazardLevelOptions: Option<string>[] = [
  { label: '重大', value: '重大' },
  { label: 'A类', value: 'A' },
  { label: 'B类', value: 'B' },
  { label: 'C类', value: 'C' },
];

export const hazardTypeOptions: Option[] = [
  { label: '生产现场类隐患', value: 'product' },
  { label: '基础管理类隐患', value: 'base' },
];

export const getHazardTypeText = (t: string) => {
  return hazardTypeOptions.find(hz => hz.value === t)?.label || '';
};

export const hazardLevelColor: Record<string, string> = {
  '重大': '#FA5F25',
  'A': '#FFA100',
  B: '#6600FF',
  C: '#3083E6',
};

export const hazardStatusColor: Record<string, string> = {
  0: '#3083E6',
  1: '#21A858',
  2: '#5E5E5E',
};
export const hazardStatusBgColor: Record<string, string> = {
  0: '#5E5E5E66',
  1: '#3083E666',
  2: '#30E67A66',
};

export const hazardStatusOptions: Option<number>[] = [
  // 0未审核，1已审核,2已拒绝
  { value: 0, label: '未审核' },
  { value: 1, label: '已审核' },
  { value: 2, label: '已拒绝' },
];

export const hazardFinalStatusOptions: Option<string>[] = [
  // 未审核，已审核，已拒绝，方案待审核，方案通过，方案驳回，治理中,治理完成，验收不合格，验收合格
  { value: '未审核', label: '未审核' },
  { value: '已审核', label: '已审核' },
  { value: '已拒绝', label: '已拒绝' },
  { value: '方案待审核', label: '方案待审核' },
  { value: '方案通过', label: '方案通过' },
  { value: '方案驳回', label: '方案驳回' },
  { value: '治理中', label: '治理中' },
  { value: '治理完成', label: '治理完成' },
  { value: '验收不合格', label: '验收不合格' },
  { value: '验收合格', label: '验收合格' },
];

export const getHazardStatusText = (s: number) => {
  return hazardStatusOptions.find(hz => hz.value === s)?.label || '';
};

export const getCombinedHazardStatusText = (data: Hazard.HazardDto) => {
  if (data.status !== 1) {
    return getHazardStatusText(data.status);
  }
  if (data.planStatus === 0) {
    return '方案待审核';
  }
  if (data.planStatus === 3) {
    return '方案驳回';
  }
  if (data.resolveStatus === 0) {
    return '治理中';
  }
  if (data.resolveStatus === 1) {
    return '验收合格';
  }
  return getHazardStatusText(data.status);
};
export const getHazardFinalStatusColor = (text: string) => {
  switch (text) {
    case '未审核':
      return '#5E5E5E';
    case '已拒绝':
      return '#ef4444';
    case '已审核':
      return '#21A858';
    case '方案待审核':
      return '#5E5E5E';
    case '方案通过':
      return '#21A858';
    case '方案驳回':
      return '#ef4444';
    case '治理中':
      return '#3083E6';
    case '治理完成':
      return '#21A858';
    case '验收合格':
      return '#21A858';
    case '验收不合格':
      return '#ef4444';
    default:
      return '#5E5E5E';
  }
};
export const getHazardFinalStatusBgColor = (text: string) => {
  return getHazardFinalStatusColor(text) + '28';
};

export interface SearchParams {
  status: number;
  finalStatus: string;
  level: string;
  onlyMine: boolean;
}

export const hazardMeasureStatusOptions: Option<number>[] = [
  { value: 0, label: '待审核' },
  { value: 1, label: '通过' },
  { value: 3, label: '驳回, 请重新填写' },
];

export const getHazardMeasureStatusText = (s: number) => {
  return hazardMeasureStatusOptions.find(hz => hz.value === s)?.label || '';
};

export const hazardMeasureStatusColor: Record<string, string> = {
  0: '#5E5E5E',
  1: '#3083E6',
  3: '#FA5F25',
};
