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

namespace HengshanPaymentTerminal.MessageEntity.Outgoing
{
    public class DataContent : CardMessageBase
    {
        public DataContent() : base(Command.DataContent)
        {
            
        }

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

        [Format(2, EncodingType.BIN, -89)]
        public ushort SegmentOffset { get; set; }

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

        [EnumerableFormat("%cascade", -87, EncodingType = EncodingType.BIN)]
        public List<byte> Content { get; set; }
    }

    public class FuelPriceRecord : MessageTemplateBase
    {
        [Format(1, EncodingType.BIN, 1)]
        public byte Version { get; set; }

        [Format(6, EncodingType.BcdString, 2)]
        public string EffectiveTime { get; set; }

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

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

        [Format(2, EncodingType.BCD, 5)]
        public ushort FuelProductCode { get; set; }

        [Format(32, EncodingType.HexString, 6)]
        public string FuelProductName { get; set; }

        [Format(4, EncodingType.BIN, 7)]
        public int Density { get; set; }

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

        [Format(2, EncodingType.BIN, 9)]
        public ushort Price1 { get; set; }

        [Format(2, EncodingType.BIN, 10)]
        public ushort Price2 { get; set; }

        [Format(2, EncodingType.BIN, 11)]
        public ushort Price3 { get; set; }

        [Format(2, EncodingType.BIN, 12)]
        public ushort Price4 { get; set; }

        [Format(2, EncodingType.BIN, 13)]
        public ushort Price5 { get; set; }

        [Format(2, EncodingType.BIN, 14)]
        public ushort Price6 { get; set; }

        [Format(2, EncodingType.BIN, 15)]
        public ushort Price7 { get; set; }

        [Format(2, EncodingType.BIN, 16)]
        public ushort Price8 { get; set; }
    }

    public class MultiFuelPriceRecord : MessageTemplateBase
    {
        [Format(1, EncodingType.BIN, 1)]
        public byte Version { get; set; }

        [Format(6, EncodingType.BcdString, 2)]
        public string EffectiveTime { get; set; }

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

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

        [Format(2, EncodingType.BCD, 5)]
        public ushort FirstFuelProductCode { get; set; }

        [Format(32, EncodingType.HexString, 6)]
        public string FirstFuelProductName { get; set; }

        [Format(4, EncodingType.BIN, 7)]
        public int FirstDensity { get; set; }

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

        [Format(2, EncodingType.BIN, 9)]
        public ushort FirstPrice1 { get; set; }

        //[Format(2, EncodingType.BIN, 10)]
        //public ushort FirstPrice2 { get; set; }

        //[Format(2, EncodingType.BIN, 11)]
        //public ushort FirstPrice3 { get; set; }

        //[Format(2, EncodingType.BIN, 12)]
        //public ushort FirstPrice4 { get; set; }

        //[Format(2, EncodingType.BIN, 13)]
        //public ushort FirstPrice5 { get; set; }

        //[Format(2, EncodingType.BIN, 14)]
        //public ushort FirstPrice6 { get; set; }

        //[Format(2, EncodingType.BIN, 15)]
        //public ushort FirstPrice7 { get; set; }

        //[Format(2, EncodingType.BIN, 16)]
        //public ushort FirstPrice8 { get; set; }

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

        [Format(2, EncodingType.BCD, 18)]
        public ushort SecondFuelProductCode { get; set; }

        [Format(32, EncodingType.HexString, 19)]
        public string SecondFuelProductName { get; set; }

        [Format(4, EncodingType.BIN, 20)]
        public int SecondDensity { get; set; }

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

        [Format(2, EncodingType.BIN, 22)]
        public ushort SecondPrice1 { get; set; }

        //[Format(2, EncodingType.BIN, 23)]
        //public ushort SecondPrice2 { get; set; }

        //[Format(2, EncodingType.BIN, 24)]
        //public ushort SecondPrice3 { get; set; }

        //[Format(2, EncodingType.BIN, 25)]
        //public ushort SecondPrice4 { get; set; }

        //[Format(2, EncodingType.BIN, 26)]
        //public ushort SecondPrice5 { get; set; }

        //[Format(2, EncodingType.BIN, 27)]
        //public ushort SecondPrice6 { get; set; }

        //[Format(2, EncodingType.BIN, 28)]
        //public ushort SecondPrice7 { get; set; }

        //[Format(2, EncodingType.BIN, 29)]
        //public ushort SecondPrice8 { get; set; }
    }


    public class ListedCardRecord : MessageTemplateBase
    {
        [Format(2, EncodingType.BIN, 1)]
        public byte Version { get; set; }

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

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

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

        [Format(4, EncodingType.BIN, 5)]
        public int CardCount { get; set; }
    }
}
