using System.Collections.Generic;
using Sockeye.Biz;
namespace Sockeye.DataList
{
    internal class TranslationDataList : DataListProcessingBase
    {
        public TranslationDataList(long translationId)
        {
            DefaultListAType = SockType.Translation;
            SQLFrom = "from atranslation";
            var RoleSet = BizRoles.GetRoleSet(DefaultListAType);
            AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
            DefaultColumns = new List<string>() { "name", "stock", "cjkindex" };
            DefaultSortBy = new Dictionary<string, string>() { { "name", "+" } };
            FieldDefinitions = new List<DataListFieldDefinition>();

            FieldDefinitions.Add(new DataListFieldDefinition
            {
                TKey = "Translation",
                FieldKey = "name",
                SockType = (int)SockType.Translation,
                UiFieldDataType = (int)UiFieldDataType.Text,
                SqlIdColumnName = "atranslation.id",
                SqlValueColumnName = "atranslation.name",
                IsRowId = true
            });

            FieldDefinitions.Add(new DataListFieldDefinition
            {
                TKey = "GlobalCJKIndex",
                FieldKey = "cjkindex",
                UiFieldDataType = (int)UiFieldDataType.Bool,
                SqlValueColumnName = "atranslation.cjkindex"
            });

            FieldDefinitions.Add(new DataListFieldDefinition
            {
                TKey = "ReadOnly",
                FieldKey = "stock",
                UiFieldDataType = (int)UiFieldDataType.Bool,
                SqlValueColumnName = "atranslation.stock"
            });
        }
    }//eoc
}//eons