import {Module} from "@/interfaces";

export const MODULES: Module[] = ["reading", "listening", "writing", "speaking"];

// BAND SCORES is not in use anymore and level scoring is made based on thresholds
// export const BAND_SCORES: {[key in Module]: number[]} = {
// 	reading: [0, 2.5, 3, 3.5, 4, 4.5, 5, 5.5, 6, 6.5, 7, 7.5, 8, 8.5, 9],
// 	listening: [0, 2.5, 3, 3.5, 4, 4.5, 5, 5.5, 6, 6.5, 7, 7.5, 8, 8.5, 9],
// 	writing: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
// 	speaking: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
// 	level: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
// };

export type LevelScore = "Advanced" | "Upper-Intermediate" | "Intermediate" | "Pre-Intermediate" | "Elementary" | "Beginner";


const generateHighestScoreText = () : React.ReactNode => (
	<>
		<br />
		<br />
		If you disagree with the result, you can request a review by a qualified teacher. We are committed to the accuracy and transparency of
		the results.
		<br />
		<br />
		Please contact us for further information. Congratulations again on your outstanding achievement! We are here to support you on your
		academic journey.
	</>
);

const generateAverageScoreText = () : React.ReactNode => (
	<>
		<br />
		<br />
		If you have any concerns about the result, you can request a review by a qualified teacher. We are committed to the accuracy and
		transparency of the results.
		<br />
		<br />
		Please contact us for further information. Congratulations again on your achievement! We are here to support you on your academic
		journey.
	</>
);

const generateLowestScoreText = () : React.ReactNode => (
	<>
		<br />
		<br />
		If you have any concerns about the result, you can request a review by a qualified teacher. We are committed to the accuracy and
		transparency of the results.
		<br />
		<br />
		Please contact us for further information. We encourage you to continue your studies and wish you the best of luck in your future
		endeavors.
	</>
)

export const levelResultText = (level: number) => {
	if(level === 9) {
		return (
			<>
				{"Outstanding! Your command of English is excellent. Focus on fine-tuning subtle language nuances and exploring sophisticated vocabulary. Keep up the excellent work!"}
				{generateHighestScoreText()}
			</>
		);
	}
	if(level >= 8) {
		return (
			<>
				{"Impressive! You're approaching fluency. Continue refining nuances in grammar and expanding your vocabulary to express ideas more precisely."}
				{generateAverageScoreText()}
			</>
		);
	}
	if(level >= 6) {
		return (
			<>
				{"Great job! You're navigating the complexities of English. Keep honing your grammar skills and exploring more advanced vocabulary."}
				{generateAverageScoreText()}
			</>
		);
	}
	if(level >= 4) {
		return (
			<>
				{"Well done! You're moving beyond the basics. Work on expanding your vocabulary and refining your understanding of grammar structures."}
				{generateAverageScoreText()}
			</>
		);
	}
	if(level >= 2) {
		return (
			<>
				{"Good effort! You're making progress. Continue studying and pay attention to common vocabulary and fundamental grammar rules."}
				{generateAverageScoreText()}
			</>
		);
	}
	if(level >= 0) {
		return (
			<>
				{"Keep practicing! You're just starting, and improvement takes time. Focus on building your vocabulary and basic grammar skills."}
				{generateLowestScoreText()}
			</>
		);
	}

	return null;
};


export const moduleResultText = (module: Module, level: number) => {
	if(module === 'level') return levelResultText(level);
	if (level === 9) {
		return (
			<>
				Congratulations on your exam performance! You achieved an impressive <span className="font-bold">level {level}</span>, demonstrating
				excellent mastery of the assessed knowledge.
				{generateHighestScoreText()}
			</>
		);
	}

	if (level >= 6) {
		return (
			<>
				Congratulations on your exam performance! You achieved a commendable <span className="font-bold">level {level}</span>, demonstrating a
				good understanding of the assessed knowledge.
				{generateAverageScoreText()}
			</>
		);
	}

	if (level >= 3) {
		return (
			<>
				Congratulations on your exam performance! You achieved a <span className="font-bold">level of {level}</span>, demonstrating a
				satisfactory understanding of the assessed knowledge.
				{generateAverageScoreText()}
			</>
		);
	}

	return (
		<>
			Thank you for taking the exam. You achieved a <span className="font-bold">level {level}</span>, but unfortunately, it did not meet the
			required standards.
			{generateLowestScoreText()}
		</>
	);
};