using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Contracts.BindingModels;
using IronBarCode;

namespace BusinessLogic.BusinessLogic
{
    public class BarcodeLogic
    {
        public GeneratedBarcode CreateBarcode(ProductBindingModel model, bool save)
        {
            var barCode = IronBarCode.BarcodeWriter.CreateBarcode(model.Id.ToString(), BarcodeEncoding.Code128);
            var path = $"product{model.Id}.png";
            if (save) return barCode.SaveAsPng(path);
            return barCode;
        }
    }
}
