using Knoks.Core.Entities;
using Knoks.Core.Entities.Interfaces;
using System.Collections;

namespace Knoks.Api.Entities
{
    public class ApiObject<T> : IApiResult
    {
        public ApiObject(T value)
        {
            Value = value;
        }

        private T _value;
        public T Value
        {
            get { return _value; }
            set
            {
                if (value is IEnumerable)
                    throw new System.InvalidOperationException("Type is IEnumerable. Use ApiArray<T> class instead");

                _value = value;
            }
        }
    }
}
