using Edge.Core.Parser.BinaryParser.Attributes;
using System;
using System.Collections.Generic;
using System.Text;

namespace  HengshanPaymentTerminal.MessageEntity.Incoming
{
    /// <summary>
    /// Full totalizer data returned by pump (or technically speaking, the terminal),
    /// which contains the volume accumulator and amount accumulator.
    /// </summary>
    public class Totalizer : CardMessageBase
    {
        #region Constructor

        public Totalizer() : base(Command.ReturnTotalizer)
        {

        }

        #endregion

        [Format(1, EncodingType.BIN, -90)]
        public byte NozzleCount { get; set; }

        [EnumerableFormat("NozzleCount", -89, EncodingType = EncodingType.BIN)]
        public List<TotalizerDatum> TotalizerData { get; set; }
    }

    public class TotalizerDatum
    {

        [Format(1, EncodingType.BIN, 1)]
        public byte NozzleNo { get; set; }

        [Format(4, EncodingType.HexString, 2)]
        public string VolumeTotal { get; set; }

        [Format(4, EncodingType.HexString, 3)]
        public string AmountTotal { get; set; }
    }
}
