using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Rdh.SocketServer.Client.Models
{
    public class UserInfoProtocol : ModelProtocol
    {
        public string? UserName { get; set; }
        public string? UserCode { get; set; }
        public string? CardCode { get; set; }
        public string? UserRole { get; set; }
        public override string GetContent()
        {
            return UserName
                + AddBlockContent(UserCode)
                + AddBlockContent(CardCode)
                + AddBlockContent(UserRole);
        }
        public override bool ParseContent(string content)
        {
            if (!base.ParseContent(content))
            {
                return false;
            }
            string[] blocks = EleMedKitProtocolHelper.GetContentBlocks(content);
            if (blocks.Length > 3)
            {
                UserName = blocks[0];
                UserCode = blocks[1];
                CardCode = blocks[2];
                UserRole = blocks[3];
                return true;
            }
            return false;
        }
    }
}
