using System.Collections.Generic;
using System.Linq;
using Sockeye.Biz;
using Sockeye.Models;

namespace Sockeye.DataList
{
    internal class GZCaseDataList : DataListProcessingBase
    {
        public GZCaseDataList(long translationId)
        {
            DefaultListAType = SockType.GZCase;
            SQLFrom = @"FROM agzcase ";

            var RoleSet = BizRoles.GetRoleSet(DefaultListAType);
            AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
            DefaultColumns = new List<string>() { "GZCaseId", "Tags", "GZCaseName", "GZCaseClosed" };
            DefaultSortBy = new Dictionary<string, string>() { { "GZCaseId", "-" } };
            FieldDefinitions = new List<DataListFieldDefinition>();
 

            FieldDefinitions.Add(new DataListFieldDefinition
            {
                TKey = "GZCaseId",
                FieldKey = "GZCaseId",
                SockType = (int)SockType.GZCase,
                UiFieldDataType = (int)UiFieldDataType.Integer,
                SqlIdColumnName = "agzcase.id",
                SqlValueColumnName = "agzcase.caseid",
                IsRowId = true
            });

            FieldDefinitions.Add(new DataListFieldDefinition
            {
                TKey = "Created",
                FieldKey = "Created",
                UiFieldDataType = (int)UiFieldDataType.DateTime,
                SqlValueColumnName = "agzcase.created"
            });

            FieldDefinitions.Add(new DataListFieldDefinition
            {
                TKey = "GZCaseClosed",
                FieldKey = "GZCaseClosed",
                UiFieldDataType = (int)UiFieldDataType.DateTime,
                SqlValueColumnName = "agzcase.closed"
            });

            FieldDefinitions.Add(new DataListFieldDefinition
            {
                TKey = "GZCaseName",
                FieldKey = "GZCaseName",
                UiFieldDataType = (int)UiFieldDataType.Text,
                SqlValueColumnName = "agzcase.name"
            });

            FieldDefinitions.Add(new DataListFieldDefinition
            {
                TKey = "Tags",
                FieldKey = "Tags",
                UiFieldDataType = (int)UiFieldDataType.Tags,
                SqlValueColumnName = "agzcase.tags"
            });

        }

    }//eoc
}//eons