using ButcherFactory.BO.Utils;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ButcherFactory.Controls
{
  public class WeightConfig
  {
    public string WeightSet { get; set; }

    public string ComSet { get; set; }

    public int? RateSet { get; set; }

    public int? BitSet { get; set; }

    public string Format { get; set; }

    public decimal? Discont { get; set; }

    public int WeightType { get; set; }

    public decimal MinWeight { get; set; }

    public decimal MaxWeight { get; set; }

    public static WeightConfig Init(string flag)
    {
      var path = Path.Combine("Config", flag + "WeightConfig.xml");
      return XmlUtil.DeserializeFromFile<WeightConfig>(path);
    }

    public void Save(string flag)
    {
      var path = Path.Combine("Config", flag + "WeightConfig.xml");
      XmlUtil.SerializerObjToFile(this, path);
    }
  }
}
