using LeafWeb.Core.Utility;

namespace LeafWeb.Core.Entities
{
	/// <summary>
	/// First model prediction is calculated at each sampling point.
	/// Then model prediction is calculated at many selected levels of intercelluar CO2 partial pressure 
	/// levels under three limitation states to enable plotting curves.The same structure is then repeated for 
	/// each fitting of the same curve with different parameters to be estimated and with different curves. Note 
	/// that some common information about a curve is repeated for each data point to make the structure of the 
	/// file as regular as possible.
	/// </summary>
	public class CntrlComparisonFittingInfo
	{
		/// <summary>
		/// the curve identifier, repeated for each point
		/// </summary>
		[ParseInfo(1)]
		public string CurveID { get; set; }

		/// <summary>
		/// whether or not chlorophyll fluorescence data are used for identifying the limitation states 
		/// 0 = not used, 1 = used. (Currently this choice is still under evaluation and therefore ChlFlUse? = 0).
		/// </summary>
		[ParseInfo(2, alternateTitle: "ChlFlUse?")]
		public bool ChlFlUse {get; set; }

		/// <summary>
		///  whether or not the internal conductance (gi) is fitted for.  
		/// 0 = not fitted and gi is either infinite or fixed at the value provided by the user. 
		/// 1 = gi is estiamted, repeated for each point
		/// </summary>
		[ParseInfo(3, alternateTitle: "FitGi?")]
		public bool FitGi {get; set;}

		/// <summary>
		/// whether or not the chloroplastic CO2 partial pressure photocompensation point is 
		/// fitted for. 0= not fitted, a prescribed value is used, repeated for each point
		/// </summary>
		[ParseInfo(4, alternateTitle: "FitGamma*?")]
		public bool FitGammaStar {get; set; }

		/// <summary>
		/// whether or not the apparent Michaelis - Menten constant Kco = Kc(1+O/Ko) is fitted for. 
		/// 0= not fitted, a prescribed value is calculated from Kc, Ko and the oxygen partial pressure. 
		/// 1= Fitted for, repeated for each point
		/// </summary>
		[ParseInfo(5, alternateTitle: "FitKco?")]
		public bool FitKco {get; set; }

		/// <summary>
		/// whether the dark respiration is fitted for. 0= not fitted for, a prescribed value is used. 
		/// 1= fitted for. repeated for each point
		/// </summary>
		[ParseInfo(6, alternateTitle: "FitRd?")]
		public bool FitRd {get; set;}

		/// <summary>
		/// whether alpha (the non-returned fraction of the glycolate carbon 
		/// recycled in the photorespiratory cycle) is fitted for. 
		/// 0= not fitted for and alpha = 0 
		/// 1= fitted for, repeated for each point
		/// </summary>
		[ParseInfo(7, alternateTitle: "FitAlpha?")]
		public bool FitAlpha {get; set;}

		/// <summary>
		/// the combination of limitation states present in the A/Ci dataset. Parameters 
		/// are estimated for those limitation states that occur in the measured curve, repeated for each point
		/// Rubisco: Rubisco limitation(Vcmax, Kco)
		/// RuBP: RuBP regeneration limitation(J)
		/// Tpu: export limitation(TPU, alpha)
		/// </summary>
		[ParseInfo(8)]
		public string LimitCombina { get; set; }

		/// <summary>
		/// intercellular CO2 partial pressure
		/// </summary>
		[ParseInfo(9, units:"Pa")]
		public double PCO2i { get; set; }

		/// <summary>
		/// chloroplastic CO2 partial pressure corresponding to the PCO2i of a point.  
		/// PCO2c=PCO2i-AnetCal/internal conductance
		/// </summary>
		[ParseInfo(10, units:"Pa")]
		public double PCO2c { get; set; }

		/// <summary>
		/// measured net assimilation rate
		/// </summary>
		[ParseInfo(11, units: "umol/m2/s")]
		public double AnetMeas { get; set; }

		/// <summary>
		/// calculated net assimilation rate 
		/// </summary>
		[ParseInfo(12, units: "umol/m2/s")]
		public double AnetCal { get; set; }

		// TODO: readme has weitedrms, data file has PCOiCal
		// weitedrms - (umol/m2/s), root mean square error of the fitting (weiting coefficient =1)
		[ParseInfo(13)]
		public double PCOiCal { get; set; }

		/// <summary>
		/// 1 = point limited by rubisco 
		/// 2 = point limited by RuBP regeneration
		/// 3 = point limited by TPU
		/// </summary>
		[ParseInfo(14, units:"1,2,3")]
		public int PointLimitType { get; set; }

		public virtual CntrlComparison CntrlComparison { get; set; }
	}
}