//
//  InPacket.cs
//
//  Copyright (c) František Boháček. All rights reserved.
//  Licensed under the MIT license. See LICENSE file in the project root for full license information.
using NosSmooth.Packets.Enums;
using NosSmooth.Packets.Enums.Entities;
using NosSmooth.PacketSerializer.Abstractions.Attributes;
using NosSmooth.PacketSerializer.Abstractions.Common;
namespace NosSmooth.Packets.Server.Maps;
/// 
/// There is a new entity on the map present.
/// 
/// The type of the entity.
/// The name of the entity, present only for players.
/// The vnum of the entity, present only for non players.
/// Unknown value present only for players. It's always "-".
/// The id of the entity.
/// The x coordinate the entity is at.
/// The y coordinate the entity is at.
/// The direction the entity is looking, present only for non-objects.
/// The player data sub packet present only for players.
/// The item data sub packet present only for objects.
/// The non player data sub packet present only for npcs and monsters.
[PacketHeader("in", PacketSource.Server)]
[GenerateSerializer(true)]
public record InPacket
(
    [PacketIndex(0)]
    EntityType EntityType,
    [PacketConditionalIndex(1, "EntityType", false,  EntityType.Player)]
    NameString? Name,
    [PacketConditionalIndex(2, "EntityType", true, EntityType.Player)]
    int? VNum,
    [PacketConditionalIndex(3, "EntityType", false, EntityType.Player)]
    string? Unknown,
    [PacketIndex(4)]
    long EntityId,
    [PacketIndex(5)]
    short PositionX,
    [PacketIndex(6)]
    short PositionY,
    [PacketConditionalIndex(7, "EntityType", true, EntityType.Object)]
    byte? Direction,
    [PacketConditionalIndex(8, "EntityType", false, EntityType.Player)]
    InPlayerSubPacket? PlayerSubPacket,
    [PacketConditionalIndex(9, "EntityType", false, EntityType.Object)]
    InItemSubPacket? ItemSubPacket,
    [PacketConditionalIndex(10, "EntityType", true, EntityType.Player, EntityType.Object)]
    InNonPlayerSubPacket? NonPlayerSubPacket
) : IPacket;