// 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 GenericCommand : IEntityCommand
	{
		public string name;
		public byte[] commandData;
		public SerializeEntityID entityParam1;
		public SerializeEntityID entityParam2;
		public SerializeEntityID entityParam3;
		public SerializeEntityID entityParam4;

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

		public GenericCommand
		(
			string dataname,
			byte[] datacommandData,
			SerializeEntityID dataentityParam1,
			SerializeEntityID dataentityParam2,
			SerializeEntityID dataentityParam3,
			SerializeEntityID dataentityParam4
		)
		{
			name = dataname;
			commandData = datacommandData;
			entityParam1 = dataentityParam1;
			entityParam2 = dataentityParam2;
			entityParam3 = dataentityParam3;
			entityParam4 = dataentityParam4;
		}

		public static void Serialize(GenericCommand commandData, IOutProtocolBitStream bitStream)
		{
			bitStream.WriteShortString(commandData.name);
			bitStream.WriteBytesList(commandData.commandData);
			bitStream.WriteEntity(commandData.entityParam1);
			bitStream.WriteEntity(commandData.entityParam2);
			bitStream.WriteEntity(commandData.entityParam3);
			bitStream.WriteEntity(commandData.entityParam4);
		}

		public static GenericCommand Deserialize(IInProtocolBitStream bitStream)
		{
			var dataname = bitStream.ReadShortString();
			var datacommandData = bitStream.ReadBytesList();
			var dataentityParam1 = bitStream.ReadEntity();
			var dataentityParam2 = bitStream.ReadEntity();
			var dataentityParam3 = bitStream.ReadEntity();
			var dataentityParam4 = bitStream.ReadEntity();

			return new GenericCommand
			(
				dataname,
				datacommandData,
				dataentityParam1,
				dataentityParam2,
				dataentityParam3,
				dataentityParam4
			){};
		}
	}
}
