using System.Collections.Generic;
using AyaNova.Biz;
using Newtonsoft.Json.Linq;
namespace AyaNova.PickList
{
    /// <summary>
    /// PickList object base class
    /// </summary>
    internal abstract class AyaPickList : IAyaPickList
    {
        public AyaPickList()
        { }
        public string SQLFrom { get; set; }
        public List<AyaPickListFieldDefinition> ColumnDefinitions { get; set; }
        public AuthorizationRoles AllowedRoles { get; set; }
        public AyaType DefaultListObjectType { get; set; }
        public string DefaultTemplate { get; set; }
        //return array of field keys in list view
        public List<string> GetFieldListFromTemplate(JArray template)
        {
            List<string> ret = new List<string>();
            for (int i = 0; i < template.Count; i++)
            {
                var cm = template[i];
                ret.Add(cm["fld"].Value<string>());
            }
            return ret;
        }
    }//eoc
}//eons