using System;
using System.Collections.Generic;

namespace MaidStatus
{
	public static class Title
	{
		public static string Get(Status status)
		{
			Title.CreateData();
			int num = Title.checkAchivementList.Count - 1;
			while (0 <= num)
			{
				if (Title.checkAchivementList[num].Value.GreaterThanOrEqualToStatus(status))
				{
					return Title.checkAchivementList[num].Key;
				}
				num--;
			}
			return string.Empty;
		}

		public static void CreateData()
		{
			if (Title.checkAchivementList != null)
			{
				return;
			}
			Title.checkAchivementList = new List<KeyValuePair<string, ParametersPack>>();
			using (AFileBase afileBase = GameUty.FileSystem.FileOpen("maid_status_title_list.nei"))
			{
				using (CsvParser csvParser = new CsvParser())
				{
					bool condition = csvParser.Open(afileBase);
					NDebug.Assert(condition, "maid_status_title_list.nei\nopen failed.");
					for (int i = 1; i < csvParser.max_cell_y; i++)
					{
						int cell_x = 0;
						if (!csvParser.IsCellToExistData(cell_x, i))
						{
							break;
						}
						string cellAsString = csvParser.GetCellAsString(cell_x++, i);
						ParametersPack parametersPack = new ParametersPack();
						while (csvParser.IsCellToExistData(cell_x, i))
						{
							string cellAsString2 = csvParser.GetCellAsString(cell_x++, i);
							int cellAsInteger = csvParser.GetCellAsInteger(cell_x++, i);
							parametersPack.Add(ParametersPack.NameToStatusType(cellAsString2), cellAsInteger);
						}
						Title.checkAchivementList.Add(new KeyValuePair<string, ParametersPack>(cellAsString, parametersPack));
					}
				}
			}
		}

		private static List<KeyValuePair<string, ParametersPack>> checkAchivementList;
	}
}
