Files
CarbonLib/Models/CarbonRequest.cs
Francisco Salas bd98adc4cb
All checks were successful
FarmMaps.Develop/CarbonLib/pipeline/head This commit looks good
moved to logic from api to lib
2021-06-21 10:25:05 +02:00

98 lines
2.5 KiB
C#

using NetTopologySuite.Geometries;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Runtime.Serialization;
using System.Threading.Tasks;
namespace CarbonService.Models
{
public class CarbonRequest
{
public Geometry geometry { get; set; }
[Required]
public int PostalCode { get; set; }
public List<CropField> CropFields { get; set; }
//public List<OrgManureApplied> OrgManureApplied { get; set; }
}
public class CropField
{
[Required]
public string Name { get; set; }
[Required]
public double Area { get; set; }
[Required]
public string SoilType { get; set; }
[Required]
public SoilProperty SoilProperty { get; set; }
[Required]
public List<HistoricalCropData> HistoricalCropData { get; set; }
public List<GreenManure> GreenManures { get; set; }
}
public class SoilProperty
{
public double? OM_Const { get; set; }
public double? Clay_Content { get; set; }
}
public class OrgManureApplied
{
[Required]
public string Crop { get; set; }
public List<OrganicManureType> OrganicManures { get; set; }
public int? CropYield { get; set; }
public bool CropRes { get; set; }
}
public class OrganicManureType
{
[Required]
public string Type { get; set; }
[Required]
public double Quantity { get; set; }
}
public class HistoricalCropData
{
[Required]
public int Year { get; set; }
//[Required]
//public List<string> Crops { get; set; }
[Required]
public List<OrgManureApplied> Crops { get; set; }
}
public class GreenManure
{
[Required]
public int Year { get; set; }
[Required]
public List<GreenManureType> GreenManureTypes { get; set; }
}
public class GreenManureType
{
[Required]
public string Type { get; set; }
//public string Quality { get; set; }
[JsonConverter(typeof(StringEnumConverter))]
public Quality Quality { get; set; }
}
public enum Quality
{
[EnumMember(Value = "Goed")]
Good,
[EnumMember(Value = "Matig")]
Average,
[EnumMember(Value = "Slecht")]
Bad
}
}