package com.inspect.message;

import com.inspect.task.mapper.PatrolTaskMapper;
import com.inspect.task.service.IPatrolTaskService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class MessageUtils {

	final private Logger log = LoggerFactory.getLogger(MessageUtils.class);

	@Autowired
	private IPatrolTaskService patrolTaskService;

	private String language = null;

	public String get(String key) {
		if(language == null) {
			language = patrolTaskService.selectConfigByKey("LANGUAGE");
			if(language == null) {
				language = "";
			}
		}
//		log.info("language:{}, key:{}", language, key);
		if(language == null || !language.equalsIgnoreCase("en")) {
			return key;
		} else {
			switch (key) {
				case "巡视报告":
					return "Inspection Report";
				case "变电站":
					return "Substation";
				case "电压等级":
					return "Voltage level";
				case "巡视计划创建日期":
					return "Inspection plan creation date";
				case "变电站类别":
					return "Substation category";
				case "巡视任务":
					return "Inspection task";
				case "环境信息":
					return "environmental information";
				case "审核人":
					return "reviewer";
				case "审核时间":
					return "Audit time";
				case "巡视开始时间":
					return "Inspection start time";
				case "巡视结束时间":
					return "Inspection end time";
				case "巡视统计":
					return "Inspection statistics";
				case "巡视结论":
					return "Inspection conclusion";
				case "异常":
					return "Abnormal";
				case "待人工确认":
					return "Manual confirmation";
				case "正常":
					return "Normal";
				case "点位汇总":
					return "Point Summary";
				case "编号":
					return "Number";
				case "区域":
					return "Region";
				case "间隔":
					return "Bay";
				case "设备":
					return "Device";
				case "部件":
					return "Component";
				case "点位":
					return "Point";
				case "数据来源":
					return "Data sources";
				case "采集时间":
					return "Collection time";
				case "巡视结果":
					return "Inspection results";
				case "点位状态":
					return "Point status";
				case "巡视图像":
					return "Patrol image";
				case "相机名":
					return "Camera name";
				case "系统":
					return "System";
				case "点位名称":
					return "Point name";
				case "状态":
					return "Status";
				case "算法名称":
					return "Algorithm name";
				case "读数":
					return "Reading";
				case "筛选图片":
					return "Filter image";
				case "筛选结果":
					return "Filter results";
				case "分析图片":
					return "Analyze image";
				case "分析结果":
					return "Analysis results";
				case "任务详情":
					return "Task details";
				case "线路名称":
					return "LineId";
				case "巡视设备名称":
					return "patrolDeviceName";
				case "巡视设备编码":
					return "patrolDeviceCode";
				case "任务名称":
					return "taskName";
				case "任务编码":
					return "taskCode";
				case "设备点位":
					return "deviceName";
				case "设备点位ID":
					return "deviceId";
				case "识别结果":
					return "value";
				case "识别结果带单位":
					return "valueUnit";
				case "巡视时间":
					return "time";
				case "识别类型":
					return "recognitionType";
				case "文件类型":
					return "fileType";
				case "巡视任务执行ID":
					return "taskPatrolledId";
				case "结论":
					return "conclusion";
				case "归档状态":
					return "patrolStatusName";
				case "审核结果":
					return "checkResult";
				case "巡视结果数据来源":
					return "dataType";
				case "摄像机":
					return "camera";
				case "机器人":
					return "robot";
				case "无人机":
					return "drone";
				case "声纹":
					return "voiceprint";
				case "在线监测":
					return "onlineMonitoring";
				case "表计读取":
					return "bjdq";
				case "位置状态识别":
					return "positionStatusRecognition";
				case "红外测温":
					return "infrared";
				case "仪表读数":
					return "meter";
				case "形变":
					return "xb";
				case "红外1800":
					return "infra_1800";
				case "无人机红外":
					return "infra_yu3";
				case "摄像头红外":
					return "infra_camera";
				case "摄像头红外灰度反算":
					return "infra_camera_reverse";
				case "未审核":
					return "unreviewed";
				case "已审核":
					return "reviewed";
				case "红外图谱":
					return "infra_spectrum";
				case "可见光照片":
					return "visible_photo";
				case "音频":
					return "audio";
				case "视频":
					return "video";
				case "失败":
					return "fail";
				case "成功":
					return "success";
				case "判别异常":
					return "judgeAbnormal";
				case "数据对比分析":
					return "analysis";
				case "有缺陷":
					return "defects";
				case "无缺陷":
					return "noDefects";
				case "总点位：%d个,已检点位：%d个,未检点位：0个,正常点位：%d个,异常点位：%d个,待人工确认点位：%d个。":
					return "Total points: %d, checked points: %d, unchecked points: 0, normal points: %d, abnormal points: %d, manual confirmation points: %d.";
				case "缺陷总数：%d个":
					return "Total defects: %d";
				case "高清视频":
					return "video";
				case "空值":
					return "null";
				case "算法内部异常":
					return "algorithm internal exception";
				case "未知错误":
					return "unknown error";
				case "与样本有差异":
					return "difference from sample";
				case "表计超限":
					return "meter limit exceeded";
				case "红外":
					return "infrared";
				case "告警":
					return "alarm";
				case "系统审核":
					return "system review";
				case "数值正常":
					return "normal value";
				case "数值小于告警阈值最小值":
					return "value less than minimum alarm threshold";
				case "数值大于告警阈值最大值":
					return "value greater than maximum alarm threshold";
				case "巡视异常":
					return "patrol abnormal";
				case "识别完成":
					return "recognition complete";
				case "读数失败":
					return "reading failed";
				case "初筛":
					return "filter";
				case "大模型":
					return "AI";
				case "汇总":
					return "summary";
				case "缺陷":
					return "defect";
				case"分析失败":
					return "analysis failed";
				default:
			        return key;
			}
		}
	}
}
