/**
 * Details week-to-week changes in children in the Nursery
 * @returns {string}
 */
App.Facilities.Nursery.childrenReport = function childrenReport() {
	"use strict";

	const
		Matron = V.Matron,
		NL = App.Entity.facilities.nursery.employeesIDs().size,
		CL = V.cribs.length;

	let
		r = ``;

	for (let i = 0; i < CL; i++) {
		const
			child = V.cribs[i];
			// {
			// he, him, his, He, His
			// } = getPronouns(child);

		let
			he,
			his,
			him,
			He,
			His;

		// FIXME: get pronoun system to work with child objects
		if (child.genes === "XX") {
			he = "she",
			him = "her",
			his = "her";
		} else {
			he = "he",
			him = "him",
			his = "his";
		}
		He = capFirstChar(he), His = capFirstChar(his);

		if (child.growTime > 0) {
			r += `<br><span class="pink">${child.slaveName}</span> is growing steadily. ${He} will be ready for release in about ${years(child.growTime)}. `;
		} else {
			r += `<span class="pink">${child.slaveName}</span> is <span class="lime">ready for release.</span> ${He} will be removed from ${V.nurseryName} upon your approach.`;
		}

		// TODO: add Matron and nanny effects
		if (child.actualAge >= 3) {
			if (Matron || NL) {
				let
					chance = jsRandom(1, 100);

				if (jsDef(Matron)) {
					if (Matron.fetish !== "none") {
						if (chance > 90) {
							if (child.fetish === "none") {
								// TODO: clean up the following blocks
								r += `${child.slaveName} has taken a few cues from ${Matron.slaveName}, and `;
								switch (child.fetish) {
									case "submissive":
										r += `is now a submissive`;
										break;
									case "cumslut":
										r += `is now a cumslut`;
										break;
									case "humiliation":
										r += `now has a fetish for humiliation`;
										break;
									case "buttslut":
										r += `is now a buttslut`;
										break;
									case "boobs":
										r += `now has a fetish for boobs and breastplay`;	// TODO: not happy with this wording
										break;
									case "sadist":
										r += `now gets off on causing pain`;
										break;
									case "masochist":
										r += `now gets off on pain`;
										break;
									case "dom":
										r += `is now very sexually dominant`;
										break;
									case "pregnancy":
										r += `has developed a facination for all things pregnancy-related`;
										break;
								}
								r += `. `;
								child.fetish = Matron.fetish;
							} else {
								if (chance > 95) {
									r += `${Matron.slaveName} has rubbed off on ${child.slaveName}, in more ways than one. ${He} `;
									switch (child.fetish) {
										case "submissive":
											r += `is now a submissive`;
											break;
										case "cumslut":
											r += `is now a cumslut`;
											break;
										case "humiliation":
											r += `now has a fetish for humiliation`;
											break;
										case "buttslut":
											r += `is now a buttslut`;
											break;
										case "boobs":
											r += `now has a fetish for boobs and breastplay`;	// TODO: not happy with this wording
											break;
										case "sadist":
											r += `now gets off on causing pain`;
											break;
										case "masochist":
											r += `now gets off on pain`;
											break;
										case "dom":
											r += `is now very sexually dominant`;
											break;
										case "pregnancy":
											r += `has developed a facination for all things pregnancy-related`;
											break;
									}
									r += `. `;
									child.fetish = Matron.fetish;
								}
							}
						}
					}
				}

				if (NL > 0) {
					for (const slave of App.Utils.sortedEmployees(App.Entity.facilities.nursery)) {
						if (slave.fetish !== "none") {
							if (chance > 85) {
								if (child.fetish === "none") {
									r += `${slave.slaveName} has left quite an impression on ${child.slaveName}, and ${he} `;
									switch (child.fetish) {
										case "submissive":
											r += `is now a submissive`;
											break;
										case "cumslut":
											r += `is now a cumslut`;
											break;
										case "humiliation":
											r += `now has a fetish for humiliation`;
											break;
										case "buttslut":
											r += `is now a buttslut`;
											break;
										case "boobs":
											r += `now has a fetish for boobs and breastplay`;	// TODO: not happy with this wording
											break;
										case "sadist":
											r += `now gets off on causing pain`;
											break;
										case "masochist":
											r += `now gets off on pain`;
											break;
										case "dom":
											r += `is now very sexually dominant`;
											break;
										case "pregnancy":
											r += `has developed a facination for all things pregnancy-related`;
											break;
									}
									r += `. `;
									child.fetish = slave.fetish;
								} else {
									if (chance > 90) {
										r += `${child.slaveName} seems to have taken to ${slave.slaveName}'s example, and `;
										switch (child.fetish) {
										case "submissive":
											r += `is now a submissive`;
											break;
										case "cumslut":
											r += `is now a cumslut`;
											break;
										case "humiliation":
											r += `now has a fetish for humiliation`;
											break;
										case "buttslut":
											r += `is now a buttslut`;
											break;
										case "boobs":
											r += `now has a fetish for boobs and breastplay`;	// TODO: not happy with this wording
											break;
										case "sadist":
											r += `now gets off on causing pain`;
											break;
										case "masochist":
											r += `now gets off on pain`;
											break;
										case "dom":
											r += `is now very sexually dominant`;
											break;
										case "pregnancy":
											r += `has developed a facination for all things pregnancy-related`;
											break;
									}
									r += `. `;
										child.fetish = slave.fetish;
									}
								}
							}
						}
					}
				}

				// TODO: add education system
				if (jsDef(Matron) && Matron) {
					const {
						// eslint-disable-next-line no-unused-vars
						he2, him2, his2, hers2, himself2, boy2, He2, His2
					} = getPronouns(Matron).appendSuffix('2');

					if (Matron.intelligence + Matron.intelligenceImplant > 65) {
						r += `${Matron.slaveName} is so intelligent and well-educated that ${he2} is able to teach ${CL > 1 ? `the children` : `${child.slaveName}`} very effectively, and so ${CL > 1 ? child.slaveName : `${he}`} gradually grows smarter. `;	// TODO: not happy with this
						child.intelligenceImplant += 3;	// TODO: should this raise intelligence instead?
					} else if (Matron.intelligenceImplant > 30) {
						r += `${Matron.slaveName}'s education makes up for the fact that ${CL > 1 ? child.slaveName : `${he}`} isn't the brightest and allows ${him2} to teach ${CL > 1 ? `the children` : `${child.slaveName}`} quite effectively, and so ${CL > 1 ? child.slaveName : `${he}`} grows a bit smarter. `;	// TODO:
						child.intelligenceImplant += 2;
					} else if (Matron.intelligence > 50) {
						r += `Though ${Matron.slaveName} has had little to no formal education, ${his2} natural brilliance allows ${him2} to teach ${CL > 1 ? `the children` : `${child.slaveName}`} quite effectively, and so ${CL > 1 ? child.slaveName : `${he}`} grows a bit smarter. `;	// TODO:
						child.intelligenceImplant += 2;
					} else {
						r += `${Matron.slaveName} isn't the brightest, and isn't as effective at teaching as ${he2} otherwise could be. ${He2} is only somewhat effective at teaching ${CL > 1 ? `the children` : `${child.slaveName}`}, and so ${CL > 1 ? child.slaveName : `${he}`} grows just a little bit smarter. `;	// TODO:
						child.intelligenceImplant++;
					}
				}

				if (NL > 0) {
					let
						averageIntelligence = 0,
						averageIntelligenceImplant = 0;

					const nannies = App.Entity.facilities.nursery.employees();
					for (const nanny of nannies) {
						averageIntelligence += nanny.intelligence;
						averageIntelligenceImplant += nanny.intelligenceImplant;
					}

					const firstNanny = nannies[0];

					averageIntelligence = averageIntelligence / NL;
					averageIntelligenceImplant = averageIntelligenceImplant / NL;

					if (averageIntelligence + averageIntelligenceImplant > 65) {
						r += `${NL > 1 ? `The nannies are mostly` : `${firstNanny.slaveName} is`} very intelligent and well educated and are able to teach ${CL > 1 ? `the children` : child.slaveName} very effectively. `;
						child.intelligenceImplant += 3;
					} else if (averageIntelligence > 50) {
						r += `${NL > 1 ? `The nannies are mostly` : `${firstNanny.slaveName} is`} very intelligent and able to teach ${CL > 1 ? `the children` : child.slaveName} quite effectively. `;
						child.intelligenceImplant += 2;
					} else if (averageIntelligenceImplant > 25) {
						r += `${NL > 1 ? `The nannies are mostly` : `${firstNanny.slaveName} is`} very well educated and able to teach ${CL > 1 ? `the children` : child.slaveName} quite effectively. `;
						child.intelligenceImplant += 2;
					} else if (averageIntelligenceImplant > 15) {
						r += `${NL > 1 ? `The nannies are mostly` : `${firstNanny.slaveName} is`} well educated and able to teach ${CL > 1 ? `the children` : child.slaveName} fairly effectively. `;
						child.intelligenceImplant++;
					}
				}

				// TODO: add fitness system
				if (jsDef(Matron) && Matron) {
					// TODO:
				}

				if (NL > 0) {
					// TODO:
				}
			}

			// TODO: add friend / rivalry system
			// TODO: add relations to friend system
			for (let j = 0; j < CL; j++) {
				const
					c = V.cribs[j];

				let
					friend = 0,
					rival = 0,
					chance = jsRandom(1, 100);

				if (c.actualAge >= 3) {
					if (c.fetish === child.fetish) {
						r += ``; // TODO:
						friend++;
					}

					if (c.sexualQuirk === child.sexualQuirk || c.behavioralQuirk === child.behavioralQuirk) {
						r += ``; // TODO:
						friend++;
					}

					if (c.fetish === "sadist" || c.fetish === "dom") {
						r += ``; // TODO:
						rival++;
					} else if (child.fetish === "sadist" || child.fetish === "dom") {
						r += ``; // TODO:
						rival++;
					}

					if (friend) {
						if (rival) {
							if (friend > rival) {
								if (chance > 75) {
									r += ``;	// TODO:
									child.relationship = 1, child.relationshipTarget = c.ID;
									c.relationship = 1, c.relationshipTarget = child.ID;
								}
							}
						} else {
							if (chance > 60) {
								r += ``;	// TODO:
								child.relationship = 1, child.relationshipTarget = c.ID;
								c.relationship = 1, c.relationshipTarget = child.ID;
							}
						}
					}

					if (rival) {
						if (friend) {
							if (rival > friend) {
								if (chance > 75) {
									r += ``;	// TODO:
								}
							}
						} else {
							if (chance > 60) {
								r += ``;	// TODO:
							}
						}
					}
				}
			}

			// TODO: rework these entirely
			if (Matron || NL) {
				if (V.nurseryWeight) {
					const firstNanny = NL > 0 ? App.Entity.facilities.nursery.employees()[0] : null;
					r += `<br>`;
					if (V.nurseryWeightSetting === 1) {
						if (child.weight < 200) {
							child.weight += 5;
						}
						r += `${He} is being fed an excessive amount of food, causing <span class="red">rapid weight gain.</span> `;
					} else if (V.nurseryWeightSetting === 2) {
						if (child.weight > 10) {
							child.weight--;
							r += `${Matron ? Matron.slaveName : NL > 1 ? `A nanny` : firstNanny.slaveName} notices ${he} is overweight and <span class="green">decreases the amount of food ${he} eats.</span> `;
						} else if (child.weight <= -10) {
							child.weight++;
							r += `${Matron ? Matron.slaveName : NL > 1 ? `A nanny` : firstNanny.slaveName} notices ${he} is underweight and <span class="green">increases the amount of food ${he} eats.</span> `;
						} else {
							r += `${He} is <span class="lime">currently a healthy weight;</span> efforts will be made to maintain it. `;
						}
					} else if (V.nurseryWeightSetting === 0) {
						if (child.weight > -20) {
							r += `${His} developing body <span class="red">quickly sheds its gained weight.</span> `;
							child.weight -= 40;
						}
					}
				} else {
					if (child.weight > -20) {
						child.weight -= 40;
						r += `${His} developing body <span class="red">quickly sheds its gained weight.</span>`;
					}
				}

				// TODO: rewrite these
				if (V.nurseryMuscles) {
					r += `${He} is being given anabolic steroids causing <span class="green">rapid muscle development.</span> `;	// TODO: not happy with this
					if (V.nurseryMusclesSetting === 2) {
						if (child.muscles < 100) {
							child.muscles += 5;
						}
						r += `${Matron ? Matron : NL > 1 ? `A nanny` : firstNanny.slaveName} notices ${he} is overly muscular and <span class="green">decreases ${his} steroid dosage.</span> `;
					} else if (V.nurseryMusclesSetting === 1) {
						if (child.muscles > 10) {
							child.muscles--;
							r += `${Matron ? Matron : NL > 1 ? `A nanny` : firstNanny.slaveName} notices ${he} is weak and <span class="green">increases ${his} steroid dosage.</span> `;
						} else if (child.muscles < -10) {
							child.muscles++;
							r += `${He} has <span class="lime">a healthy musculature;</span> efforts will be made to maintain it. `;
						} else {
							r += `${His} developing body <span class="red">quickly loses its gained muscle.</span> `;
						}
					} else if (V.nurseryMusclesSetting === 0) {
						if (child.muscles > -100) {
							child.muscles -= 40;
							r += `${His} developing body <span class="red">quickly loses its gained muscle.</span> `;
						}
					}
				}
			}
		} else {
			// TODO:
		}
		r += `<br>`;
	}

	return r;
};

src/facilities/nursery/widgets/reports/childrenReport.js