using Newtonsoft.Json;
using System.ComponentModel;

namespace Pilz.Net.Api.Messages;

public static class GeneralItemMessages<T>
{
    public class Item(T item) : ObjectMessage(item);
    public class Items(List<T> items) : ObjectsMessage(items);

    [EditorBrowsable(EditorBrowsableState.Never)]
    public class ObjectMessage(T item) : ApiMessage
    {
        [JsonProperty(TypeNameHandling = TypeNameHandling.Auto)]
        public T Item { get; } = item;
    }

    [EditorBrowsable(EditorBrowsableState.Never)]
    public class ObjectsMessage(List<T> items) : ApiMessage
    {
        [JsonProperty(ItemTypeNameHandling = TypeNameHandling.Auto)]
        public List<T> Items { get; } = items;
    }
}
