package polygenicDiseases

import "errors"

import "seekia/internal/helpers"


func getBreastCancerDiseaseObject()PolygenicDisease{

	// Map Structure: rsID -> (map[Reference Name]Reference Link)
	locusReferencesMap := make(map[int64]map[string]string)

	locus1_ReferencesMap := make(map[string]string)
	locus1_ReferencesMap["SNPedia.com - rs16942"] = "https://www.snpedia.com/index.php/Rs16942"

	locusReferencesMap[16942] = locus1_ReferencesMap

	locus2_ReferencesMap := make(map[string]string)
	locus2_ReferencesMap["SNPedia.com - rs1045485"] = "https://www.snpedia.com/index.php/Rs1045485"

	locusReferencesMap[1045485] = locus2_ReferencesMap

	locus3_ReferencesMap := make(map[string]string)
	locus3_ReferencesMap["SNPedia.com - rs34330"] = "https://www.snpedia.com/index.php/Rs34330"

	locusReferencesMap[34330] = locus3_ReferencesMap

	locus4_ReferencesMap := make(map[string]string)
	locus4_ReferencesMap["SNPedia.com - rs144848"] = "https://www.snpedia.com/index.php/Rs144848"

	locusReferencesMap[144848] = locus4_ReferencesMap

	locus5_ReferencesMap := make(map[string]string)
	locus5_ReferencesMap["SNPedia.com - rs766173"] = "https://www.snpedia.com/index.php/Rs766173"

	locusReferencesMap[766173] = locus5_ReferencesMap

	locus6_ReferencesMap := make(map[string]string)
	locus6_ReferencesMap["SNPedia.com - rs1799950"] = "https://www.snpedia.com/index.php/Rs1799950"
	
	locusReferencesMap[1799950] = locus6_ReferencesMap

	locus7_ReferencesMap := make(map[string]string)
	locus7_ReferencesMap["SNPedia.com - rs4986850"] = "https://www.snpedia.com/index.php/Rs4986850"

	locusReferencesMap[4986850] = locus7_ReferencesMap

	locus8_ReferencesMap := make(map[string]string)
	locus8_ReferencesMap["SNPedia.com - rs2227945"] = "https://www.snpedia.com/index.php/Rs2227945"

	locusReferencesMap[2227945] = locus8_ReferencesMap

	locus9_ReferencesMap := make(map[string]string)
	locus9_ReferencesMap["SNPedia.com - rs1799966"] = "https://www.snpedia.com/index.php/Rs1799966"

	locusReferencesMap[1799966] = locus9_ReferencesMap

	locus10_ReferencesMap := make(map[string]string)
	locus10_ReferencesMap["SNPedia.com - rs4987117"] = "https://www.snpedia.com/index.php/Rs4987117"

	locusReferencesMap[4987117] = locus10_ReferencesMap

	locus11_ReferencesMap := make(map[string]string)
	locus11_ReferencesMap["SNPedia.com - rs1799954"] = "https://www.snpedia.com/index.php/Rs1799954"

	locusReferencesMap[1799954] = locus11_ReferencesMap
	
	locus12_ReferencesMap := make(map[string]string)
	locus12_ReferencesMap["SNPedia.com - rs11571746"] = "https://www.snpedia.com/index.php/Rs11571746"

	locusReferencesMap[11571746] = locus12_ReferencesMap

	locus13_ReferencesMap := make(map[string]string)
	locus13_ReferencesMap["SNPedia.com - rs11571747"] = "https://www.snpedia.com/index.php/Rs11571747"

	locusReferencesMap[11571747] = locus13_ReferencesMap

	locus14_ReferencesMap := make(map[string]string)
	locus14_ReferencesMap["SNPedia.com - rs4987047"] = "https://www.snpedia.com/index.php/Rs4987047"

	locusReferencesMap[4987047] = locus14_ReferencesMap

	locus15_ReferencesMap := make(map[string]string)
	locus15_ReferencesMap["SNPedia.com - rs11571833"] = "https://www.snpedia.com/index.php/Rs11571833"
	
	locusReferencesMap[11571833] = locus15_ReferencesMap

	locus16_ReferencesMap := make(map[string]string)
	locus16_ReferencesMap["SNPedia.com - rs1801426"] = "https://www.snpedia.com/index.php/Rs1801426"

	locusReferencesMap[1801426] = locus16_ReferencesMap

	locus17_ReferencesMap := make(map[string]string)
	locus17_ReferencesMap["SNPedia.com - rs3218707"] = "https://www.snpedia.com/index.php/Rs3218707"
	
	locusReferencesMap[3218707] = locus17_ReferencesMap

	locus18_ReferencesMap := make(map[string]string)
	locus18_ReferencesMap["SNPedia.com - rs4987945"] = "https://www.snpedia.com/index.php/Rs4987945"
	
	locusReferencesMap[4987945] = locus18_ReferencesMap

	locus19_ReferencesMap := make(map[string]string)
	locus19_ReferencesMap["SNPedia.com - rs4986761"] = "https://www.snpedia.com/index.php/Rs4986761"
	
	locusReferencesMap[4986761] = locus19_ReferencesMap

	locus20_ReferencesMap := make(map[string]string)
	locus20_ReferencesMap["SNPedia.com - rs3218695"] = "https://www.snpedia.com/index.php/Rs3218695"
	
	locusReferencesMap[3218695] = locus20_ReferencesMap

	locus21_ReferencesMap := make(map[string]string)
	locus21_ReferencesMap["SNPedia.com - rs1800056"] = "https://www.snpedia.com/index.php/Rs1800056"
	
	locusReferencesMap[1800056] = locus21_ReferencesMap

	locus22_ReferencesMap := make(map[string]string)
	locus22_ReferencesMap["SNPedia.com - rs1800057"] = "https://www.snpedia.com/index.php/Rs1800057"

	locusReferencesMap[1800057] = locus22_ReferencesMap

	locus23_ReferencesMap := make(map[string]string)
	locus23_ReferencesMap["SNPedia.com - rs3092856"] = "https://www.snpedia.com/index.php/Rs3092856"

	locusReferencesMap[3092856] = locus23_ReferencesMap

	locus24_ReferencesMap := make(map[string]string)
	locus24_ReferencesMap["SNPedia.com - rs1800058"] = "https://www.snpedia.com/index.php/Rs1800058"

	locusReferencesMap[1800058] = locus24_ReferencesMap

	locus25_ReferencesMap := make(map[string]string)
	locus25_ReferencesMap["SNPedia.com - rs1801673"] = "https://www.snpedia.com/index.php/Rs1801673"

	locusReferencesMap[1801673] = locus25_ReferencesMap

	locus26_ReferencesMap := make(map[string]string)
	locus26_ReferencesMap["SNPedia.com - rs17879961"] = "https://www.snpedia.com/index.php/Rs17879961"

	locusReferencesMap[17879961] = locus26_ReferencesMap

	// TODO:
	//-https://www.snpedia.com/index.php/Rs1042522
	//-https://www.snpedia.com/index.php/Rs889312
	//-https://www.snpedia.com/index.php/Rs997669
	//-https://www.snpedia.com/index.php/Rs1042638
	//-https://www.snpedia.com/index.php/Rs1219648
	//-https://www.snpedia.com/index.php/Rs13281615
	//-https://www.snpedia.com/index.php/Rs3817198
	//-https://www.snpedia.com/index.php/Rs13387042
	//-https://www.snpedia.com/index.php/Rs4415084
	//-https://www.snpedia.com/index.php/Rs3803662
	//-https://www.snpedia.com/index.php/Rs2056116
	//-https://www.snpedia.com/index.php/Rs2268578
	//-https://www.snpedia.com/index.php/Rs2854344
	//-https://www.snpedia.com/index.php/Rs2981578
	//-https://www.snpedia.com/index.php/Rs2981582
	//-https://www.snpedia.com/index.php/Rs3176336
	//-https://www.snpedia.com/index.php/Rs3218005
	//-https://www.snpedia.com/index.php/Rs3218536
	//-https://www.snpedia.com/index.php/Rs3731239
	//-https://www.snpedia.com/index.php/Rs7895676
	//-https://www.snpedia.com/index.php/Rs140068132
	
	breastCancerLociList := helpers.GetListOfMapKeys(locusReferencesMap)

	referencesMap := make(map[string]string)
	referencesMap["SNPedia.com - Breast Cancer"] = "https://www.snpedia.com/index.php/Breast_cancer"
	referencesMap["SNPedia.com - Breast Cancer Lifetime Risk"] = "https://www.snpedia.com/index.php/Breast_cancer_lifetime_risk"

	getAverageRiskProbabilitiesFunction := func(maleOrFemale string, inputAge int)(float64, error){

		if (maleOrFemale == "Male"){
			//TODO: Men can get breast cancer too. Add risks here.
			return 0, nil
		}	

		if (maleOrFemale != "Female"){
			return 0, errors.New("Trying to get breast cancer risk probability for invalid maleOrFemale: " + maleOrFemale)
		}

		if (inputAge <= 19){
			return 0, nil
		}
		if (inputAge <= 24){
			return 0, nil
		}
		if (inputAge <= 29){
			return 0.1, nil
		}
		if (inputAge <= 34){
			return 0.2, nil
		}
		if (inputAge <= 39){
			return 0.6, nil
		}
		if (inputAge <= 44){
			return 1.4, nil
		}
		if (inputAge <= 49){
			return 2.5, nil
		}
		if (inputAge <= 54){
			return 4, nil
		}
		if (inputAge <= 59){
			return 5.6, nil
		}
		if (inputAge <= 64){
			return 7.6, nil
		}
		if (inputAge <= 69){
			return 9.7, nil
		}
		if (inputAge <= 74){
			return 11.7, nil
		}
		if (inputAge <= 79){
			return 13.4, nil
		}

		return 15.8, nil
	}

	breastCancerObject := PolygenicDisease{

		DiseaseName: "Breast Cancer",
		EffectedSex: "Both",
		DiseaseDescription: "Cancer growth in the tissue of a person's chest breast.",
		LocusReferencesMap: locusReferencesMap,
		LociList: breastCancerLociList,
		GetAverageRiskProbabilitiesFunction: getAverageRiskProbabilitiesFunction,
		References: referencesMap,
	}

	return breastCancerObject
}



