
// attributeDisplay provides a function to format profile attributes for display in the GUI
// Example: Raw Distance is formatted as a distance in kilometers, and we may need to convert it to metric

package attributeDisplay

//TODO: Deal with singular/multiple values and how that changes an attribute value's units
// For example: 1 variant, 2 variants, 1 centimeter, 2 centimeters

import "seekia/internal/convertCurrencies"
import "seekia/internal/globalSettings"
import "seekia/internal/helpers"
import "seekia/internal/network/appNetworkType/getAppNetworkType"
import "seekia/internal/translation"
import "seekia/internal/worldLocations"
import "seekia/internal/worldLanguages"
import "seekia/internal/currencies"

import "strings"
import "errors"

// This function will format the values into the user's currently selected language or measurement system
// This function also supports calculated attributes
//Outputs:
//	-string: Attribute Title (translated)
//	-bool: Attribute is numerical
//	-func(string)(string, error): Function to convert attribute value to a displayable, translated value
//		-Inputs:
//			-string: Raw attribute value
//		-Outputs:
//			-string: Formatted attribute value
//			-error
//	-string: Units of the attribute value (translated)
//	-string: Translated text to show if data is unavailable ("No Response"/"Unknown")
//		-Example: Height is missing = "No Response", Identity Score is missing = "Unknown"
//		- If it is impossible for the data to be unavailable, we return "". Example: IsMyContact
//	-error
func GetProfileAttributeDisplayInfo(attributeName string)(string, bool, func(string)(string, error), string, string, error){

	passValueFunction := func(input string)(string, error){
		return input, nil
	}

	formatPercentageFunction := func(input string)(string, error){

		valueFloat64, err := helpers.ConvertStringToFloat64(input)
		if (err != nil){
			return "", errors.New("formatPercentageFunction called with non-numeric " + attributeName + " value: " + input)
		}

		if (valueFloat64 < 0 || valueFloat64 > 100){
			return "", errors.New("formatPercentageFunction called with invalid " + attributeName + " percentage value: " + input)
		}

		result := helpers.ConvertIntToString(int(valueFloat64))

		return result, nil
	}

	roundNumberFunction_Float64 := func(input float64)(string, error){

		// We check to see if we need to round the number
		// We need this for readability
		// We also convert the number to show numeric units (Example: 5500000 -> 5.5 million)

		if (input < 1000){

			numberIsInteger := helpers.CheckIfFloat64IsInteger(input)
			if (numberIsInteger == true){

				valueRounded := helpers.ConvertFloat64ToStringRounded(input, 0)
				return valueRounded, nil
			}

			valueRounded := helpers.ConvertFloat64ToStringRounded(input, 2)
			return valueRounded, nil
		}

		translatedNumber, err := helpers.ConvertFloat64ToRoundedStringWithTranslatedUnits(input)
		if (err != nil) { return "", err }

		return translatedNumber, nil
	}

	roundNumberFunction := func(input string)(string, error){

		valueFloat64, err := helpers.ConvertStringToFloat64(input)
		if (err != nil){
			return "", errors.New("roundNumberFunction called with non-numeric " + attributeName + " value: " + input)
		}

		result, err := roundNumberFunction_Float64(valueFloat64)
		if (err != nil) { return "", err }

		return result, nil
	}

	translateValueFunction := func(input string)(string, error){

		result := translation.TranslateTextFromEnglishToMyLanguage(input)
		return result, nil
	}

	noResponseTranslated := translation.TranslateTextFromEnglishToMyLanguage("No Response")
	unknownTranslated := translation.TranslateTextFromEnglishToMyLanguage("Unknown")

	switch attributeName {

		case "ProfileVersion":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Profile Version")

			return titleTranslated, true, passValueFunction, "", "", nil
		}
		case "NetworkType":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Network Type")

			return titleTranslated, true, passValueFunction, "", "", nil
		}
		case "IdentityKey":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Identity Key")

			return titleTranslated, false, passValueFunction, "", "", nil
		}
		case "IdentityHash":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Identity Hash")

			return titleTranslated, false, passValueFunction, "", "", nil
		}
		case "ProfileType":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Profile Type")

			return titleTranslated, false, translateValueFunction, "", "", nil
		}
		case "CreationTime":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Creation Time")

			return titleTranslated, true, passValueFunction, "", "", nil
		}
		case "Disabled":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Disabled")

			// This attribute will either have the value "Yes" or it won't exist

			return titleTranslated, false, translateValueFunction, "", "", nil
		}
		case "DeviceIdentifier":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Device Identifier")

			return titleTranslated, false, passValueFunction, "", "", nil
		}
		case "NaclKey":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Nacl Key")

			return titleTranslated, false, passValueFunction, "", "", nil
		}
		case "MlkemKey":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Mlkem Key")

			return titleTranslated, false, passValueFunction, "", "", nil
		}
		case "CsidhKey":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Csidh Key")

			return titleTranslated, false, passValueFunction, "", "", nil
		}
		case "ChatKeysLatestUpdateTime":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Chat Keys Latest Update Time")

			return titleTranslated, true, passValueFunction, "", "", nil
		}
		case "Username", "Description", "Hobbies", "Job", "Beliefs":{

			// These are attributes which are not numerical and do not need their value translated
			// These attributes also have a title which is identical to their name
			// They are also all user-supplied, so they have a possible No Response value.

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage(attributeName)

			return titleTranslated, false, passValueFunction, "", noResponseTranslated, nil
		}
		case "Photos", "Avatar", "Language", "Questionnaire", "Tags":{

			// These are attributes which should not be displayed as strings in the GUI
			// They must be displayed in a custom way
			// These attributes also have a title which is identical to their name
			// They are also all user-supplied, so they have a possible No Response value.

			// Photos: a list of base64 jpeg images, separated by "+"
			// Avatar: an integer which references an emoji (see /internal/imageFiles/emojis.go)

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage(attributeName)

			return titleTranslated, false, passValueFunction, "", noResponseTranslated, nil
		}
		case "GenderIdentity":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Gender Identity")

			translateGenderFunction := func(input string)(string, error){

				if (input == "Man" || input == "Woman"){
					result := translation.TranslateTextFromEnglishToMyLanguage(input)
					return result, nil
				}
				return input, nil
			}

			return titleTranslated, false, translateGenderFunction, "", noResponseTranslated, nil
		}
		case "FruitRating",
			"VegetablesRating",
			"NutsRating",
			"GrainsRating",
			"DairyRating",
			"SeafoodRating",
			"BeefRating",
			"PorkRating",
			"PoultryRating",
			"EggsRating",
			"BeansRating",
			"PetsRating",
			"DogsRating",
			"CatsRating":{

			thingName := strings.TrimSuffix(attributeName, "Rating")

			attributeTitle := thingName + " Rating"

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage(attributeTitle)

			return titleTranslated, true, passValueFunction, "/10", noResponseTranslated, nil
		}
		case "AlcoholFrequency":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Alcohol Frequency")

			return titleTranslated, true, passValueFunction, "/10", noResponseTranslated, nil
		}
		case "TobaccoFrequency":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Tobacco Frequency")

			return titleTranslated, true, passValueFunction, "/10", noResponseTranslated, nil
		}
		case "CannabisFrequency":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Cannabis Frequency")

			return titleTranslated, true, passValueFunction, "/10", noResponseTranslated, nil
		}
		case "Fame":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Fame")

			return titleTranslated, true, passValueFunction, "/10", noResponseTranslated, nil
		}
		case "Wealth":{

			// This attribute should not be displayed to the user, use WealthInGold instead.

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Wealth")

			return titleTranslated, true, passValueFunction, "", noResponseTranslated, nil
		}
		case "WealthCurrency":{

			// This attribute should not be displayed to the user, use WealthInGold to display wealth in a user's currency instead.

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Wealth Currency")

			return titleTranslated, false, passValueFunction, "", noResponseTranslated, nil
		}
		case "WealthIsLowerBound":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Wealth Is Lower Bound")

			// Value is either "Yes" or "No"

			return titleTranslated, false, translateValueFunction, "", noResponseTranslated, nil
		}
		case "WealthInGold":{

			// We use this attribute to display a user's Wealth
			// We have to convert it to the user's currency

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Wealth")

			getAppCurrency := func()(string, error){

				exists, appCurrencyCode, err := globalSettings.GetSetting("Currency")
				if (err != nil) { return "", err }
				if (exists == false){
					return "USD", nil
				}
				return appCurrencyCode, nil
			}
			appCurrencyCode, err := getAppCurrency()
			if (err != nil) { return "", false, nil, "", "", err }

			_, appCurrencySymbol, err := currencies.GetCurrencyInfoFromCurrencyCode(appCurrencyCode)
			if (err != nil) { return "", false, nil, "", "", err }

			appNetworkType, err := getAppNetworkType.GetAppNetworkType()
			if (err != nil){ return "", false, nil, "", "", err }

			formatValueFunction := func(profileWealthInGold string)(string, error){

				wealthInGoldFloat64, err := helpers.ConvertStringToFloat64(profileWealthInGold)
				if (err != nil) { return "", err }

				_, convertedProfileWealth, err := convertCurrencies.ConvertKilogramsOfGoldToAnyCurrency(appNetworkType, wealthInGoldFloat64, appCurrencyCode)
				if (err != nil) { return "", err }

				convertedResult, err := roundNumberFunction_Float64(convertedProfileWealth)
				if (err != nil) { return "", err }

				resultWithSymbol := appCurrencySymbol + convertedResult

				return resultWithSymbol, nil
			}

			currencyCodePadded := " " + appCurrencyCode

			return titleTranslated, true, formatValueFunction, currencyCodePadded, noResponseTranslated, nil
		}
		case "HasGenitalHerpes":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Has Genital Herpes")

			return titleTranslated, false, passValueFunction, "", noResponseTranslated, nil
		}
		case "HasHIV":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Has HIV")

			return titleTranslated, false, passValueFunction, "", noResponseTranslated, nil
		}
		case "HairColor":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Hair Color")

			return titleTranslated, false, passValueFunction, "", noResponseTranslated, nil
		}
		case "HairTexture":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Hair Texture")

			formatHairTextureValuesFunction := func(input string)(string, error){

				//TODO: Translate

				if (input == "1"){
					result := "1/6 - Straight"
					return result, nil
				}
				if (input == "2"){
					result := "2/6 - Slightly Wavy"
					return result, nil
				}
				if (input == "3"){
					result := "3/6 - Wavy"
					return result, nil
				}
				if (input == "4"){
					result := "4/6 - Big Curls"
					return result, nil
				}
				if (input == "5"){
					result := "5/6 - Small Curls"
					return result, nil
				}
				if (input == "6"){
					result := "6/6 - Very Tight Curls"
					return result, nil
				}
				return "", errors.New("HairTexture formatValuesFunction called with invalid input: " + input)
			}

			return titleTranslated, true, formatHairTextureValuesFunction, "", noResponseTranslated, nil
		}
		case "EyeColor":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Eye Color")

			return titleTranslated, false, passValueFunction, "", noResponseTranslated, nil
		}
		case "SkinColor":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Skin Color")

			return titleTranslated, true, passValueFunction, "", noResponseTranslated, nil
		}
		case "BodyMuscle":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Body Muscle")

			return titleTranslated, true, passValueFunction, "/4", noResponseTranslated, nil
		}
		case "BodyFat":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Body Fat")

			return titleTranslated, true, passValueFunction, "/4", noResponseTranslated, nil
		}
		case "Height",
			"PredictedHeight",
			"OffspringPredictedHeight":{

			getAttributeTitle := func()string{

				switch attributeName{
					case "Height":{
						return "Height"
					}
					case "PredictedHeight":{
						return "Predicted Height"
					}
				}

				return "Offspring Predicted Height"
			}

			attributeTitle := getAttributeTitle()

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage(attributeTitle)

			getMyMetricOrImperial := func()(string, error){

				exists, metricOrImperial, err := globalSettings.GetSetting("MetricOrImperial")
				if (err != nil) { return "", err }
				if (exists == false){
					return "Metric", nil
				}
				if (metricOrImperial != "Metric" && metricOrImperial != "Imperial"){
					return "", errors.New("Malformed globalSettings: Invalid metricOrImperial: " + metricOrImperial)
				}

				return metricOrImperial, nil
			}

			myMetricOrImperial, err := getMyMetricOrImperial()
			if (err != nil) { return "", false, nil, "", "", err }

			formatHeightFunction := func(input string)(string, error){

				inputCentimeters, err := helpers.ConvertStringToFloat64(input)
				if (err != nil) { return "", err }

				if (myMetricOrImperial == "Metric"){

					centimetersString := helpers.ConvertFloat64ToStringRounded(inputCentimeters, 2)

					return centimetersString, nil
				}

				feetInchesString, err := helpers.ConvertCentimetersToFeetInchesTranslatedString(inputCentimeters)
				if (err != nil) { return "", err }

				return feetInchesString, nil
			}

			getUnitsTranslated := func()string{

				if (myMetricOrImperial == "Metric"){

					unitsTranslated := translation.TranslateTextFromEnglishToMyLanguage("Centimeters")

					return unitsTranslated
				}

				// There are no units to add
				// The value is in the format "5 feet, 10 inches"

				return ""
			}

			unitsTranslated := getUnitsTranslated()

			unitsWithPadding := " " + unitsTranslated

			getUnavailableText := func()string{
				if (attributeName == "Height"){
					return noResponseTranslated
				}
				return unknownTranslated
			}

			unavailableText := getUnavailableText()

			return titleTranslated, true, formatHeightFunction, unitsWithPadding, unavailableText, nil
		}
		case "Sex":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Sex")

			return titleTranslated, false, translateValueFunction, "", noResponseTranslated, nil
		}
		case "Age":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Age")
		
			unitsTranslated := translation.TranslateTextFromEnglishToMyLanguage("Years Old")
			unitsWithPadding := " " + unitsTranslated

			return titleTranslated, true, passValueFunction, unitsWithPadding, noResponseTranslated, nil
		}
		case "IsSameSex":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Is Same Sex")

			return titleTranslated, false, translateValueFunction, "", unknownTranslated, nil
		}
		case "23andMe_AncestryComposition":{
			// There is no way to display this as text, we use the gui instead

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("23andMe Ancestry Composition")

			return titleTranslated, false, passValueFunction, "", noResponseTranslated, nil
		}
		case "23andMe_NeanderthalVariants":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("23andMe Neanderthal Variants")

			unitsTranslated := translation.TranslateTextFromEnglishToMyLanguage("Variants")

			unitsWithPadding := " " + unitsTranslated

			return titleTranslated, true, passValueFunction, unitsWithPadding, noResponseTranslated, nil
		}
		case "23andMe_OffspringNeanderthalVariants":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Offspring 23andMe Neanderthal Variants")

			unitsTranslated := translation.TranslateTextFromEnglishToMyLanguage("Variants")

			unitsWithPadding := " " + unitsTranslated

			return titleTranslated, true, passValueFunction, unitsWithPadding, unknownTranslated, nil
		}
		case "23andMe_MaternalHaplogroup":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("23andMe Maternal Haplogroup")

			return titleTranslated, false, passValueFunction, "", noResponseTranslated, nil
		}
		case "23andMe_PaternalHaplogroup":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("23andMe Paternal Haplogroup")

			return titleTranslated, false, passValueFunction, "", noResponseTranslated, nil
		}
		case "IsMyContact":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Is My Contact")

			return titleTranslated, false, translateValueFunction, "", "", nil
		}
		case "IsLiked":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Is Liked")

			return titleTranslated, false, translateValueFunction, "", "", nil
		}
		case "IsIgnored":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Is Ignored")

			return titleTranslated, false, translateValueFunction, "", "", nil
		}
		case "HasRejectedMe":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Has Rejected Me")

			return titleTranslated, false, translateValueFunction, "", "", nil
		}
		case "IHaveMessaged":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("I Have Messaged")

			return titleTranslated, false, translateValueFunction, "", "", nil
		}
		case "HasMessagedMe":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Has Messaged Me")

			return titleTranslated, false, translateValueFunction, "", "", nil
		}
		case "SearchTermsCount":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Search Terms Count")

			unitsTranslated := translation.TranslateTextFromEnglishToMyLanguage("Terms")
			unitsWithPadding := " " + unitsTranslated

			return titleTranslated, true, passValueFunction, unitsWithPadding, "", nil
		}
		case "Sexuality":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Sexuality")

			return titleTranslated, false, translateValueFunction, "", noResponseTranslated, nil
		}
		case "PrimaryLocationCountry", "SecondaryLocationCountry":{

			getTitleTranslated := func()string{

				if (attributeName == "PrimaryLocationCountry"){

					titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Primary Country")

					return titleTranslated
				}

				titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Secondary Country")

				return titleTranslated
			}

			titleTranslated := getTitleTranslated()

			formatValueFunction := func(inputValue string)(string, error){

				inputCountryIdentifier, err := helpers.ConvertStringToInt(inputValue)
				if (err != nil) { return "", err }

				countryObject, err := worldLocations.GetCountryObjectFromCountryIdentifier(inputCountryIdentifier)
				if (err != nil) { return "", err }

				countryPrimaryName := countryObject.NamesList[0]

				countryPrimaryNameTranslated := translation.TranslateTextFromEnglishToMyLanguage(countryPrimaryName)

				return countryPrimaryNameTranslated, nil
			}

			return titleTranslated, false, formatValueFunction, "", noResponseTranslated, nil 
		}
		case "PrimaryLocationLatitude":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Primary Location Latitude")

			return titleTranslated, true, roundNumberFunction, "°", noResponseTranslated, nil
		}
		case "PrimaryLocationLongitude":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Primary Location Longitude")

			return titleTranslated, true, roundNumberFunction, "°", noResponseTranslated, nil
		}
		case "SecondaryLocationLatitude":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Secondary Location Latitude")

			return titleTranslated, true, roundNumberFunction, "°", noResponseTranslated, nil
		}
		case "SecondaryLocationLongitude":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Secondary Location Longitude")

			return titleTranslated, true, roundNumberFunction, "°", noResponseTranslated, nil
		}
		case "Distance":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Distance")

			getMetricOrImperial := func()(string, error){

				exists, metricOrImperial, err := globalSettings.GetSetting("MetricOrImperial")
				if (err != nil) { return "", err }
				if (exists == false){
					return "Metric", nil
				}
				if (metricOrImperial != "Metric" && metricOrImperial != "Imperial"){
					return "", errors.New("Global settings contains invalid metricOrImperial: " + metricOrImperial)
				}
				return metricOrImperial, nil
			}

			metricOrImperial, err := getMetricOrImperial()
			if (err != nil) { return "", false, nil, "", "", err }

			if (metricOrImperial == "Metric"){

				unitsTranslated := translation.TranslateTextFromEnglishToMyLanguage("Kilometers")
				unitsWithPadding := " " + unitsTranslated

				return "Distance", true, roundNumberFunction, unitsWithPadding, unknownTranslated, nil
			}

			// We convert to imperial

			formatValueFunction := func(inputValue string)(string, error){

				distanceKilometersFloat64, err := helpers.ConvertStringToFloat64(inputValue)
				if (err != nil){
					return "", errors.New("formatValueFunction called with invalid distance: " + inputValue)
				}

				distanceMiles, err := helpers.ConvertKilometersToMiles(distanceKilometersFloat64)
				if (err != nil) { return "", err }

				distanceMilesRounded, err := roundNumberFunction_Float64(distanceMiles)
				if (err != nil) { return "", err }

				return distanceMilesRounded, nil
			}

			unitsTranslated := translation.TranslateTextFromEnglishToMyLanguage("Miles")
			unitsWithPadding := " " + unitsTranslated

			return titleTranslated, true, formatValueFunction, unitsWithPadding, unknownTranslated, nil
		}
		case "ProfileLanguage":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Profile Language")

			formatValueFunction := func(inputValue string)(string, error){
		
				languageInt, err := helpers.ConvertStringToInt(inputValue)
				if (err != nil){
					return "", errors.New("Database corrupt: Contains invalid profile language identifier: " + inputValue)
				}

				languageObject, err := worldLanguages.GetLanguageObjectFromLanguageIdentifier(languageInt)
				if (err != nil){
					return "", errors.New("Database corrupt: Contains invalid profile language identifier: " + inputValue)
				}
			
				languagePrimaryName := languageObject.NamesList[0]

				languageNameTranslated := translation.TranslateTextFromEnglishToMyLanguage(languagePrimaryName)

				return languageNameTranslated, nil
			}

			return titleTranslated, true, formatValueFunction, "", noResponseTranslated, nil
		}
		case "SeekiaVersion":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Seekia Version")

			return titleTranslated, true, passValueFunction, "", "", nil
		}
		case "IdentityScore":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Identity Score")

			return titleTranslated, true, passValueFunction, "", unknownTranslated, nil
		}
		case "Controversy":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Controversy")

			return titleTranslated, true, passValueFunction, "", unknownTranslated, nil
		}
		case "BanAdvocates":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Ban Advocates")

			unitsTranslated := translation.TranslateTextFromEnglishToMyLanguage("Advocates")

			unitsWithPadding := " " + unitsTranslated

			return titleTranslated, true, passValueFunction, unitsWithPadding, unknownTranslated, nil
		}
		case "NumberOfReviews":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Number Of Reviews")

			unitsTranslated := translation.TranslateTextFromEnglishToMyLanguage("Reviews")

			unitsWithPadding := " " + unitsTranslated

			return titleTranslated, true, passValueFunction, unitsWithPadding, unknownTranslated, nil
		}
		case "MatchScore":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Match Score")

			return titleTranslated, true, passValueFunction, "", unknownTranslated, nil
		}
		case "DeepAppearanceSimilarity":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Deep Appearance Similarity")

			return titleTranslated, true, passValueFunction, "", unknownTranslated, nil
		}
		case "EyeColorSimilarity":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Eye Color Similarity")

			return titleTranslated, true, passValueFunction, "%", unknownTranslated, nil
		}
		case "EyeColorGenesSimilarity":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Eye Color Genes Similarity")

			return titleTranslated, true, passValueFunction, "%", unknownTranslated, nil
		}
		case "HairColorSimilarity":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Hair Color Similarity")

			return titleTranslated, true, passValueFunction, "%", unknownTranslated, nil
		}
		case "HairColorGenesSimilarity":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Hair Color Genes Similarity")

			return titleTranslated, true, passValueFunction, "%", unknownTranslated, nil
		}
		case "SkinColorSimilarity":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Skin Color Similarity")

			return titleTranslated, true, passValueFunction, "%", unknownTranslated, nil
		}
		case "SkinColorGenesSimilarity":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Skin Color Genes Similarity")

			return titleTranslated, true, passValueFunction, "%", unknownTranslated, nil
		}
		case "HairTextureSimilarity":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Hair Texture Similarity")

			return titleTranslated, true, passValueFunction, "%", unknownTranslated, nil
		}
		case "HairTextureGenesSimilarity":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Hair Texture Genes Similarity")

			return titleTranslated, true, passValueFunction, "%", unknownTranslated, nil
		}
		case "FacialStructureGenesSimilarity":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Facial Structure Genes Similarity")

			return titleTranslated, true, passValueFunction, "%", unknownTranslated, nil
		}
		case "EyeColorGenesSimilarity_NumberOfSimilarAlleles":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Eye Color Genes Similarity - Number Of Similar Alleles")

			unitsTranslated := translation.TranslateTextFromEnglishToMyLanguage("Alleles")

			unitsWithPadding := " " + unitsTranslated

			return titleTranslated, true, passValueFunction, unitsWithPadding, unknownTranslated, nil
		}
		case "SkinColorGenesSimilarity_NumberOfSimilarAlleles":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Skin Color Genes Similarity - Number Of Similar Alleles")

			unitsTranslated := translation.TranslateTextFromEnglishToMyLanguage("Alleles")

			unitsWithPadding := " " + unitsTranslated

			return titleTranslated, true, passValueFunction, unitsWithPadding, unknownTranslated, nil
		}
		case "HairColorGenesSimilarity_NumberOfSimilarAlleles":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Hair Color Genes Similarity - Number Of Similar Alleles")

			unitsTranslated := translation.TranslateTextFromEnglishToMyLanguage("Alleles")

			unitsWithPadding := " " + unitsTranslated

			return titleTranslated, true, passValueFunction, unitsWithPadding, unknownTranslated, nil
		}
		case "HairTextureGenesSimilarity_NumberOfSimilarAlleles":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Hair Texture Genes Similarity - Number Of Similar Alleles")

			unitsTranslated := translation.TranslateTextFromEnglishToMyLanguage("Alleles")

			unitsWithPadding := " " + unitsTranslated

			return titleTranslated, true, passValueFunction, unitsWithPadding, unknownTranslated, nil
		}
		case "FacialStructureGenesSimilarity_NumberOfSimilarAlleles":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Facial Structure Genes Similarity - Number Of Similar Alleles")

			unitsTranslated := translation.TranslateTextFromEnglishToMyLanguage("Alleles")

			unitsWithPadding := " " + unitsTranslated

			return titleTranslated, true, passValueFunction, unitsWithPadding, unknownTranslated, nil
		}
		case "23andMe_AncestralSimilarity":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("23andMe Ancestral Similarity")

			return titleTranslated, true, passValueFunction, "%", unknownTranslated, nil
		}
		case "23andMe_MaternalHaplogroupSimilarity":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("23andMe Maternal Haplogroup Similarity")

			return titleTranslated, true, passValueFunction, "%", unknownTranslated, nil
		}
		case "23andMe_PaternalHaplogroupSimilarity":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("23andMe Paternal Haplogroup Similarity")

			return titleTranslated, true, passValueFunction, "%", unknownTranslated, nil
		}
		case "OffspringProbabilityOfAnyMonogenicDisease":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Offspring Probability Of Any Monogenic Disease")

			return titleTranslated, true, formatPercentageFunction, "%", unknownTranslated, nil
		}
		case "TotalPolygenicDiseaseRiskScore":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Total Polygenic Disease Risk Score")

			return titleTranslated, true, passValueFunction, "/100", noResponseTranslated, nil
		}
		case "OffspringTotalPolygenicDiseaseRiskScore":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Offspring Total Polygenic Disease Risk Score")

			return titleTranslated, true, passValueFunction, "/100", unknownTranslated, nil
		}
		case "OffspringProbabilityOfAnyMonogenicDisease_NumberOfDiseasesTested":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Offspring Probability Of Any Monogenic Disease - Number Of Diseases Tested")

			unitsTranslated := translation.TranslateTextFromEnglishToMyLanguage("Diseases")

			unitsWithPadding := " " + unitsTranslated

			return titleTranslated, true, passValueFunction, unitsWithPadding, "", nil
		}
		case "TotalPolygenicDiseaseRiskScore_NumberOfDiseasesTested":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Total Polygenic Disease Risk Score - Number Of Diseases Tested")

			unitsTranslated := translation.TranslateTextFromEnglishToMyLanguage("Diseases")

			unitsWithPadding := " " + unitsTranslated

			return titleTranslated, true, passValueFunction, unitsWithPadding, "", nil
		}
		case "OffspringTotalPolygenicDiseaseRiskScore_NumberOfDiseasesTested":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Offspring Total Polygenic Disease Risk Score - Number Of Diseases Tested")

			unitsTranslated := translation.TranslateTextFromEnglishToMyLanguage("Diseases")

			unitsWithPadding := " " + unitsTranslated

			return titleTranslated, true, passValueFunction, unitsWithPadding, "", nil
		}
		case "AutismRiskScore",
			"OffspringAutismRiskScore",
			"ObesityRiskScore",
			"OffspringObesityRiskScore",
			"HomosexualnessScore",
			"OffspringHomosexualnessScore":{

			getAttributeTitle := func()(string, error){

				switch attributeName{

					case "AutismRiskScore":{
						return "Autism Risk Score", nil
					}
					case "OffspringAutismRiskScore":{
						return "Offspring Autism Risk Score", nil
					}
					case "ObesityRiskScore":{
						return "Obesity Risk Score", nil
					}
					case "OffspringObesityRiskScore":{
						return "Offspring Obesity Risk Score", nil
					}
					case "HomosexualnessScore":{
						return "Homosexualness Score", nil
					}
					case "OffspringHomosexualnessScore":{
						return "Offspring Homosexualness Score", nil
					}
				}

				return "", errors.New("getAttributeTitle reached with unknown attributeName: " + attributeName)
			}

			attributeTitle, err := getAttributeTitle()
			if (err != nil) { return "", false, nil, "", "", err }

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage(attributeTitle)

			return titleTranslated, true, passValueFunction, "/10", unknownTranslated, nil
		}
		case "PredictedEyeColor":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Predicted Eye Color")

			return titleTranslated, false, translateValueFunction, "", unknownTranslated, nil
		}
		case "PredictedHairTexture":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Predicted Hair Texture")

			return titleTranslated, false, translateValueFunction, "", unknownTranslated, nil
		}
		case "PredictedLactoseTolerance":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Predicted Lactose Tolerance")
	
			return titleTranslated, false, translateValueFunction, "", unknownTranslated, nil
		}
		case "OffspringBlueEyesProbability":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Offspring Blue Eyes Probability")

			return titleTranslated, false, formatPercentageFunction, "%", unknownTranslated, nil
		}
		case "OffspringGreenEyesProbability":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Offspring Green Eyes Probability")

			return titleTranslated, false, formatPercentageFunction, "%", unknownTranslated, nil
		}
		case "OffspringHazelEyesProbability":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Offspring Hazel Eyes Probability")

			return titleTranslated, false, formatPercentageFunction, "%", unknownTranslated, nil
		}
		case "OffspringBrownEyesProbability":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Offspring Brown Eyes Probability")

			return titleTranslated, false, formatPercentageFunction, "%", unknownTranslated, nil
		}
		case "OffspringLactoseToleranceProbability":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Offspring Lactose Tolerance Probability")

			return titleTranslated, false, formatPercentageFunction, "%", unknownTranslated, nil
		}
		case "OffspringStraightHairProbability":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Offspring Straight Hair Probability")

			return titleTranslated, false, formatPercentageFunction, "%", unknownTranslated, nil
		}
		case "OffspringCurlyHairProbability":{

			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage("Offspring Curly Hair Probability")

			return titleTranslated, false, formatPercentageFunction, "%", unknownTranslated, nil
		}
	}

	attributeHasMonogenicDiseasePrefix := strings.HasPrefix(attributeName, "MonogenicDisease_")
	if (attributeHasMonogenicDiseasePrefix == true){

		attributeNameWithoutPrefix := strings.TrimPrefix(attributeName, "MonogenicDisease_")

		hasSuffix := strings.HasSuffix(attributeNameWithoutPrefix, "_ProbabilityOfPassingAVariant")
		if (hasSuffix == true){

			monogenicDiseaseNameWithUnderscores := strings.TrimSuffix(attributeNameWithoutPrefix, "_ProbabilityOfPassingAVariant")

			monogenicDiseaseName := strings.ReplaceAll(monogenicDiseaseNameWithUnderscores, "_", " ")

			title := monogenicDiseaseName + " Probability Of Passing A Variant"
			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage(title)

			return titleTranslated, true, formatPercentageFunction, "", noResponseTranslated, nil
		}

		hasSuffix = strings.HasSuffix(attributeNameWithoutPrefix, "_NumberOfVariantsTested")
		if (hasSuffix == true){

			monogenicDiseaseNameWithUnderscores := strings.TrimSuffix(attributeNameWithoutPrefix, "_NumberOfVariantsTested")

			monogenicDiseaseName := strings.ReplaceAll(monogenicDiseaseNameWithUnderscores, "_", " ")

			title := monogenicDiseaseName + " Number Of Variants Tested"
			titleTranslated := translation.TranslateTextFromEnglishToMyLanguage(title)

			return titleTranslated, true, passValueFunction, "Variants", noResponseTranslated, nil
		}

		return "", false, nil, "", "", errors.New("GetProfileAttributeDisplayInfo called with unknown attributeName: " + attributeName)
	}

	hasLocusValuePrefix := strings.HasPrefix(attributeName, "LocusValue_rs")
	if (hasLocusValuePrefix == true){

		locusRSID := strings.TrimPrefix(attributeName, "LocusValue_")

		locusTranslated := translation.TranslateTextFromEnglishToMyLanguage("Locus")
		valueTranslated := translation.TranslateTextFromEnglishToMyLanguage("Value")

		titleTranslated := locusTranslated + " " + locusRSID + " " + valueTranslated

		return titleTranslated, false, passValueFunction, "", noResponseTranslated, nil
	}

	hasLocusIsPhasedPrefix := strings.HasPrefix(attributeName, "LocusIsPhased_rs")
	if (hasLocusIsPhasedPrefix == true){

		locusRSID := strings.TrimPrefix(attributeName, "LocusIsPhased_")

		locusTranslated := translation.TranslateTextFromEnglishToMyLanguage("Locus")
		isPhasedTranslated := translation.TranslateTextFromEnglishToMyLanguage("Is Phased")

		titleTranslated := locusTranslated + " " + locusRSID + " " + isPhasedTranslated

		return titleTranslated, false, translateValueFunction, "", noResponseTranslated, nil
	}

	return "", false, nil, "", "", errors.New("GetProfileAttributeDisplayInfo called with unknown attributeName: " + attributeName)
}


