using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection.Metadata.Ecma335;
using System.Text;
using System.Threading.Tasks;

namespace Rdh.SocketServer.Client.Models
{
    public class RequestPatientOperationProtocol : EleMedKitProtocol
    {
        public RequestPatientOperationProtocol()
        {
            this.Command = EleMedKitCommand.RequestPatientOperation;
            this.MinLines = base.MinLines + 2;
        }
        public UserInfoProtocol? UserInfo { get; set; }
        public string? RoomCode { get; set; }
        public override string GetContent()
        {
            return base.GetContent()
                + UserInfo?.ToString()
                + AddLineContent(RoomCode);
        }
        public override bool ParseContent(string[] lines)
        {
            if (!base.ParseContent(lines)
                || lines.Length < this.MinLines)
            {
                return false;
            }
            RoomCode = EleMedKitProtocolHelper.GetLineContent(lines[3]);
            UserInfo = new UserInfoProtocol();
            return UserInfo.ParseContent(lines[2]);
        }
    }
}
