export function getTimeInMins(timeInSeconds: number) {
	const totalMinutes = Math.floor(timeInSeconds / 60);
	const sec = timeInSeconds % 60;
	const hours = Math.floor(totalMinutes / 60);
	const min = totalMinutes % 60;

	return {
		hours,
		min,
		sec: Math.floor(sec),
		// biome-ignore format:
		full: `${timeInHoursMins(hours, min, false) ?? ""} ${sec > 0 ? `${Math.floor(sec)} sec` : ""}`.trim(),
		// biome-ignore format:
		fullShort: `${timeInHoursMins(hours, min, true) ?? ""} ${sec > 0 ? `${Math.floor(sec)}s` : ""}`.trim(),
		// biome-ignore format:
		numbers: `${String(min).padStart(2, '0')}:${String(Math.floor(sec)).padStart(2, '0')}`, // no hours, only mins and seconds here
	};
}

function timeInHoursMins(hours: number, mins: number, short: boolean) {
	const parts = [];
	// biome-ignore format:
	if (hours > 0) parts.push(short ? `${hours}h` : `${hours} ${hours > 1 ? "hours" : "hour"}`);
	// biome-ignore format:
	if (mins > 0) parts.push(short ? `${mins}m` : `${mins} ${mins > 1 ? "mins" : "min"}`);
	if (parts.length === 0) return null;
	return parts.join(" ");
}
