import Image1 from "./icons/5.png";
import Image2 from "./icons/4.png";
import Image3 from "./icons/3.png";
import Image4 from "./icons/2.png";
import Image5 from "./icons/1.png";
import clx1 from "./icons/clx5.svg";
import clx2 from "./icons/clx4.svg";
import clx3 from "./icons/clx3.svg";
import clx4 from "./icons/clx2.svg";
import clx5 from "./icons/clx1.svg";

import scoreIcon from "./scoreIcon.json";

export interface IScoreItem {
	color: string;
	icon: string;
	score: string | number;
	leve: number | number;
	measureIndex?: number;
	measureRenderIndex?: number;
	show: boolean;
}
export interface IEvaluatings {
	[_key: number]: IScoreItem;
}

export const leveByScoreMeasureIcons = [
	{
		icon: scoreIcon.bad,
		text: "bad",
		color: "#EE4C6A",
	},
	{
		icon: scoreIcon.good,
		text: "good",
		color: "#FF958B",
	},
	{
		icon: scoreIcon.great,
		text: "great",
		color: "#FF8E5A",
	},
	{
		icon: scoreIcon.perfect,
		text: "perfect",
		color: "#516AFF",
	},
];

const icons = [
	{
		img: Image1,
		tips: "你的演奏不太好，再练一练吧～",
		mome: "敢于尝试",
		clxImg: clx1,
		clxtip: "你的演奏不太好，音准和完整性还需加强，再练一练吧～",
		djytip: "你的演奏不太好，节奏还需加强，再练一练吧～",
		clxmome: "敢于尝试"
	},
	{
		img: Image2,
		tips: "你的演奏还不熟练，加紧训练才能有好成绩哦～",
		mome: "还要加油哦～",
		clxImg: clx2,
		clxtip: "你的演奏还不熟练，音准和完整性还需加强，加紧训练才能有好成绩哦～",
		djytip: "你的演奏还不熟练，节奏把握不太理想，加紧训练才能有好成绩哦～",
		clxmome: "还要加油哦～"
	},
	{
		img: Image3,
		tips: "你的演奏还不流畅，科学的练习才能更完美哦～",
		mome: "突破自我",
		clxImg: clx3,
		clxtip: "你的演奏还不流畅，音准和节奏还需加强，科学的练习才能更完美哦～",
		djytip: "你的演奏还不流畅，部分节奏需要勤加练习，科学的练习才能更完美哦～",
		clxmome: "突破自我"
	},
	{
		img: Image4,
		tips: "你的演奏还不错，继续加油吧，离完美就差一步啦～",
		mome: "崭露头角",
		clxImg: clx4,
		clxtip: "你的演奏还不错，继续加油吧，加强音准，离完美就差一步啦～",
		djytip: "你的演奏还不错，节奏还有些小瑕疵，离完美就差一步啦～",
		clxmome: "崭露头角"
	},
	{
		img: Image5,
		tips: "你的演奏完美无缺，继续努力吧～",
		mome: "你很棒",
		clxImg: clx5,
		clxtip: "你的演奏非常不错，音准的把握和节奏稍有瑕疵，完整性把握的很好~",
		djytip: "你的演奏非常不错，距离完成仅有一步之遥~",
		clxmome: "你很棒"
	},
];

export const getLeveByScore = (score?: number) => {
	if (!score && typeof score !== "number") {
		return {};
	}
	let leve: any = 0;
	if (score > 20 && score <= 40) {
		leve = 1;
	} else if (score > 40 && score <= 60) {
		leve = 2;
	} else if (score > 60 && score <= 80) {
		leve = 3;
	} else if (score > 80) {
		leve = 4;
	}
	return {
		...icons[leve],
		leve
	};
};

export const getLeveByScoreMeasure = (score?: number) => {
	if (!score && typeof score !== "number") {
		return {};
	}
	let leve: any = 0;
	if (score >= 40 && score < 70) {
		leve = 1;
	} else if (score >= 70 && score < 90) {
		leve = 2;
	} else if (score >= 90) {
		leve = 3;
	}
	return leve;
};
