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

namespace Rdh.SocketServer.Client.Models
{
    public class PatientOperationProtocol : ModelProtocol
    {
        public string? Key { get; set; }
        public string? PatientName { get; set; }
        public string? PatientCode { get; set; }
        public string? Gender { get; set; }
        public string? Age { get; set; }
        public string? OperationPart { get; set; }
        public string? OperationName { get; set; }
        public override string GetContent()
        {
            return Key
                + AddBlockContent(PatientName)
                + AddBlockContent(PatientCode)
                + AddBlockContent(Gender)
                + AddBlockContent(Age)
                + AddBlockContent(OperationPart)
                + AddBlockContent(OperationName);
        }
        public override bool ParseContent(string content)
        {
            if (base.ParseContent(content))
            {
                string[] blocks = EleMedKitProtocolHelper.GetContentBlocks(content);
                if (blocks.Length > 6)
                {
                    Key = blocks[0];
                    PatientName = blocks[1];
                    PatientCode = blocks[2];
                    Gender = blocks[3];
                    Age = blocks[4];
                    OperationPart = blocks[5];
                    OperationName = blocks[6];
                    return true;
                }
            }
            return false;
        }
    }
}
