package com.prodhack.moscow2025.presentation.utils

import com.prodhack.moscow2025.domain.models.EducationGrades
import com.prodhack.moscow2025.domain.models.ExperienceType
import kotlin.math.roundToInt

fun ExperienceType.toReadableText(): String = when (this) {
	ExperienceType.NoExperience -> "Нет опыта"
	ExperienceType.Between1And3 -> "1-3 года"
	ExperienceType.Between3And6 -> "3-6 лет"
	ExperienceType.MoreThan6 -> "Более 6 лет"
}

fun EducationGrades.toReadableText(): String = when (this) {
	EducationGrades.BasicGeneralEducation -> "Базовое общее"
	EducationGrades.SecondaryGeneralEducation -> "Среднее общее"
	EducationGrades.SecondaryProfessionalEducation -> "Среднее профессиональное"
	EducationGrades.Bachelor -> "Бакалавр"
	EducationGrades.Specialist -> "Специалист"
	EducationGrades.Master -> "Магистр"
	EducationGrades.PostgraduateStudies -> "Аспирантура"
	EducationGrades.Other -> "Другое"
}

fun Pair<Float?, Float?>?.toSalaryRangeString(): String = when {
	this == null -> "Загрузка..."
	first != null && second != null -> "${first!!.roundToInt()}₽ - ${second!!.roundToInt()}₽"
	first != null -> "от ${first!!.roundToInt()}₽"
	second != null -> "до ${second!!.roundToInt()}₽"
	else -> "н/д"
}