// Copyright (c) coherence ApS.
// For all coherence generated code, the coherence SDK license terms apply. See the license file in the coherence Package root folder for more information.

// <auto-generated>
// Generated file. DO NOT EDIT!
// </auto-generated>
namespace Coherence.Generated
{
	using Coherence.ProtocolDef;
	using Coherence.Serializer;
	using Coherence.Brook;
	using UnityEngine;
	using Coherence.Entity;

	public struct AuthorityRequest : IEntityCommand
	{
		public uint requester;
		public int authorityType;

		public MessageTarget Routing => MessageTarget.All;
		public uint GetComponentType() => Definition.InternalAuthorityRequest;

		public AuthorityRequest
		(
			uint datarequester,
			int dataauthorityType
		)
		{
			requester = datarequester;
			authorityType = dataauthorityType;
		}

		public static void Serialize(AuthorityRequest commandData, IOutProtocolBitStream bitStream)
		{
			bitStream.WriteUIntegerRange(commandData.requester, 32, 0);
			bitStream.WriteIntegerRange(commandData.authorityType, 2, 0);
		}

		public static AuthorityRequest Deserialize(IInProtocolBitStream bitStream)
		{
			var datarequester = bitStream.ReadUIntegerRange(32, 0);
			var dataauthorityType = bitStream.ReadIntegerRange(2, 0);

			return new AuthorityRequest
			(
				datarequester,
				dataauthorityType
			){};
		}
	}
}
